List of maps in Terraform trouble

Hello all,

I am attempting to create iterable SGs in v12 and cannot get this list of maps to work in the tfvars file.

s_groups_dev = [
  name        = "kube_master"
  description = "desc"
  vpc_id      = "<vpc ID>"
  tags        =  merge( local.common_tags, { "Name" = "kube-master" }, )
  name        = "kube_master_instance_access_egress"
  description = "desc"
  vpc_id      = "<vpc ID>"
  tags        =  merge( local.common_tags, { "Name" = "kube_master_instance_access_egress" }, )

My error:

Error: Unsupported argument

  on line 1:
   1: s_groups_dev = [

An argument named "s_groups_dev" is not expected here.

I do have the var defined in the file

Hi @bennielamb,

The error message is reporting that your variable definition is in a file called, which from Terraform’s perspective is a configuration file as part of your current module. Based on what you’ve put in there, I think you intended this to be a Variable Definitions File, in which case the typical suffix for thise is .tfvars rather than .tf.

If you want Terraform to find and use the file automatically then you should give it a name ending in .auto.tfvars, such as Otherwise, you can pass a non-automatic variables file on the command line of terraform plan or terraform apply using the -var-file=FILENAME option.