![](/img/trans.png)
[英]What's the difference between cluster_primary_security_group_id and cluster_security_group_id in terraform-aws-modules/eks/aws?
[英]Terraform Import aws security group resources created using terraform-aws-modules/security-group/aws//modules/web
我使用 terraform 提供的 aws 模塊創建了一個 aws 安全組,該模塊為 terraform-aws-modules/security-group/aws//modules/web。 下面是使用的代碼片段。 資源創建正確
module "app_security_group" {
source = "terraform-aws-modules/security-group/aws//modules/web"
version = "3.17.0"
name = "web-server-sg"
description = "Security group for web-servers with HTTP ports open within VPC"
vpc_id = module.vpc.vpc_id
ingress_cidr_blocks = module.vpc.public_subnets_cidr_blocks
}
但無法使用以下命令導入
terraform import -var aws_region=us-east-1 -state-out=us-east-1-recover.terraform.tfstate module.app_security_group.aws_security_group.web-server-sg sg-01c3b636f23c07ed0
出錯
Error: resource address "module.app_security_group.aws_security_group.this" does not exist in the configuration.
Before importing this resource, please create its configuration in module.app_security_group. For example:
resource "aws_security_group" "web-server-sg" {
# (resource arguments)
}
試試這個命令
terraform import -var aws_region=us-east-1 -state-out=us-east-1-
module.app_security_group.web-server-sg
sg-01c3b636f23c07ed0
另請注意,當您創建資源時,它應該已經添加到狀態文件中
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.