Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config Deep Merging Ignores Null Values #33

Closed
osterman opened this issue Sep 30, 2020 · 0 comments · Fixed by #34
Closed

Config Deep Merging Ignores Null Values #33

osterman opened this issue Sep 30, 2020 · 0 comments · Fixed by #34

Comments

@osterman
Copy link

osterman commented Sep 30, 2020

what

  • We are trying to merge to maps using the config {...} construct
  • The deep merging works perfectly with every value other than null
  • With null the value is just ignored

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"
mumoshu added a commit that referenced this issue Oct 5, 2020
Upgrades mergo to the version that has support for the WithOverwriteWithEmptyValue option that enables merging non-empty values in the destination config with empty values from the source config.

Fixes #33
mumoshu added a commit that referenced this issue Oct 5, 2020
Upgrades mergo to the version that has support for the WithOverwriteWithEmptyValue option that enables merging non-empty values in the destination config with empty values from the source config.

Fixes #33
mumoshu added a commit that referenced this issue Oct 5, 2020
Upgrades mergo to the version that has support for the WithOverwriteWithEmptyValue option that enables merging non-empty values in the destination config with empty values from the source config.

Fixes #33
mumoshu added a commit that referenced this issue Oct 5, 2020
Upgrades mergo to the version that has support for the WithOverwriteWithEmptyValue option that enables merging non-empty values in the destination config with empty values from the source config.

Fixes #33
mumoshu added a commit that referenced this issue Oct 5, 2020
Upgrades mergo to the version that has support for the WithOverwriteWithEmptyValue option that enables merging non-empty values in the destination config with empty values from the source config.

Fixes #33
mumoshu added a commit that referenced this issue Oct 5, 2020
Upgrades mergo to the version that has support for the WithOverwriteWithEmptyValue option that enables merging non-empty values in the destination config with empty values from the source config.

Fixes #33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant