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

Map/List support for Consul_Keys #15356

Closed
cfromm1911 opened this issue Jun 21, 2017 · 7 comments
Closed

Map/List support for Consul_Keys #15356

cfromm1911 opened this issue Jun 21, 2017 · 7 comments

Comments

@cfromm1911
Copy link

cfromm1911 commented Jun 21, 2017

My project is a self-serve build/compile/deploy on immutable servers. In numerous places, I have a need for complex structures as variables, such as a structure to hold ip/port manifest for binding and security group creation. Maps/Lists (or nesting both) works fine as cli vars or tfvars, but Consul KV retrieved with data.consul_keys is all String. This is rough because I need Consul to carry my vars from other apps into TF.

Am I missing something? Is there some way to interpret KV as other than String?

If this needs to be a feature request, I believe there is a number of approaches. Interpreting Consul KV as other than string is one, such as storing HCL in Consul . It might be better to enhance the various interpolation functions to support accepting a single string input. For example, map function only works when supplied key/value, key/value, etc. However, the map function could accept a single string that includes a map structure. Same goes for List, etc. Or separate function that cast a string into map, list, etc assuming standard map/list/etc syntax. Or what about accepting HCL/JSON as input?

@Jamie-BitFlight
Copy link

You can store values to keys as json in consul (even using jsonencode in terraform).
And when you want to read the json from consul, you should be able to use a template to render it to a list or a map.

The variable structure:
https://www.terraform.io/intro/getting-started/variables.html

Details on jsonencoding, splitting, and joining, text into lists and maps.
https://www.terraform.io/docs/configuration/interpolation.html

@cfromm1911
Copy link
Author

Thanks. However, not really a solution. In a complicated app, using templates to jury rig every value is worse than rough. data.consul_keys.var should have the same capabilities as -var on CLI.

@danastasia
Copy link

I am dealing with this right now. I am trying to store a TF variable map that is a list of AWS Tags. I can get the JSON into Consul but can't read it back out

@apparentlymart
Copy link
Member

Hi everyone!

Please note that this issue has moved over to hashicorp/terraform-provider-consul#15 as part of splitting the Consul provider out into its own repository. Let's keep discussing this request over there, so that the discussion doesn't get lost.

@samtwilliams-emis
Copy link

I am dealing with this right now. I am trying to store a TF variable map that is a list of AWS Tags. I can get the JSON into Consul but can't read it back out

Hi did you ever find a solution to this?

@danastasia
Copy link

danastasia commented Mar 5, 2019 via email

@ghost
Copy link

ghost commented Mar 29, 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 Mar 29, 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

6 participants