From 67852ba7ebc4c84ccb36378c5947bc46e098957b Mon Sep 17 00:00:00 2001 From: Michael Gerlach Date: Sun, 15 Dec 2019 04:05:29 +0100 Subject: [PATCH 1/2] let subject_alternative_names be a set --- aws/resource_aws_acm_certificate.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/aws/resource_aws_acm_certificate.go b/aws/resource_aws_acm_certificate.go index 4c1eaad56d5..0f405fdc55c 100644 --- a/aws/resource_aws_acm_certificate.go +++ b/aws/resource_aws_acm_certificate.go @@ -60,11 +60,9 @@ func resourceAwsAcmCertificate() *schema.Resource { }, }, "subject_alternative_names": { - Type: schema.TypeList, - Optional: true, - Computed: true, - ForceNew: true, - ConflictsWith: []string{"private_key", "certificate_body", "certificate_chain"}, + Type: schema.TypeSet, + Optional: true, + ForceNew: true, Elem: &schema.Schema{ Type: schema.TypeString, StateFunc: func(v interface{}) string { @@ -73,6 +71,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, @@ -197,8 +197,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 From 6dac29be5d0d37b720defc7fe6685f6f0edd971e Mon Sep 17 00:00:00 2001 From: Michael Gerlach Date: Sat, 30 May 2020 00:22:14 +0200 Subject: [PATCH 2/2] re-add computed: true to subject_alternative_names attribute --- aws/resource_aws_acm_certificate.go | 1 + 1 file changed, 1 insertion(+) diff --git a/aws/resource_aws_acm_certificate.go b/aws/resource_aws_acm_certificate.go index 0f405fdc55c..7e999a11807 100644 --- a/aws/resource_aws_acm_certificate.go +++ b/aws/resource_aws_acm_certificate.go @@ -62,6 +62,7 @@ func resourceAwsAcmCertificate() *schema.Resource { "subject_alternative_names": { Type: schema.TypeSet, Optional: true, + Computed: true, ForceNew: true, Elem: &schema.Schema{ Type: schema.TypeString,