1
1
mirror of https://github.com/adammck/terraform-inventory synced 2024-11-26 07:43:46 +01:00

Skip % when parsing OpenStack metadata (#78)

This commit is contained in:
Jacopo Secchiero 2017-09-19 16:56:50 +02:00 committed by Adam Mckaig
parent c23c86aa4b
commit 636eac273c

@ -121,7 +121,10 @@ func (r Resource) Tags() map[string]string {
case "openstack_compute_instance_v2":
for k, v := range r.Attributes() {
parts := strings.SplitN(k, ".", 2)
if len(parts) == 2 && parts[0] == "metadata" && parts[1] != "#" {
// At some point Terraform changed the key for counts of attributes to end with ".%"
// instead of ".#". Both need to be considered as Terraform still supports state
// files using the old format.
if len(parts) == 2 && parts[0] == "metadata" && parts[1] != "#" && parts[1] != "%" {
kk := strings.ToLower(parts[1])
vv := strings.ToLower(v)
t[kk] = vv