Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provider/aws: Revert security group / vpc security group depreciation #6664

Merged
merged 1 commit into from
May 13, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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