mirror of
https://github.com/adammck/terraform-inventory
synced 2024-11-22 15:52:01 +01:00
Stop creating groups for tfstate attribute counts (#47)
The count attribute key in state files has changed from # to %
This commit is contained in:
parent
cf2e5a91a3
commit
6f4c1a9983
@ -44,7 +44,7 @@ const exampleStateFile = `
|
||||
"attributes": {
|
||||
"id": "i-aaaaaaaa",
|
||||
"private_ip": "10.0.0.1",
|
||||
"tags.#": "1",
|
||||
"tags.%": "1",
|
||||
"tags.Role": "Web"
|
||||
}
|
||||
}
|
||||
|
@ -118,7 +118,10 @@ func (r Resource) Tags() map[string]string {
|
||||
case "aws_instance":
|
||||
for k, v := range r.Attributes() {
|
||||
parts := strings.SplitN(k, ".", 2)
|
||||
if len(parts) == 2 && parts[0] == "tags" && 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] == "tags" && parts[1] != "#" && parts[1] != "%" {
|
||||
kk := strings.ToLower(parts[1])
|
||||
vv := strings.ToLower(v)
|
||||
t[kk] = vv
|
||||
|
Loading…
Reference in New Issue
Block a user