Skip to content

Commit

Permalink
provider/aws: Revert explicit security_group depreciation (#6664)
Browse files Browse the repository at this point in the history
  • Loading branch information
catsby committed May 13, 2016
1 parent 03593cf commit 5b99e66
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions builtin/providers/aws/resource_aws_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,9 +533,20 @@ func resourceAwsInstanceRead(d *schema.ResourceData, meta interface{}) error {
if err := d.Set("vpc_security_group_ids", sgs); err != nil {
return err
}
if err := d.Set("security_groups", []string{}); err != nil {
return err
}
// This block clears out security_groups if we're using vpc_security_groups.
// While it corrects the behvior by only using security groups ids when
// appropriate, and not both, it introduced some confusion and backwards
// incompatibily for users who are still using security_groups for non
// default VPCs.
//
// TODO:
// - re-activate this block of code and add explicit note in the
// CHANGELOG about migrating to vpc_security_group_ids
// - add warning / validation to code to alert users of this
//
// if err := d.Set("security_groups", []string{}); err != nil {
// return err
// }
} else {
for _, sg := range instance.SecurityGroups {
sgs = append(sgs, *sg.GroupName)
Expand All @@ -544,9 +555,19 @@ func resourceAwsInstanceRead(d *schema.ResourceData, meta interface{}) error {
if err := d.Set("security_groups", sgs); err != nil {
return err
}
if err := d.Set("vpc_security_group_ids", []string{}); err != nil {
return err
}
// This block clears out vpc_security_groups if we're using security_groups.
// While it corrects the behvior by only using security group names when
// appropriate, and not both, it introduced some confusion and backwards
// incompatibily for users
//
// TODO:
// - re-activate this block of code and add explicit note in the
// CHANGELOG about migrating to vpc_security_group_ids
// - add warning / validation to code to alert users of this
//
// if err := d.Set("vpc_security_group_ids", []string{}); err != nil {
// return err
// }
}

if err := readBlockDevices(d, instance, conn); err != nil {
Expand Down

0 comments on commit 5b99e66

Please sign in to comment.