“aws_cloudformation_stack”的 Terraform 不受支持的块类型错误

Yas*_*shy 3 circleci terraform

我正在设置“部署到 AWS ECR/ECS(链接下方)”,然后我完成了 1-4。 https://circleci.com/docs/2.0/ecs-ecr/#section=deployment

$ terraform plan

Error: Unsupported block type

  on terraform.tf line 30, in resource "aws_cloudformation_stack" "vpc":
  30:   parameters {

Blocks of type "parameters" are not expected here. Did you mean to define
argument "parameters"? If so, use the equals sign to assign it a value.
Run Code Online (Sandbox Code Playgroud)

这是我的代码。

resource "aws_cloudformation_stack" "vpc" {
  name = "${local.aws_vpc_stack_name}"
  template_body = "${file("cloudformation-templates/public-vpc.yml")}"
  capabilities = ["CAPABILITY_NAMED_IAM"]
  parameters {
    ClusterName = "${local.aws_ecs_cluster_name}"
    ExecutionRoleName = "${local.aws_ecs_execution_role_name}"
  }
}
Run Code Online (Sandbox Code Playgroud)

我应该怎么做才能成功“地形计划”?谢谢,

Blo*_*je5 7

代替

parameters {
  ClusterName = "${local.aws_ecs_cluster_name}"
  ExecutionRoleName = "${local.aws_ecs_execution_role_name}"
}
Run Code Online (Sandbox Code Playgroud)

尝试

parameters = {
  ClusterName = "${local.aws_ecs_cluster_name}"
  ExecutionRoleName = "${local.aws_ecs_execution_role_name}"
}
Run Code Online (Sandbox Code Playgroud)

第一个被解释为一个块,第二个被解释为一个参数。因此错误。