diff --git a/aws/resource_aws_waf_rule.go b/aws/resource_aws_waf_rule.go index f210138e1f4..cd22babb94e 100644 --- a/aws/resource_aws_waf_rule.go +++ b/aws/resource_aws_waf_rule.go @@ -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": { diff --git a/aws/resource_aws_waf_rule_test.go b/aws/resource_aws_waf_rule_test.go index 25153bcdd7e..290c7b1bcc7 100644 --- a/aws/resource_aws_waf_rule_test.go +++ b/aws/resource_aws_waf_rule_test.go @@ -34,6 +34,11 @@ func TestAccAWSWafRule_basic(t *testing.T) { "aws_waf_rule.wafrule", "metric_name", wafRuleName), ), }, + { + ResourceName: "aws_waf_rule.wafrule", + ImportState: true, + ImportStateVerify: true, + }, }, }) } diff --git a/website/docs/r/waf_rule.html.markdown b/website/docs/r/waf_rule.html.markdown index d352b8e0023..f81edfe0456 100644 --- a/website/docs/r/waf_rule.html.markdown +++ b/website/docs/r/waf_rule.html.markdown @@ -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 +```