Generalize fix to ignore empty VPC config

This commit is contained in:
Maxime Bury 2016-02-17 21:45:13 -05:00
parent eb2aaef016
commit f0f3c430a8
1 changed files with 6 additions and 3 deletions

View File

@ -688,11 +688,14 @@ func flattenLambdaVpcConfigResponse(s *lambda.VpcConfigResponse) []map[string]in
return nil
}
// Empty
if len(s.SubnetIds) == 0 && len(s.SecurityGroupIds) == 0 && s.VpcId == nil {
return nil
}
settings["subnet_ids"] = schema.NewSet(schema.HashString, flattenStringList(s.SubnetIds))
settings["security_group_ids"] = schema.NewSet(schema.HashString, flattenStringList(s.SecurityGroupIds))
if s.VpcId != nil {
settings["vpc_id"] = *s.VpcId
}
settings["vpc_id"] = *s.VpcId
return []map[string]interface{}{settings}
}