我已经使用terraform提供的aws模块terraform-aws-modules/security-group/aws//modules/web.创建了一个aws安全组下面是使用的代码片段。资源已正确创建
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)
}发布于 2021-06-25 13:22:59
尝试此命令
区域terraform导入aws_ -var =us-east-1 -state-out=us-east-1-recover.terraform.tfstate module.app_security_group.web-server-sg sg-01c3b636f23c07ed0
还请注意,当您创建资源时,它应该已经添加到状态文件中
https://stackoverflow.com/questions/68057276
复制相似问题