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:
parent
c23c86aa4b
commit
636eac273c
@ -121,7 +121,10 @@ func (r Resource) Tags() map[string]string {
|
|||||||
case "openstack_compute_instance_v2":
|
case "openstack_compute_instance_v2":
|
||||||
for k, v := range r.Attributes() {
|
for k, v := range r.Attributes() {
|
||||||
parts := strings.SplitN(k, ".", 2)
|
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])
|
kk := strings.ToLower(parts[1])
|
||||||
vv := strings.ToLower(v)
|
vv := strings.ToLower(v)
|
||||||
t[kk] = vv
|
t[kk] = vv
|
||||||
|
Loading…
Reference in New Issue
Block a user