terramate icon indicating copy to clipboard operation
terramate copied to clipboard

[BUG] Labeled globals does not support quoted strings

Open donovanrost opened this issue 5 months ago • 5 comments

Describe the bug For resource tagging, we use a format like subdomain.company.com/key = value. At the top level stack we define:

globals {
  default_tags = {
      "meta.company.com/manager" = "terraform"
      "terramate.company.com/stack" = terramate.stack.id
  }

This works.

In a child stack, we would like add additional default_tags where the tags can follow the same format.

If I add

globals "default_tags" {
  test = "tag"
}

and run terramate debug show globals I will see the expected merged default_tags

default_tags = { "meta.company.com/manager" = "terraform" "terramate.company.com/stack" = "885edb70-3210-4680-b8d2-0145b493a710" test = "tag" }

If I wrap test in quotes like "test", I'm given the following error

/root/projects/rewrite-exploration/stacks/_devops_development/us-gov-east-1/stack.tm.hcl:20,3-4: HCL syntax error: loading from /root/projects/rewrite-exploration/stacks: loading from /root/projects/rewrite-exploration/stacks/<account_name>_devops_development: loading from /root/projects/rewrite-exploration/stacks/<account_name>_devops_development/us-gov-east-1: Argument names must not be quoted.

In this simple example, it of course is not necessary to wrap test in quotes. However, if the tag key is more complex like meta.company.com/example then I get

An argument or block definition is required here. To set an argument, use the equals sign "=" to introduce the argument value.

So quotes are necessary

Environment (please complete the following information):

  • OS: Linux
  • OS Version Ubuntu 20.04
  • Git Version 2.34.1
  • Terramate Version: 0.10.2

Additional context Add any other context about the problem here.

donovanrost avatar Aug 31 '24 21:08 donovanrost