使用Terraform创建AWS-OPSWORK-stack时会出现错误



在用Terraform创建堆栈的同时,在ia下方遇到此错误

错误:错误加载/root/terraform-stack-creation/main.tf:位置2:10:必须恰好是两个字符串,类型和名称

之后的资源
resource "aws_opsworks_stack" "stack" {
  name = "${var.name}"
  region = "${var.region}"
  service_role_arn = "${var.service_role_arn}"
  default_instance_profile_arn = "${var.instance_profile_arn}"
  default_os = "Amazon Linux 2018.03"
  configuration_manager_version = "11.10"
  manage_berkshelf = false
  default_root_device_type = "ebs"
  use_opsworks_security_groups = false
  vpc_id = "vpc-******************"
  default_subnet_id = "subnet-*****************"
  custom_json = "{}"
}
variable "name" {
    type = "string"
    description = "Name (Your required stack name)"
    }
variable "region" {
    type = list(string)
    default = ["us-west-1a"]
    description = "us-east-1,ap-south-1,ap-southeast-2,eu-central-1 (Give your region)"
    }
variable "service_role_arn" {
    type = list(string)
    default = ["*********************"]
    description = "Default IAM role"
    }
variable "default_instance_profile_arn"{
    type = list(string)
    default = ["*************************"]
    description = "Default IAM instance profile"
    }
variable "default_availability_zone" {
    type = "string"
    description = "Give your availabity zone"
    }

变量name未设置为任何东西。

您需要:

a(为name

设置默认值

b(通过环境变量,命令行,TF_INPUT=false-input=false或其他方法设置name变量

相关内容

  • 没有找到相关文章

最新更新