Skip to content
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

aws_acm_certificate: fix subject_alternative_names forces recreation #11300

Merged
merged 2 commits into from
Jul 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions aws/resource_aws_acm_certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,10 @@ func resourceAwsAcmCertificate() *schema.Resource {
},
},
"subject_alternative_names": {
Type: schema.TypeList,
Optional: true,
Computed: true,
n3ph marked this conversation as resolved.
Show resolved Hide resolved
ForceNew: true,
ConflictsWith: []string{"private_key", "certificate_body", "certificate_chain"},
Type: schema.TypeSet,
Optional: true,
Computed: true,
ForceNew: true,
Elem: &schema.Schema{
Type: schema.TypeString,
StateFunc: func(v interface{}) string {
Expand All @@ -73,6 +72,8 @@ func resourceAwsAcmCertificate() *schema.Resource {
return strings.TrimSuffix(v.(string), ".")
},
},
Set: schema.HashString,
ConflictsWith: []string{"private_key", "certificate_body", "certificate_chain"},
},
"validation_method": {
Type: schema.TypeString,
Expand Down Expand Up @@ -197,8 +198,8 @@ func resourceAwsAcmCertificateCreateRequested(d *schema.ResourceData, meta inter
}

if sans, ok := d.GetOk("subject_alternative_names"); ok {
subjectAlternativeNames := make([]*string, len(sans.([]interface{})))
for i, sanRaw := range sans.([]interface{}) {
subjectAlternativeNames := make([]*string, len(sans.(*schema.Set).List()))
for i, sanRaw := range sans.(*schema.Set).List() {
subjectAlternativeNames[i] = aws.String(strings.TrimSuffix(sanRaw.(string), "."))
}
params.SubjectAlternativeNames = subjectAlternativeNames
Expand Down