Replies: 2 comments
-
|
Exposing nested blocks is super useful, even essential I'd say. There's a whole host of checks missing if we're only looking at top-level keys. Can we revive #9570 somehow? |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the input, and for reviving this @kuzaxak @spinningarrow. Before reviving #9570 we want to get the exported structure right, because it becomes part of the public To design the structure around real needs rather than guesses, could you share the concrete checks you want to write that are not possible today? For each case it helps to have:
A few examples to show the kind of detail we are after (please add your own):
We are leaning toward a uniform, recursive block model where every block (top level and nested) has the same shape, so the same Rego idiom works at any depth. The use cases you provide will directly validate whether that shape is ergonomic enough. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
terraform-rawcurrently exposes top-level Terraform blocks and their attributes, but nested blocks are not exported to Rego. This prevents custom policies from inspecting common Terraform constructs such asterraform.required_providers, including provider version constraints.Minimal example
A custom
terraform-rawRego check can see the top-levelterraformblock and attributes likerequired_version, but it cannot inspect the nestedrequired_providersblock or the providerversionvalue.Expected behavior
terraform-rawshould expose nested blocks under their parent block, so Rego checks can inspectrequired_providersand provider version constraints.For example, policies should be able to reject exact provider pins such as
= 6.37.0while allowing bounded constraints like>= 6.0, < 7.0.Actual behavior
The raw input exposes the top-level
terraformblock, but nested blocks such asrequired_providersare missing from the Rego input.Related context
children: feat(misconf): export raw terraform blocks to Rego #9570It looks like #9570 is close to the needed behavior, but it was closed as stale rather than merged. Would the maintainers accept a refreshed version of that approach?
Beta Was this translation helpful? Give feedback.
All reactions