Json syntax for ignore_changes tags

say I have this config in hcl format

resource "aws_alb" "lb1" {
  name                            = "some_lb"
  load_balancer_type              = "application"
  lifecycle {
    ignore_changes                = [tags["Env"],name,tags["Name"]]
  }

what’s the json syntax equivalent for the ignore_changes on specific tags?

{
  "resource": {
    "aws_alb": {
      "lb1": {
        "lifecycle": {
          "ignore_changes": [ "tags"  ]
        },

Hi @aloftaizzz,

In general, the elements of the array representing ignore_changes in JSON should contain strings where each one contains the same syntax that you’d use in an element of ignore_changes in the normal syntax.

In this particular case there’s the extra challenge that the normal syntax itself includes quotes, which are also special characters in JSON strings. To make sure that the given expression is both valid JSON and a valid attribute specification, you should use JSON escaping to make sure that the quotes are taken literally:

  "ignore_changes": ["tags[\"Env\"]", "name", "tags[\"Name\"]"]

If you are generating your JSON programmatically using a JSON library in some other programming language (strongly recommended) then the JSON library should handle this escaping for you automatically, so you will not need to do it manually.