Skip to content

Commit

Permalink
Merge pull request #35974 from hong-yi/f-aws_waf_web_acl-add-appinturl
Browse files Browse the repository at this point in the history
add application integration url as exported attribute
  • Loading branch information
ewbankkit authored Feb 26, 2024
2 parents fa2db56 + c193db5 commit 1859728
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .changelog/35974.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_wafv2_web_acl: Add `application_integration_url` attribute
```
8 changes: 6 additions & 2 deletions internal/service/wafv2/web_acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ func ResourceWebACL() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"application_integration_url": {
Type: schema.TypeString,
Computed: true,
},
"association_config": associationConfigSchema(),
"capacity": {
Type: schema.TypeInt,
Expand Down Expand Up @@ -232,8 +236,8 @@ func resourceWebACLRead(ctx context.Context, d *schema.ResourceData, meta interf
}

webACL := output.WebACL
arn := aws.StringValue(webACL.ARN)
d.Set("arn", arn)
d.Set("application_integration_url", output.ApplicationIntegrationURL)
d.Set("arn", webACL.ARN)
d.Set("capacity", webACL.Capacity)
if err := d.Set("association_config", flattenAssociationConfig(webACL.AssociationConfig)); err != nil {
return diag.Errorf("setting association_config: %s", err)
Expand Down
5 changes: 5 additions & 0 deletions internal/service/wafv2/web_acl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func TestAccWAFV2WebACL_basic(t *testing.T) {
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckWebACLExists(ctx, resourceName, &v),
acctest.MatchResourceAttrRegionalARN(resourceName, "arn", "wafv2", regexache.MustCompile(`regional/webacl/.+$`)),
resource.TestCheckResourceAttr(resourceName, "application_integration_url", ""),
resource.TestCheckResourceAttr(resourceName, "association_config.#", "0"),
resource.TestCheckResourceAttr(resourceName, "captcha_config.#", "0"),
resource.TestCheckResourceAttr(resourceName, "challenge_config.#", "0"),
Expand Down Expand Up @@ -523,6 +524,7 @@ func TestAccWAFV2WebACL_ManagedRuleGroup_basic(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckWebACLExists(ctx, resourceName, &v),
acctest.MatchResourceAttrRegionalARN(resourceName, "arn", "wafv2", regexache.MustCompile(`regional/webacl/.+$`)),
resource.TestCheckResourceAttr(resourceName, "application_integration_url", ""),
resource.TestCheckResourceAttr(resourceName, "name", webACLName),
resource.TestCheckResourceAttr(resourceName, "rule.#", "1"),
resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{
Expand Down Expand Up @@ -731,6 +733,7 @@ func TestAccWAFV2WebACL_ManagedRuleGroup_ManagedRuleGroupConfig_ACFPRuleSet(t *t
Check: resource.ComposeTestCheckFunc(
testAccCheckWebACLExists(ctx, resourceName, &v),
acctest.MatchResourceAttrRegionalARN(resourceName, "arn", "wafv2", regexache.MustCompile(`regional/webacl/.+$`)),
resource.TestMatchResourceAttr(resourceName, "application_integration_url", regexache.MustCompile(`https:\/\/.*\.sdk\.awswaf\.com.*`)),
resource.TestCheckResourceAttr(resourceName, "name", webACLName),
resource.TestCheckResourceAttr(resourceName, "rule.#", "1"),
resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{
Expand Down Expand Up @@ -823,6 +826,7 @@ func TestAccWAFV2WebACL_ManagedRuleGroup_ManagedRuleGroupConfig_ATPRuleSet(t *te
Check: resource.ComposeTestCheckFunc(
testAccCheckWebACLExists(ctx, resourceName, &v),
acctest.MatchResourceAttrRegionalARN(resourceName, "arn", "wafv2", regexache.MustCompile(`regional/webacl/.+$`)),
resource.TestMatchResourceAttr(resourceName, "application_integration_url", regexache.MustCompile(`https:\/\/.*\.sdk\.awswaf\.com.*`)),
resource.TestCheckResourceAttr(resourceName, "name", webACLName),
resource.TestCheckResourceAttr(resourceName, "rule.#", "1"),
resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{
Expand Down Expand Up @@ -909,6 +913,7 @@ func TestAccWAFV2WebACL_ManagedRuleGroup_ManagedRuleGroupConfig_BotControl(t *te
Check: resource.ComposeTestCheckFunc(
testAccCheckWebACLExists(ctx, resourceName, &v),
acctest.MatchResourceAttrRegionalARN(resourceName, "arn", "wafv2", regexache.MustCompile(`regional/webacl/.+$`)),
resource.TestMatchResourceAttr(resourceName, "application_integration_url", regexache.MustCompile(`https:\/\/.*\.sdk\.awswaf\.com.*`)),
resource.TestCheckResourceAttr(resourceName, "name", webACLName),
resource.TestCheckResourceAttr(resourceName, "rule.#", "1"),
resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/wafv2_web_acl.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,7 @@ The `uri_path` block supports the following arguments:

This resource exports the following attributes in addition to the arguments above:

* `application_integration_url` - The URL to use in SDK integrations with managed rule groups.
* `arn` - The ARN of the WAF WebACL.
* `capacity` - Web ACL capacity units (WCUs) currently being used by this web ACL.
* `id` - The ID of the WAF WebACL.
Expand Down

0 comments on commit 1859728

Please sign in to comment.