这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@exitcode0
Copy link

Description

Checkov's Terraform plan scanning previously only processed resources from planned_values, which excludes resources being purely deleted (action ["delete"]).
This prevented custom checks from validating deletion conditions (e.g., ensuring a resource is in an acceptable state before removal).

This PR extends the plan parser to extract resources with pure delete actions from resource_changes and make them available to policy checks.
The resource's "before" state is used as the configuration, with __change_actions__ set to ["delete"].

This would allow a policy to enforce specific resources attribute values before resource deletion.

Fixes #5587

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my feature, policy, or fix is effective and works
  • New and existing tests pass locally with my changes

Previously, it was not possible to check a resource's configuration when
the plan indicated the resource would be deleted entirely. This prevented
custom checks from enforcing conventions around deletions.

We now process pure delete actions from resource_changes. The "before"
state is made available as the resource configuration, with __change_actions__
set to ["delete"].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Checkov does not run checks, issues no errors, when deleting resources in Terraform plan.

1 participant