1
votes

I'm trying migrate my terraform plan from v0.11 to v0.12 terraform version and when I execute the validation I have some error with the same error : "Unsupported block type" and the service mark the trouble into the "TAGS" tag with that comment:

Blocks of type "tags" are not expected here. Did you mean to define argument "tags"? If so, use the equals sign to assign it a value.

One example it's this troubling resource:

resource "aws_vpc" "VPC" {
  cidr_block           = "10.0.0.0/24"
  enable_dns_hostnames = "true"
  enable_dns_support   = "true"

  tags {
    Name        = "${var.name}-VPC-Default"
    Environment = var.env
    Region      = var.region
  }
}

I read into the documentation about this resource that support tag type "TAGS" and into the v0.11 version it's working fine.

Any suggestion about what it's my problem?

1

1 Answers

2
votes

The error is explaining that in Terraform 0.12 tags are no longer a block, but rather now an argument. A block in Terraform appears like:

block { ... }

which is how your tags currently appear. An argument appears like:

argument = value

Therefore, you need to convert your tags from a block to an argument. That can be done like the following:

tags = {
  Name        = "${var.name}-VPC-Default"
  Environment = var.env
  Region      = var.region
}

where tags is now being assigned the map value you formerly contained within your block.