Terraform ec2-instance模块资源'aws_instance.this'没有变量'aws_instance.this。*的属性”。

时间:2018-12-27 07:17:04

标签: terraform terraform-provider-aws

我正在尝试设置具有公共子网,2个私有子网和多个EC2实例的完整VPC。我将注册表模块用于所有内容(到目前为止,VPC,安全组和EC2实例)。 VPC module有效,但是EC2 module抛出标题中提到的错误。

这是我的VPC模块(变量在其他地方定义):

module "vpc" {
  source  = "terraform-aws-modules/vpc/aws"
  version = "1.49.0"

  name = "terraform-vpc"
  cidr = "${var.vpc_ip_range}"

  tags = {
    Name = "terraform-VPC",
  }

  enable_s3_endpoint       = false
  enable_dynamodb_endpoint = false
  enable_nat_gateway       = true

  azs                 = ["us-west-2a", "us-west-2b"]
  private_subnets     = ["${var.small_pvt_subnet}", "${var.large_pvt_subnet}"]
  public_subnets      = ["${var.pub_subnet}"]
  database_subnets    = ["${var.large_pvt_subnet}"]
  elasticache_subnets = ["${var.large_pvt_subnet}"]
}

这是我的ec2-instance模块:

module "DPM-instance" {
  source  = "terraform-aws-modules/ec2-instance/aws"
  version = "1.0.1"

  # insert the 4 required variables here
  name = "DPM"
  ami = <some AMI ID>
  instance_type = "t3.nano"
  vpc_security_group_ids = ["${module.DPM-security-group.this_security_group_id}"]
  tags = {
    Terraform = "true"
    Name = "DPM"
  }
}

我是Terraform的新手,所以我们将不胜感激。

0 个答案:

没有答案