-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
Support for nested maps in variables #2114
Comments
Interestingly, I can cheat a bit:
|
+1 |
1 similar comment
+1 |
+1, I didn't realize this was not possible. |
+1 |
2 similar comments
+1 |
+1 |
👍 really need to be able to pass data types other than strings in the DSL. |
+1 |
+1 really need this one |
+1 |
3 similar comments
+1 |
+1 |
+1 |
+1 |
1 similar comment
+1 |
Being able to have a list as a value would also be very nice |
+1 |
9 similar comments
👍 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
2 similar comments
+1 |
+1 |
+1 What are people doing to work around this? |
@tomstockton it's been two years, had to drop terraform originally and then brought it back in a lesser capacity |
Here is what I would do as an alternative for this map of map issue:
|
Here's what I did for multi-environment in one variables.tf file symlinked into each environment folder
and then call it like
|
+1 |
2 similar comments
+1 |
+1 |
I just verified that the example given in the original comment on this issue works in Terraform v0.12-alpha1: variable "amis" {
default = {
app1 = {
us-west-2 = "ami-abc123"
}
app2 = {
us-west-2 = "ami-cba321"
}
}
}
output "amis" {
value = var.amis
} In addition, Terraform v0.12 introduces the idea of object types which allow specification of variables that expect a specific set of attributes that may be of different types: variable "regions" {
type = map(map(object({
ami = string
})))
default = {
app1 = {
us-west-2 = {
ami = "ami-abc123"
}
}
app2 = {
us-west-2 = {
ami = "ami-cba321"
}
}
}
}
output "regions" {
value = var.regions
} Although there is still a remaining small issue to fix over in #19141, this feature request is now complete. Thanks for your patience, everyone! |
Due to limitations in terraform, we can't pass a nested map here so instead surface the root_device as a top-level interface, then set the map value internally. More info at hashicorp/terraform#2114 Fixes: openshift-metal3#8
Due to limitations in terraform, we can't pass a nested map here so instead surface the root_device as a top-level interface, then set the map value internally. More info at hashicorp/terraform#2114 Fixes: openshift-metal3#8
Due to limitations in terraform, we can't pass a nested map here so instead surface the root_device as a top-level interface, then set the map value internally. More info at hashicorp/terraform#2114 Fixes: openshift-metal3#8
* Handle properties * Expose root_device as a top-level parameter Due to limitations in terraform, we can't pass a nested map here so instead surface the root_device as a top-level interface, then set the map value internally. More info at hashicorp/terraform#2114 Fixes: #8
FYI: Terraform v0.12 will complain about the ' . ' in the subnet variables (e.g app.dev) with this error: |
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. |
I'd love to be able to do this:
Currently, you'd get an error like
Variable 'amis': must be string or mapping
The text was updated successfully, but these errors were encountered: