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

resource/aws_security_group: Avoid dropping group from state on AWS consistency issues #2284

Closed
wants to merge 1 commit into from
Closed
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
9 changes: 7 additions & 2 deletions aws/resource_aws_security_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ func resourceAwsSecurityGroupCreate(d *schema.ResourceData, meta interface{}) er

}

return resourceAwsSecurityGroupUpdate(d, meta)
return resourceAwsSecurityGroupUpdateExisting(d, meta)
}

func resourceAwsSecurityGroupRead(d *schema.ResourceData, meta interface{}) error {
Expand Down Expand Up @@ -405,7 +405,11 @@ func resourceAwsSecurityGroupUpdate(d *schema.ResourceData, meta interface{}) er

group := sgRaw.(*ec2.SecurityGroup)

err = resourceAwsSecurityGroupUpdateRules(d, "ingress", meta, group)
return resourceAwsSecurityGroupUpdateExisting(group, d, meta)
}

func resourceAwsSecurityGroupUpdateExisting(group *ec2.SecurityGroup, d *schema.ResourceData, meta interface{}) error {
err := resourceAwsSecurityGroupUpdateRules(d, "ingress", meta, group)
if err != nil {
return err
}
Expand All @@ -418,6 +422,7 @@ func resourceAwsSecurityGroupUpdate(d *schema.ResourceData, meta interface{}) er
}

if !d.IsNewResource() {
conn := meta.(*AWSClient).ec2conn
if err := setTags(conn, d); err != nil {
return err
}
Expand Down