provider/aws: Fix panic when passing statuses to aws_acm_certificate (#9990)

Fixes #9989

When passing a list of statuses to the acm_certificate data source, we
were trying to cast a schema.TypeList directly to []string

We need to do it via an []interface{} and then cast to string when
ranging over the results. Without this, we get a panic
This commit is contained in:
Paul Stack 2016-11-09 15:53:36 +00:00 committed by GitHub
parent 9e0af96afa
commit d66359b046
1 changed files with 2 additions and 2 deletions

View File

@ -40,10 +40,10 @@ func dataSourceAwsAcmCertificateRead(d *schema.ResourceData, meta interface{}) e
statuses, ok := d.GetOk("statuses") statuses, ok := d.GetOk("statuses")
if ok { if ok {
statusStrings := statuses.([]string) statusStrings := statuses.([]interface{})
statusList := make([]*string, len(statusStrings)) statusList := make([]*string, len(statusStrings))
for i, status := range statusStrings { for i, status := range statusStrings {
statusList[i] = aws.String(strings.ToUpper(status)) statusList[i] = aws.String(strings.ToUpper(status.(string)))
} }
params.CertificateStatuses = statusList params.CertificateStatuses = statusList
} else { } else {