Open kapilt opened 1 year ago
from tfdump it looks like the backend subnet is an unknown cty ref.
I think we have the same root issue when multiple variable references appear in an interpolated string:
variable "subscription_id" {
type = string
default = "00000000-0000-0000-0000-000000000000"
}
resource "azurerm_resource_group" "example" {
name = "example"
location = "West Europe"
}
resource "azurerm_storage_account" "example" {
name = "example"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
account_tier = "Standard"
account_replication_type = "GRS"
}
output "interpolated_id" {
value = "/subscriptions/${var.subscription_id}/resourceGroups/${azurerm_resource_group.example.name}/providers/Microsoft.Storage/storageAccounts/${azurerm_storage_account.example.name}"
}
The interpolated_id
output shows up like this in a dump (where "__ref__": "fb0d7911-9474-4667-acff-b0e640c010c6"
points to the resource group):
"output": [
{
"__tfmeta": {
"filename": "main.tf",
"label": "interpolated_id",
"line_end": 21,
"line_start": 19,
"path": "output.interpolated_id"
},
"id": "2037ef97-ad12-42c7-a303-26025c49fbc8",
"value": {
"__attributes__": [
"var.subscription_id",
"azurerm_resource_group.example.name",
"azurerm_storage_account.example.name"
],
"__name__": "example",
"__ref__": "fb0d7911-9474-4667-acff-b0e640c010c6",
"__type__": "azurerm_resource_group"
}
}
]
"What do we expect to see in the resource graph?" is a fair question. Given a module like the following...
Here's what the c7n-left dump
output looks like today:
We could pluralize __name__
/__ref__
/__type__
whenever we pluralize __attribute__
...
Or perhaps tuck always-singular reference structures inside a top-level key like __refs__
?
From an aesthetic/consistency perspective I like the idea of having an array of refs, but I'm not sure what makes the most sense from the implementation side and downstream effects on the c7n-left traverse
filter.
gets serialized out with a single
__ref__
when there are in fact two refs.