terraform-provider-aws
terraform-provider-aws copied to clipboard
[Docs]: Docs for importing web_acl are incorrect
Documentation Link
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/waf_web_acl
Description
It says:
WAF Web ACL can be imported using the id, e.g.,
$ terraform import aws_waf_web_acl.main 0c8e583e-18f3-4c13-9e2a-67c4805d2f94
But this is not true:
> terraform import module.cm15.aws_wafv2_web_acl.this a5208dce-5a45-49ce-bfe4-dcbe66ee953a
module.cm15.aws_wafv2_web_acl.this: Importing from ID "a5208dce-5a45-49ce-bfe4-dcbe66ee953a"...
Error: Unexpected format of ID ("a5208dce-5a45-49ce-bfe4-dcbe66ee953a"), expected ID/NAME/SCOPE
The correct declaration is:
> terraform import module.cm15.aws_wafv2_web_acl.this a5208dce-5a45-49ce-bfe4-dcbe66ee953a/dev-cm15-waf/REGIONAL
module.cm15.aws_wafv2_web_acl.this: Importing from ID "a5208dce-5a45-49ce-bfe4-dcbe66ee953a/dev-cm15-waf/REGIONAL"...
module.cm15.aws_wafv2_web_acl.this: Import prepared!
Prepared aws_wafv2_web_acl for import
module.cm15.aws_wafv2_web_acl.this: Refreshing state... [id=a5208dce-5a45-49ce-bfe4-dcbe66ee953a]
Import successful!
The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.
Note that it must include the name and the scope (being CLOUDFRONT or REGIONAL)
References
No response
Would you like to implement a fix?
No
Community Note
Voting for Prioritization
- Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
- Please see our prioritization guide for information on how we prioritize.
- Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
Volunteering to Work on This Issue
- If you are interested in working on this issue, please leave a comment.
- If this would be your first contribution, please review the contribution guide.
@tolidano From the example you provided, it looks like you are using the aws_wafv2_web_acl
resource, but you shared a link to the waf_web_acl
resource. The waf_web_acl
resource does support just providing the id
when you import the resource, but the aws_wafv2_web_acl
resource expects the full ID/Name/Scope
string when you do the import.

From the docs here: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/wafv2_web_acl#import
Hey @tolidano 👋 Thank you for taking the time to raise this! As mentioned above, it looks like this is a difference in importing the aws_waf_web_acl
resource vs. the aws_wafv2_web_acl
resource.
Given that's the case, we'll close this issue for now. Please do let me know if you feel I've done this in error, and thank you again for taking the time to raise this, regardless of the outcome!
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.