Merge pull request #2311 from hashicorp/b-aws-empty-vpc-sgs

provider/aws: ignore empty vpc_security_group_ids
This commit is contained in:
Paul Hinze 2015-06-11 08:49:01 -05:00
commit 35eb5e6395
1 changed files with 6 additions and 6 deletions

View File

@ -539,8 +539,8 @@ func resourceAwsInstanceUpdate(d *schema.ResourceData, meta interface{}) error {
if d.HasChange("vpc_security_group_ids") { if d.HasChange("vpc_security_group_ids") {
var groups []*string var groups []*string
if v := d.Get("vpc_security_group_ids"); v != nil { if v := d.Get("vpc_security_group_ids").(*schema.Set); v.Len() > 0 {
for _, v := range v.(*schema.Set).List() { for _, v := range v.List() {
groups = append(groups, aws.String(v.(string))) groups = append(groups, aws.String(v.(string)))
} }
} }
@ -908,8 +908,8 @@ func buildAwsInstanceOpts(
ni.PrivateIPAddress = aws.String(v.(string)) ni.PrivateIPAddress = aws.String(v.(string))
} }
if v := d.Get("vpc_security_group_ids"); v != nil { if v := d.Get("vpc_security_group_ids").(*schema.Set); v.Len() > 0 {
for _, v := range v.(*schema.Set).List() { for _, v := range v.List() {
ni.Groups = append(ni.Groups, aws.String(v.(string))) ni.Groups = append(ni.Groups, aws.String(v.(string)))
} }
} }
@ -930,8 +930,8 @@ func buildAwsInstanceOpts(
opts.SecurityGroups = groups opts.SecurityGroups = groups
} }
if v := d.Get("vpc_security_group_ids"); v != nil { if v := d.Get("vpc_security_group_ids").(*schema.Set); v.Len() > 0 {
for _, v := range v.(*schema.Set).List() { for _, v := range v.List() {
opts.SecurityGroupIDs = append(opts.SecurityGroupIDs, aws.String(v.(string))) opts.SecurityGroupIDs = append(opts.SecurityGroupIDs, aws.String(v.(string)))
} }
} }