mumoshu / variant2

Turn your bash scripts into a modern, single-executable CLI app today
MIT License
141 stars 11 forks source link

Config Deep Merging Ignores Null Values #33

Closed osterman closed 3 years ago

osterman commented 3 years ago

what

expectation

If we merge this map:

terraform:
  backend:
    s3:
      encrypt: true
      key: "terraform.tfstate"
      acl: "bucket-owner-full-control"
      region: "us-east-2"

with this map:

terraform:
  backend:
    s3:
      region: null

we should get

terraform:
  backend:
    s3:
      encrypt: true
      key: "terraform.tfstate"
      acl: "bucket-owner-full-control"
      region: null

using the following job:

job "echo" {
  option "message" {
    type = string
    default = "Hello world!"
  }
  config "test" {
    source file {
      path = "c1.yaml"
    }
    source file {
      path = "c2.yaml"
    }
  }

  exec {
    command = "echo"
    args = [ yamlencode(conf.test) ]
  }
}

but what we actually get is:

"terraform":
  "backend":
    "s3":
      "acl": "bucket-owner-full-control"
      "encrypt": true
      "key": "terraform.tfstate"
      "region": "us-east-2"