简体   繁体   English

如何将现有的 AWS WAF ACL 导入 terraform?

[英]How to import an existing AWS WAF ACL into terraform?

I am trying to import a few AWS WAF ACLs into an existing terraform deployment.我正在尝试将一些 AWS WAF ACL 导入现有的 terraform 部署。 I have tried both variations of the code.我已经尝试了代码的两种变体。

#version 1:

resource "aws_waf_web_acl" "mywaf" {
  # (resource arguments)
}

$ terraform import aws_waf_web_acl.mywaf id-xxxx-xxx

Error: aws_waf_web_acl.mywaf (import id: xxxx-xxx): 1 error(s) occurred Terraform detected a resource with this ID doesn't exist.错误:aws_waf_web_acl.mywaf(导入 ID:xxxx-xxx):发生 1 个错误 Terraform 检测到具有此 ID 的资源不存在。 Please verify the ID is correct.请验证 ID 是否正确。

#version 2:

resource "aws_wafregional_web_acl" "mywaf" {
  # (resource arguments)
}

$ terraform import aws_wafregional_web_acl.mywaf id-xxxx-xxx

Error: aws_wafregional_web_acl doesn't support import错误:aws_wafregional_web_acl 不支持导入

I have verified that the ID is correct.我已经验证了 ID 是正确的。 Is this possible with AWS provider 1.45? AWS 供应商 1.45 可以做到这一点吗? Thanks.谢谢。

Seems the id is wrong.好像id不对

From the sample样本

terraform import aws_waf_web_acl.main 0c8e583e-18f3-4c13-9e2a-67c4805d2f94

it is uuid, not id-xxx它是 uuid,而不是id-xxx

And for second resource, it clearly claims that this resource doesn't support import feature currently对于第二个资源,它明确声称该资源目前不支持导入功能

reference: https://www.terraform.io/docs/providers/aws/r/wafregional_web_acl.html参考: https : //www.terraform.io/docs/providers/aws/r/wafregional_web_acl.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM