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

Allow configurable timeout when reading security group rule #3911

Closed
Closed
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion aws/resource_aws_security_group_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ func resourceAwsSecurityGroupRule() *schema.Resource {
SchemaVersion: 2,
MigrateState: resourceAwsSecurityGroupRuleMigrateState,

Timeouts: &schema.ResourceTimeout{
Read: schema.DefaultTimeout(5 * time.Minute),
},

Schema: map[string]*schema.Schema{
"type": {
Type: schema.TypeString,
Expand Down Expand Up @@ -225,7 +229,7 @@ information and instructions for recovery. Error message: %s`, sg_id, awsErr.Mes
id := ipPermissionIDHash(sg_id, ruleType, perm)
log.Printf("[DEBUG] Computed group rule ID %s", id)

err = resource.Retry(5*time.Minute, func() *resource.RetryError {
err = resource.Retry(d.Timeout(schema.TimeoutRead), func() *resource.RetryError {
sg, err := findResourceSecurityGroup(conn, sg_id)

if err != nil {
Expand Down
7 changes: 7 additions & 0 deletions website/docs/r/security_group_rule.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,10 @@ Import a rule that has itself and an IPv6 CIDR block as sources:
```console
$ terraform import aws_security_group_rule.rule_name sg-656c65616e6f72_ingress_tcp_80_80_self_2001:db8::/48
```

## Timeouts

`aws_security_group_rule` provides the following [Timeouts](/docs/configuration/resources.html#timeouts)
configuration options:

- `read` - (Default `5 minutes`) How long to wait for reading a rsecurity group rule.