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

[feature request] show minimal diff in the value when using consul_key_prefix #330

Open
shantanugadgil opened this issue Jan 17, 2023 · 3 comments
Milestone

Comments

@shantanugadgil
Copy link

Terraform Version

1.3.7

Affected Resource(s)

Please list the resources as a list, for example:

  • consul_key_prefix

Terraform Configuration Files

resource "consul_key_prefix" "myconfig" {
  path_prefix = "myconfig/something/"

  subkey {
    path = "charlie.yaml"
    value = file("${path.module}/charlie.yaml")
  }

  subkey {
    path = "alpha.json"
    value = file("${path.module}/alpha.json")
  }

  subkey {
    path = "bravo.yml"
    value = file("${path.module}/bravo.yml")
  }
}

Debug Output

N/A

Panic Output

N/A

Expected Behavior

When I change a single line in the YAML (or JSON) file which I PUT into Consul, I wish to see the diff of the changed content.

Actual Behavior

Currently the entire key is shown as "older removed" and "newer added".

Here, I have made a single line change in the file charlie.yaml

  # consul_key_prefix.myconfig  will be updated in-place
  ~ resource "consul_key_prefix" "myconfig" {
        id          = "myconfig/something/"
        # (3 unchanged attributes hidden)

      - subkey {
          - flags = 0 -> null
          - path  = "charlie.yaml" -> null
          - value = <<-EOT
                ---
                aaa: 'aaa'
                bbb: 'bbb'
            EOT -> null
        }
      + subkey {
          + flags = 0
          + path  = "charlie.yaml"
          + value = <<-EOT
                ---
                aaa: 'aaa'
            EOT
        }

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:
(use appropriate consul provider block)

  • terraform init -upgrade
  • terraform apply

Important Factoids

nothing special, should be reproducible using consul agent -dev

References

N/A

@remilapeyre remilapeyre added this to the next milestone Feb 20, 2023
@remilapeyre
Copy link
Collaborator

Hello @shantanugadgil, I wanted to let you know that I have been trying to implement this and have mad esome experiments and I'm not sure it is possible to do this currently in Terraform. I will make more tests to understand what would need to be changed to have a better diff.

@shantanugadgil
Copy link
Author

Hello @shantanugadgil, I wanted to let you know that I have been trying to implement this and have mad esome experiments and I'm not sure it is possible to do this currently in Terraform. I will make more tests to understand what would need to be changed to have a better diff.

This is good to know indeed!!!

@shantanugadgil
Copy link
Author

hi @remilapeyre wondering if you were able to make any progress on this? if you have any test builds I can test it out

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

No branches or pull requests

2 participants