Skip to content

Argument names must not be quoted, but throws an error when unquoted #22095

@pgporada

Description

@pgporada

Terraform Version

$ terraform version
Terraform v0.12.4

Expected Behavior

I should be able to use the fixed tag ignoring functionality introduced by #21788 and this comment #21444 (comment)

Actual Behavior

resource "aws_vpc" "ct" {
  cidr_block                       = "${var.vpc_cidr_ipv4}"
  assign_generated_ipv6_cidr_block = "true"
  instance_tenancy                 = "default"
  enable_dns_support               = true
  enable_dns_hostnames             = true

  tags {
    Name       = "${var.infra_name}_${replace(var.region,"-","")}"
    TERRAFORM  = "true"
    INFRA_NAME = "${var.infra_name}"
    "kubernetes.io" = "unset"
  }

  lifecycle {
    create_before_destroy = true
    ignore_changes        = [
      tags["kubernetes.io"]
    ]
  }
}
On modules/vpc/vpc.tf line 12: Argument names must not be quoted.

Changing the resource to the following snippet where I unquote the kubernetes.io argument throws a different error.

resource "aws_vpc" "ct" {
  cidr_block                       = "${var.vpc_cidr_ipv4}"
  assign_generated_ipv6_cidr_block = "true"
  instance_tenancy                 = "default"
  enable_dns_support               = true
  enable_dns_hostnames             = true

  tags {
    Name       = "${var.infra_name}_${replace(var.region,"-","")}"
    TERRAFORM  = "true"
    INFRA_NAME = "${var.infra_name}"
    kubernetes.io = "unset"
  }

  lifecycle {
    create_before_destroy = true
    ignore_changes        = [
      tags["kubernetes.io"]
    ]
  }
}
Error: Argument or block definition required

On modules/vpc/vpc.tf line 12: An argument or block definition is required
here. To set an argument, use the equals sign "=" to introduce the argument
value.

I'm not sure how to proceed here.

Steps to Reproduce

Please list the full steps required to reproduce the issue, for example:

  1. terraform init
  2. terraform plan

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions