cloud-custodian / cloud-custodian/tfparse

Missing resource while parsing

Open
#256 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
57
Forks
19
Avg merge
2h 1m
Merged PRs (30d)
1

Description

The following terraform file results in a missing `panos_address` block when parsed. I have narrowed down the problem to have something to do with the `panos_administrative_tag.main["github"].name` references in the `tomap` block. The resource block appears while parsed when I replace the name reference with a string. I have other working blocks where the names of a resource is used successfully, so it doesn't 100% make sense to me why this one would be an issue.

```terraform
resource "panos_administrative_tag" "main" {
location = { device_group = { name = "TestDeviceGroup" } }
for_each = toset(["source1", "source2"])

name = each.key
}

resource "panos_address" "main" {
location = { device_group = { name = "TestDeviceGroup" } }
for_each = tomap({
"abc01" = { ip_netmask = "15.10.1.123", tags = [panos_administrative_tag.main["source1"].name] }
"abc02" = { ip_netmask = "15.10.1.124", tags = [panos_administrative_tag.main["source1"].name] }
"abc05" = { ip_netmask = "15.20.2.56", tags = [panos_administrative_tag.main["source2"].name] }
})

name = each.key
ip_netmask = lookup(each.value, "ip_netmask", null)
tags = lookup(each.value, "tags", null)
}
```

Edit: I just found out that it is alphabetically related. If I were to change the 2nd resource to `zpanos_address`, everything would be parsed correctly and the tags would correctly be the referenced tag name.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.