converge
converge copied to clipboard
ability to perform lookups on map fields
It would be useful to be able to perform a key based lookup
against a map-type field exposed on a resource. This would be necessary to effectively implement #253. It could also be useful when implementing additional detection options (see #504). For example, I had a situation where I would have liked to have been able to retrieve a particular ip address. Something like: network.interfaces.eth0.ipv4
[1] would have been really helpful.
[1] no idea if this syntax is feasible for a map lookup but hopefully it gets the idea across.
looks like it's close:
param versions {
default = {
terraform = "0.11.1"
}
}
file.fetch terraform {
source = "https://releases.hashicorp.com/terraform/{{paramMap `versions` | index `terraform`}}/terraform__{{platform.OS}}_amd64.zip"
destination = "{{param `bin`}}/terraform"
}
2017-12-21T19:37:57Z |ERROR| could not render component=rpc error=error rendering field source: template: source:1:65: executing "source" at <index `terraform`>: error calling index: cannot index slice/array with type map[string]interface {}: cannot execute template location=build.cvg runID=408f12f9-952f-4e29-b6c3-535588024222
2017-12-21T19:37:57Z |FATAL| could not get responses component=client error=error getting status response: rpc error: code = 2 desc = rendering build.cvg: error rendering field source: template: source:1:65: executing "source" at <index `terraform`>: error calling index: cannot index slice/array with type map[string]interface {}: cannot execute template file=build.cvg
it knows i want to index...