Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Terraform | 0.12.2 | Upgrade issues

Tags:

terraform

I am getting below error while executing terraform init command after upgrading to 0.12.2 version. Earlier same code was working fine without issues in terraform 0.11.10 version.

alb.tf

tags {
    Name             = "${var.name}"
    Environment      = "${lookup(var.environment, terraform.workspace)}"
  }

lc.tf:-

  vars {
EFS_ENDPOINT = "${aws_efs_file_system.jenkins.dns_name}"

}

remote_state.tf line 4

config {
    bucket      =   "s3-terraform-state"
    key         =   "env:/${lookup(var.environment, terraform.workspace)}/cicd-security-groups/terraform.tfstate"
    region      =   "${var.region}"
  }

remote_state.tf line 14

config {
    bucket      =   "ttgsl-s3-terraform-state"
    key         =   "env:/${lookup(var.environment, terraform.workspace)}/cicd-kms-ebs/terraform.tfstate"
    region      =   "${var.region}"
  }

terraform validate -no-color

Error: Unsupported block type

  on alb.tf line 40, in resource "aws_lb_target_group" "jenkins_master":
  40:   tags {

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.


Error: Unsupported block type

  on lc.tf line 4, in data "template_file" "jenkins_user_data_template":
   4:   vars {

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


Error: Unsupported block type

  on remote_state.tf line 4, in data "terraform_remote_state" "remote-cicd-security-groups_state":
   4:   config {

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


Error: Unsupported block type

  on remote_state.tf line 14, in data "terraform_remote_state" "remote-cicd-kms-ebs_state":
  14:   config {

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

make: *** [validate] Error 1
like image 453
asur Avatar asked Jun 21 '19 14:06

asur


People also ask

What are the issues with Terraform?

There are four potential types of issues that you could experience with Terraform: language, state, core, and provider errors. Starting from the type of error closest to the user: Language errors: The primary interface for Terraform is the HashiCorp Configuration Language (HCL), a declarative configuration language.

What is better than Terraform?

The following is a list of 10 IT automation software solution alternatives to Terraform, including Ansible, Attune, Kubernetes, Jenkins, Chef, Puppet, BMC Control M, SaltStack, Vagrant, and Pulumi.

Is Terraform good?

Terraform is probably the most used tool to deploy cloud services. It's a fantastic tool, easily usable, with descriptive language (DSL) called HCL, team-oriented, supporting tons of cloud providers, etc.


1 Answers

tags = {
    Name             = "${var.name}"
    Environment      = "${lookup(var.environment, terraform.workspace)}"
  }

vars = {
    EFS_ENDPOINT = "${aws_efs_file_system.jenkins.dns_name}"
}

We need to add = after tags, vars as well for config to avoid the errors.

like image 163
asur Avatar answered Sep 27 '22 19:09

asur