hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.82k stars 9.16k forks source link

[Docs]: Docs for importing web_acl are incorrect #26938

Closed tolidano closed 2 years ago

tolidano commented 2 years ago

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

github-actions[bot] commented 2 years ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

scottwestover commented 2 years ago

@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.

Screen Shot 2022-09-29 at 7 14 12 PM

From the docs here: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/wafv2_web_acl#import

justinretzolk commented 2 years ago

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!

github-actions[bot] commented 1 year ago

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.