fix issue where, depending on a creation of flattening, the lambda functions may be a set or an []interface{}

This commit is contained in:
clint shryock 2017-01-20 11:25:30 -06:00
parent 6d4f4007fe
commit 91753409b9
1 changed files with 16 additions and 4 deletions

View File

@ -229,8 +229,14 @@ func defaultCacheBehaviorHash(v interface{}) int {
} }
} }
if d, ok := m["lambda_function_association"]; ok { if d, ok := m["lambda_function_association"]; ok {
s := d.(*schema.Set) var associations []interface{}
for _, lfa := range s.List() { switch d.(type) {
case *schema.Set:
associations = d.(*schema.Set).List()
default:
associations = d.([]interface{})
}
for _, lfa := range associations {
buf.WriteString(fmt.Sprintf("%d-", lambdaFunctionAssociationHash(lfa.(map[string]interface{})))) buf.WriteString(fmt.Sprintf("%d-", lambdaFunctionAssociationHash(lfa.(map[string]interface{}))))
} }
} }
@ -367,8 +373,14 @@ func cacheBehaviorHash(v interface{}) int {
buf.WriteString(fmt.Sprintf("%s-", d)) buf.WriteString(fmt.Sprintf("%s-", d))
} }
if d, ok := m["lambda_function_association"]; ok { if d, ok := m["lambda_function_association"]; ok {
s := d.(*schema.Set) var associations []interface{}
for _, lfa := range s.List() { switch d.(type) {
case *schema.Set:
associations = d.(*schema.Set).List()
default:
associations = d.([]interface{})
}
for _, lfa := range associations {
buf.WriteString(fmt.Sprintf("%d-", lambdaFunctionAssociationHash(lfa.(map[string]interface{})))) buf.WriteString(fmt.Sprintf("%d-", lambdaFunctionAssociationHash(lfa.(map[string]interface{}))))
} }
} }