-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Terraformer phase 2 updates #921
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,12 +24,20 @@ func resourceAciContractInterfaceRelationship() *schema.Resource { | |
}, | ||
|
||
SchemaVersion: 1, | ||
Schema: AppendBaseAttrSchema(map[string]*schema.Schema{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we remove this function and add the annotation as separate entries to the Schema? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This Function appends description and annotation attribute to the respective resource schema. Some of the ACI classes doesn't support description but may support annotation, Hence addition of annotation separately. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you consider creating separate function for annotation only and re-use this? Also have a look at the AppendAttrSchemas function in https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/aci/base_attr_schema.go, this could perhaps be leveraged. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a GetAnnotation function for uniform schema implementation. |
||
Schema: map[string]*schema.Schema{ | ||
"application_epg_dn": { | ||
Type: schema.TypeString, | ||
Required: true, | ||
ForceNew: true, | ||
}, | ||
"annotation": &schema.Schema{ | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Computed: true, | ||
DefaultFunc: func() (interface{}, error) { | ||
return "orchestrator:terraform", nil | ||
}, | ||
}, | ||
"prio": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
|
@@ -49,7 +57,7 @@ func resourceAciContractInterfaceRelationship() *schema.Resource { | |
Required: true, | ||
ForceNew: true, | ||
}, | ||
}), | ||
}, | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,23 +23,26 @@ func resourceAciInfraRsDomP() *schema.Resource { | |
}, | ||
|
||
SchemaVersion: 1, | ||
Schema: AppendBaseAttrSchema(map[string]*schema.Schema{ | ||
Schema: map[string]*schema.Schema{ | ||
"attachable_access_entity_profile_dn": { | ||
Type: schema.TypeString, | ||
Required: true, | ||
ForceNew: true, | ||
}, | ||
"annotation": { | ||
"annotation": &schema.Schema{ | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Computed: true, | ||
DefaultFunc: func() (interface{}, error) { | ||
return "orchestrator:terraform", nil | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment as Akini on other file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a GetAnnotation function for uniform schema implementation. |
||
}, | ||
"domain_dn": { | ||
Type: schema.TypeString, | ||
Required: true, | ||
ForceNew: true, | ||
}, | ||
}), | ||
}, | ||
} | ||
} | ||
|
||
|
@@ -61,11 +64,11 @@ func setInfraRsDomPAttributes(infraRsDomP *models.InfraRsDomP, d *schema.Resourc | |
if dn != infraRsDomP.DistinguishedName { | ||
d.Set("attachable_access_entity_profile_dn", "") | ||
} | ||
d.Set("attachable_access_entity_profile_dn", GetParentDn(dn, fmt.Sprintf("/%s", fmt.Sprintf(models.RninfraRsDomP, d.Get("domain_dn"))))) | ||
infraRsDomPMap, err := infraRsDomP.ToMap() | ||
if err != nil { | ||
return d, err | ||
} | ||
d.Set("attachable_access_entity_profile_dn", GetParentDn(dn, fmt.Sprintf("/rsdomP-[%s]", infraRsDomPMap["tDn"]))) | ||
d.Set("annotation", infraRsDomPMap["annotation"]) | ||
d.Set("domain_dn", infraRsDomPMap["tDn"]) | ||
return d, nil | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as Akini on other file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a GetAnnotation function for uniform schema implementation.