Treat "remediate" stack policies as "mandatory" #339
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Stack policies cannot be remediated (resource policies can). And yet, it's possible to configure a policy pack such that all or certain policies have a certain enforcement level (enforcement levels can be configured externally, such as from a file or Pulumi Cloud). This means it's possible to specify an enforcement level of "remediate" for a stack policy, even though stack policies do not support being remediated.
Currently, if a stack policy has a level of "remediate" and a violation is reported, a panic occurs in the CLI.
This commit addresses this by treating stack policies with a level of "remediate" as "mandatory", similar to how "remediate" resource policies are treated as "mandatory" if the policy is still in violation after a remediation for the policy has run:
pulumi-policy/sdk/nodejs/policy/server.ts
Lines 218 to 222 in 3a76fdf
pulumi-policy/sdk/python/lib/pulumi_policy/policy.py
Lines 756 to 759 in 3a76fdf
Related: pulumi/pulumi#15618
Part of #332