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

resouce/aws_waf_rule: add import ability #6247

Merged
merged 1 commit into from
Oct 25, 2018
Merged
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
3 changes: 3 additions & 0 deletions aws/resource_aws_waf_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ func resourceAwsWafRule() *schema.Resource {
Read: resourceAwsWafRuleRead,
Update: resourceAwsWafRuleUpdate,
Delete: resourceAwsWafRuleDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},

Schema: map[string]*schema.Schema{
"name": {
Expand Down
5 changes: 5 additions & 0 deletions aws/resource_aws_waf_rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ func TestAccAWSWafRule_basic(t *testing.T) {
"aws_waf_rule.wafrule", "metric_name", wafRuleName),
),
},
{
Copy link
Contributor

@bflad bflad Oct 25, 2018

Choose a reason for hiding this comment

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

Could you add this TestStep to all the resource acceptance tests? That helps us verify that all resource configurations are imported correctly. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually since most of the tests aren't verifying additional configurations other than TestAccAWSWafRule_geoMatchSetPredicate, we can probably just get this in as-is.

ResourceName: "aws_waf_rule.wafrule",
ImportState: true,
ImportStateVerify: true,
},
},
})
}
Expand Down
10 changes: 8 additions & 2 deletions website/docs/r/waf_rule.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,16 @@ See the [WAF Documentation](https://docs.aws.amazon.com/waf/latest/APIReference/
* `data_id` - (Required) A unique identifier for a predicate in the rule, such as Byte Match Set ID or IPSet ID.
* `type` - (Required) The type of predicate in a rule. Valid values: `ByteMatch`, `GeoMatch`, `IPMatch`, `RegexMatch`, `SizeConstraint`, `SqlInjectionMatch`, or `XssMatch`.

## Remarks

## Attributes Reference

In addition to all arguments above, the following attributes are exported:

* `id` - The ID of the WAF rule.

## Import

WAF rules can be imported using the id, e.g.

```
$ terraform import aws_waf_rule.example a1b2c3d4-d5f6-7777-8888-9999aaaabbbbcccc
```