Skip to content

feat(query): new query that ensures that container instances are using private virtual networks for terraform/azure#7877

Merged
cx-ricardo-jesus merged 15 commits into
masterfrom
AST-120679
Dec 30, 2025
Merged

feat(query): new query that ensures that container instances are using private virtual networks for terraform/azure#7877
cx-ricardo-jesus merged 15 commits into
masterfrom
AST-120679

Conversation

@cx-ricardo-jesus

Copy link
Copy Markdown
Contributor

Reason for Proposed Changes

  • Currently, no query ensures that container instances are using private virtual networks for terraform/azure.

Proposed Changes

  • After researching through the azurerm_container_group resource documentation, it is clear that, In order to check if the container instance is using private virtual networks, it is imperative to check the value defined on the ip_address_type field is defined to Private. Another field that could be relevant in this scenario is checking if the field subnet_id is defined. However, according to the documentation, if the field ip_address_type is defined as Private, the field subnet_id must also be defined. Defining the field ip_address_type to Private and not defining the field subnet_id will result in an error, as seen below, so it is only necessary to check if the field ip_address_type is defined to Private.
image
  • Regarding the query implementation itself, the query is composed of just one policy that uses the helper function get_res. The helper function get_res checks if the field ip_address_type is not defined or set to Private, resulting in a positive result if either of these scenarios occurs.

I submit this contribution under the Apache-2.0 license.

@cx-ricardo-jesus cx-ricardo-jesus requested a review from a team as a code owner November 24, 2025 22:49
@github-actions github-actions Bot added feature New feature query New query feature terraform Terraform query azure PR related with Azure Cloud labels Nov 24, 2025
@github-actions

github-actions Bot commented Nov 24, 2025

Copy link
Copy Markdown
Contributor

kics-logo

KICS version: v2.1.18

Category Results
CRITICAL CRITICAL 0
HIGH HIGH 0
MEDIUM MEDIUM 0
LOW LOW 0
INFO INFO 0
TRACE TRACE 0
TOTAL TOTAL 0
Metric Values
Files scanned placeholder 1
Files parsed placeholder 1
Files failed to scan placeholder 0
Total executed queries placeholder 47
Queries failed to execute placeholder 0
Execution time placeholder 0

@cx-eduardo-semanas cx-eduardo-semanas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cx-eduardo-semanas cx-eduardo-semanas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cx-ricardo-jesus cx-ricardo-jesus merged commit 15e1f89 into master Dec 30, 2025
29 checks passed
@cx-ricardo-jesus cx-ricardo-jesus deleted the AST-120679 branch December 30, 2025 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

azure PR related with Azure Cloud feature New feature query New query feature terraform Terraform query

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants