Open Mohitsharma44 opened 1 year ago
I am facing the same issue with a dynamic block while checking the HCL code. Here is the sample code
resource "google_compute_subnetwork" "subnetwork" {
for_each = local.subnets
name = each.value.subnet_name
ip_cidr_range = each.value.subnet_ip
region = each.value.subnet_region
private_ip_google_access = lookup(each.value, "subnet_private_access", "false")
dynamic "log_config" {
for_each = lookup(each.value, "subnet_flow_logs", false) ? [{
aggregation_interval = lookup(each.value, "subnet_flow_logs_interval", "INTERVAL_5_SEC")
flow_sampling = lookup(each.value, "subnet_flow_logs_sampling", "0.5")
metadata = lookup(each.value, "subnet_flow_logs_metadata", "INCLUDE_ALL_METADATA")
}] : []
content {
aggregation_interval = log_config.value.aggregation_interval
flow_sampling = log_config.value.flow_sampling
metadata = log_config.value.metadata
}
}
Describe the bug
Using regula on terraform resources that have dynamic blocks, generates mock_resources (and mock_input) that contains a "dynamic" list/array of maps but no "key" to identify what values corresponds to which argument.
How you're running Regula Please include versions of all relevant tools. Some examples:
3.2.1, build fed1e44
as a Rego library with OPAv0.46.0-dev
and a Terraform plan JSON input that I generated with Terraformv1.3.6
Operating System macOS v13.3.1
Steps to reproduce
IaC Configuration
It'd be beneficial for dynamic list of maps to have a key that would identify the resource that the dynamic block belonged to. So for example,
Additional context Add any other context about the problem here.