Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Terraform Unsupported block type error for "aws_cloudformation_stack"

I'm setting "Deploying to AWS ECR/ECS(below link)",and I finish 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.

This is my code.

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}"
  }
}

What should I do to successfully "terraform plan" ? Thanks,

like image 476
Yashy Avatar asked Oct 28 '25 16:10

Yashy


1 Answers

Instead of

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

try

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

The first is interpreted as a block, the second as an argument. Hence the error.

like image 52
Blokje5 Avatar answered Oct 31 '25 10:10

Blokje5



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!