From 636eac273c14f11264414b0d0a2c97ff5b6cb557 Mon Sep 17 00:00:00 2001 From: Jacopo Secchiero Date: Tue, 19 Sep 2017 16:56:50 +0200 Subject: [PATCH] Skip % when parsing OpenStack metadata (#78) --- resource.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/resource.go b/resource.go index 7b11c0a..d76dd90 100644 --- a/resource.go +++ b/resource.go @@ -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