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

fix: WebACL associations make timeout configurable. #30002

Merged
merged 3 commits into from
Mar 14, 2023
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
Next Next commit
fix: WebACL associations make timeout configurable.
The time taken for a WebACl to get in a state
where it can be associated varies and in recent
times has become larger than the hardcoded timeout.

Making this configurable to allow for this.
  • Loading branch information
grahamhar committed Mar 14, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 555d102bbb97a59b483a7e629425c6a282675dd0
6 changes: 5 additions & 1 deletion internal/service/wafv2/web_acl_association.go
Original file line number Diff line number Diff line change
@@ -33,6 +33,10 @@ func ResourceWebACLAssociation() *schema.Resource {
StateContext: schema.ImportStatePassthroughContext,
},

Timeouts: &schema.ResourceTimeout{
Create: schema.DefaultTimeout(webACLAssociationCreateTimeout),
},

Schema: map[string]*schema.Schema{
"resource_arn": {
Type: schema.TypeString,
@@ -62,7 +66,7 @@ func resourceWebACLAssociationCreate(ctx context.Context, d *schema.ResourceData
}

log.Printf("[INFO] Creating WAFv2 WebACL Association: %s", input)
_, err := tfresource.RetryWhenAWSErrCodeEquals(ctx, webACLAssociationCreateTimeout, func() (interface{}, error) {
_, err := tfresource.RetryWhenAWSErrCodeEquals(ctx, d.Timeout(schema.TimeoutCreate), func() (interface{}, error) {
return conn.AssociateWebACLWithContext(ctx, input)
}, wafv2.ErrCodeWAFUnavailableEntityException)

6 changes: 6 additions & 0 deletions website/docs/r/wafv2_web_acl_association.html.markdown
Original file line number Diff line number Diff line change
@@ -92,6 +92,12 @@ The following arguments are supported:

No additional attributes are exported.

## Timeouts

[Configuration options](https://www.terraform.io/docs/configuration/blocks/resources/syntax.html#operation-timeouts):

* `create` - (Default `5m`)

## Import

WAFv2 Web ACL Association can be imported using `WEB_ACL_ARN,RESOURCE_ARN` e.g.,