"aws_cloudformation_stack"的 Terraform 不受支持的 block 类型错误

标签 terraform circleci

我正在设置“部署到 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.

这是我的代码。
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}"
  }
}

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

最佳答案

代替

parameters {
  ClusterName = "${local.aws_ecs_cluster_name}"
  ExecutionRoleName = "${local.aws_ecs_execution_role_name}"
}

尝试
parameters = {
  ClusterName = "${local.aws_ecs_cluster_name}"
  ExecutionRoleName = "${local.aws_ecs_execution_role_name}"
}

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

关于 "aws_cloudformation_stack"的 Terraform 不受支持的 block 类型错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56872826/

相关文章:

Azure Microsoft 监控代理无法使用 Terraform 进行预配

amazon-web-services - 用于更新现有启动模板的 Terraform 配置

amazon-web-services - 如何创建具有域加入和预安装应用程序的 Windows ec2 实例

java - 访问配置文件中的环境变量

amazon-web-services - 错误: Incorrect attribute value type - Terraform datasource(aws_ip_ranges)

google-cloud-platform - shell 脚本中的 Terraform 变量引用

android - 如何在 CircleCI 2.0 上正确运行 Android UI 测试?

automated-tests - 如何修复 CircleCI 中长时间运行的 testcafe 测试

android - CircleCI 将 Artifact 发布到云服务器?

bash - 由于未安装 "hstore"Postgres 扩展,CircleCI 测试失败