1
1
mirror of https://github.com/adammck/terraform-inventory synced 2024-11-22 15:52:01 +01:00

Support OTC metadata parsing (#141)

This commit is contained in:
Michael Hofer 2020-02-21 18:46:37 +01:00 committed by GitHub
parent 5618f546c1
commit c7e468f33c
Signed by: GitHub
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

@ -404,7 +404,8 @@ const exampleStateFile = `
"access_ip_v4": "10.0.0.19",
"access_ip_v6": "",
"tag.%": "1",
"tag.tfinventory": "rocks"
"tag.tfinventory": "rocks",
"metadata.superman": "clarkkent"
}
}
},
@ -548,7 +549,8 @@ const expectedListOutput = `
"status_superserver": ["10.120.0.226"],
"database": ["10.0.0.8"],
"scw_test": ["10.0.0.11"],
"tfinventory_rocks": ["10.0.0.19"]
"tfinventory_rocks": ["10.0.0.19"],
"superman_clarkkent": ["10.0.0.19"]
}
`
@ -694,6 +696,9 @@ olddatacenter="\u003c0.7_format"
[status_superserver]
10.120.0.226
[superman_clarkkent]
10.0.0.19
[ten]
10.0.0.10

@ -124,6 +124,10 @@ func (r Resource) Tags() map[string]string {
kk := strings.ToLower(parts[1])
vv := strings.ToLower(v)
t[kk] = vv
} else if len(parts) == 2 && parts[0] == "metadata" && parts[1] != "#" && parts[1] != "%" {
kk := strings.ToLower(parts[1])
vv := strings.ToLower(v)
t[kk] = vv
}
}
case "aws_instance", "linode_instance":