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

add configurable timeouts to security groups #3599

Merged
merged 3 commits into from
Mar 5, 2018
Merged
Changes from 1 commit
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
12 changes: 9 additions & 3 deletions aws/resource_aws_security_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ func resourceAwsSecurityGroup() *schema.Resource {
State: resourceAwsSecurityGroupImportState,
},

Timeouts: &schema.ResourceTimeout{
Create: schema.DefaultTimeout(10 * time.Minute),
Update: schema.DefaultTimeout(10 * time.Minute),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not include Update if its not used

Delete: schema.DefaultTimeout(10 * time.Minute),
},

SchemaVersion: 1,
MigrateState: resourceAwsSecurityGroupMigrateState,

Expand Down Expand Up @@ -274,7 +280,7 @@ func resourceAwsSecurityGroupCreate(d *schema.ResourceData, meta interface{}) er
Pending: []string{""},
Target: []string{"exists"},
Refresh: SGStateRefreshFunc(conn, d.Id()),
Timeout: 10 * time.Minute,
Timeout: d.Timeout(schema.TimeoutCreate),
}

resp, err := stateConf.WaitForState()
Expand Down Expand Up @@ -443,7 +449,7 @@ func resourceAwsSecurityGroupDelete(d *schema.ResourceData, meta interface{}) er
}
}

return resource.Retry(5*time.Minute, func() *resource.RetryError {
return resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError {
_, err := conn.DeleteSecurityGroup(&ec2.DeleteSecurityGroupInput{
GroupId: aws.String(d.Id()),
})
Expand Down Expand Up @@ -1281,7 +1287,7 @@ func deleteLingeringLambdaENIs(conn *ec2.EC2, d *schema.ResourceData) error {
Pending: []string{"true"},
Target: []string{"false"},
Refresh: networkInterfaceAttachedRefreshFunc(conn, *eni.NetworkInterfaceId),
Timeout: 10 * time.Minute,
Timeout: d.Timeout(schema.TimeoutDelete),
}
if _, err := stateConf.WaitForState(); err != nil {
return fmt.Errorf(
Expand Down