Skip to content

Commit

Permalink
Add import support for aws_wafregional_web_acl_association resource (#…
Browse files Browse the repository at this point in the history
…10538)

Output from acceptance testing:

```
--- PASS: TestAccAWSWafRegionalWebAclAssociation_ResourceArn_ApiGatewayStage (44.37s)
--- PASS: TestAccAWSWafRegionalWebAclAssociation_disappears (185.89s)
--- PASS: TestAccAWSWafRegionalWebAclAssociation_basic (192.13s)
--- PASS: TestAccAWSWafRegionalWebAclAssociation_multipleAssociations (194.36s)
```
  • Loading branch information
DrFaust92 authored and bflad committed Nov 15, 2019
1 parent 43ae107 commit 39ec0b6
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
3 changes: 3 additions & 0 deletions aws/resource_aws_wafregional_web_acl_association.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ func resourceAwsWafRegionalWebAclAssociation() *schema.Resource {
Create: resourceAwsWafRegionalWebAclAssociationCreate,
Read: resourceAwsWafRegionalWebAclAssociationRead,
Delete: resourceAwsWafRegionalWebAclAssociationDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},

Schema: map[string]*schema.Schema{
"web_acl_id": {
Expand Down
23 changes: 21 additions & 2 deletions aws/resource_aws_wafregional_web_acl_association_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (
)

func TestAccAWSWafRegionalWebAclAssociation_basic(t *testing.T) {
resourceName := "aws_wafregional_web_acl_association.foo"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Expand All @@ -21,9 +23,14 @@ func TestAccAWSWafRegionalWebAclAssociation_basic(t *testing.T) {
{
Config: testAccCheckWafRegionalWebAclAssociationConfig_basic,
Check: resource.ComposeTestCheckFunc(
testAccCheckWafRegionalWebAclAssociationExists("aws_wafregional_web_acl_association.foo"),
testAccCheckWafRegionalWebAclAssociationExists(resourceName),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}
Expand All @@ -47,6 +54,8 @@ func TestAccAWSWafRegionalWebAclAssociation_disappears(t *testing.T) {
}

func TestAccAWSWafRegionalWebAclAssociation_multipleAssociations(t *testing.T) {
resourceName := "aws_wafregional_web_acl_association.foo"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Expand All @@ -55,10 +64,15 @@ func TestAccAWSWafRegionalWebAclAssociation_multipleAssociations(t *testing.T) {
{
Config: testAccCheckWafRegionalWebAclAssociationConfig_multipleAssociations,
Check: resource.ComposeTestCheckFunc(
testAccCheckWafRegionalWebAclAssociationExists("aws_wafregional_web_acl_association.foo"),
testAccCheckWafRegionalWebAclAssociationExists(resourceName),
testAccCheckWafRegionalWebAclAssociationExists("aws_wafregional_web_acl_association.bar"),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}
Expand All @@ -78,6 +92,11 @@ func TestAccAWSWafRegionalWebAclAssociation_ResourceArn_ApiGatewayStage(t *testi
testAccCheckWafRegionalWebAclAssociationExists(resourceName),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}
Expand Down
8 changes: 8 additions & 0 deletions website/docs/r/wafregional_web_acl_association.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,11 @@ The following arguments are supported:
In addition to all arguments above, the following attributes are exported:

* `id` - The ID of the association

## Import

WAF Regional Web ACL Association can be imported using their `web_acl_id:resource_arn`, e.g.

```
$ terraform import aws_wafregional_web_acl_association.foo web_acl_id:resource_arn
```

0 comments on commit 39ec0b6

Please sign in to comment.