mirror of
https://github.com/adammck/terraform-inventory
synced 2024-11-22 20:01:58 +01:00
OpenStack instance tag support (#150)
This commit is contained in:
parent
776a67e21e
commit
fb172e7b70
@ -185,6 +185,8 @@ const exampleStateFile = `
|
|||||||
"id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
|
"id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
|
||||||
"access_ip_v4": "10.120.0.226",
|
"access_ip_v4": "10.120.0.226",
|
||||||
"access_ip_v6": "",
|
"access_ip_v6": "",
|
||||||
|
"tag.%": "1",
|
||||||
|
"tag.ostags": "rock",
|
||||||
"metadata.status": "superServer",
|
"metadata.status": "superServer",
|
||||||
"metadata.#": "very bad",
|
"metadata.#": "very bad",
|
||||||
"metadata_toes": "faada2142412jhb1j2"
|
"metadata_toes": "faada2142412jhb1j2"
|
||||||
@ -560,6 +562,7 @@ const expectedListOutput = `
|
|||||||
"webserver": ["192.168.0.3"],
|
"webserver": ["192.168.0.3"],
|
||||||
"staging": ["192.168.0.3"],
|
"staging": ["192.168.0.3"],
|
||||||
"status_superserver": ["10.120.0.226"],
|
"status_superserver": ["10.120.0.226"],
|
||||||
|
"ostags_rock": ["10.120.0.226"],
|
||||||
"database": ["10.0.0.8"],
|
"database": ["10.0.0.8"],
|
||||||
"scw_test": ["10.0.0.11"],
|
"scw_test": ["10.0.0.11"],
|
||||||
"tfinventory_rocks": ["10.0.0.19"],
|
"tfinventory_rocks": ["10.0.0.19"],
|
||||||
@ -668,6 +671,9 @@ olddatacenter="\u003c0.7_format"
|
|||||||
[one_1]
|
[one_1]
|
||||||
10.0.1.1
|
10.0.1.1
|
||||||
|
|
||||||
|
[ostags_rock]
|
||||||
|
10.120.0.226
|
||||||
|
|
||||||
[role_nine]
|
[role_nine]
|
||||||
10.0.0.9
|
10.0.0.9
|
||||||
|
|
||||||
|
@ -122,7 +122,11 @@ func (r Resource) Tags() map[string]string {
|
|||||||
// At some point Terraform changed the key for counts of attributes to end with ".%"
|
// 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
|
// instead of ".#". Both need to be considered as Terraform still supports state
|
||||||
// files using the old format.
|
// files using the old format.
|
||||||
if len(parts) == 2 && parts[0] == "metadata" && parts[1] != "#" && parts[1] != "%" {
|
if len(parts) == 2 && parts[0] == "tag" && parts[1] != "#" && parts[1] != "%" {
|
||||||
|
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])
|
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