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

provider/consul: consul_key_prefix.subkeys improperly handles keys containing '.' #6471

Closed
gechr opened this issue May 4, 2016 · 6 comments

Comments

@gechr
Copy link
Contributor

gechr commented May 4, 2016

Terraform Version

Terraform v0.6.15

Affected Resource(s)

  • consul_key_prefix

Terraform Configuration Files

resource "consul_key_prefix" "bug" {
  datacenter  = "eu"
  token       = "dummy-token-abcdef"
  path_prefix = "test/prefix/"

  subkeys = {
    "this/is.a.test" = "foobar"
    "this/is/a/test" = "foobar"
    "this-is-a/test" = "foobar"
    "this-is-a-test" = "foobar"
  }
}

Expected Behavior

+ consul_key_prefix.bug
    datacenter:             "" => "eu"
    path_prefix:            "" => "test/prefix/"
    subkeys.#:              "" => "4"
    subkeys.this-is-a-test: "" => "foobar"
    subkeys.this-is-a/test: "" => "foobar"
    subkeys.this/is.a.test: "" => "foobar"
    subkeys.this/is/a/test: "" => "foobar"
    token:                  "" => "dummy-token-abcdef"

Actual Behavior

+ consul_key_prefix.bug
    datacenter:             "" => "eu"
    path_prefix:            "" => "test/prefix/"
    subkeys.#:              "" => "4"
    subkeys.this-is-a-test: "" => "foobar"
    subkeys.this-is-a/test: "" => "foobar"
    subkeys.this/is.a.test: "" => ""
    subkeys.this/is/a/test: "" => "foobar"
    token:                  "" => "dummy-token-abcdef"

Steps to Reproduce

  1. Specify resource consul_key_prefix with subkeys key containing a . character
  2. Run terraform plan or terraform apply
@gechr
Copy link
Contributor Author

gechr commented May 4, 2016

Ping @apparentlymart

@radeksimko
Copy link
Member

radeksimko commented May 4, 2016

This is caused by a known core bug: #2143

@apparentlymart
Copy link
Contributor

apparentlymart commented May 4, 2016

Yah, unfortunately this (maps with keys that have periods) is just something Terraform can't do for any provider right now... If the core were fixed I expect this would just start working.

In the mean time all I can suggest is to choose Consul key names that don't contain periods. Sorry :(

@radeksimko
Copy link
Member

The way we worked around this in some API Gateway resources recently was to add a field field_in_json, which was effectively (un)marshalled under the hood as map (I know, 🐽 yucky, isn't it).

I think that such workarounds should be limited to cases where map keys are not fully in user's control (i.e. keys are prescribed by the API) and also such workarounds will be deprecated once we get the core bug fixed.

@stack72
Copy link
Contributor

stack72 commented Jul 26, 2016

Hi @gechr

I believe this is fixed via #2143 :) This will be part of the upcoming 0.7 release so please do let us know if this isn't the case :)

Paul

@stack72 stack72 closed this as completed Jul 26, 2016
@ghost
Copy link

ghost commented Apr 24, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants