-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider supporting policy transformations #108
Comments
@lukehoban @leezen , both @clstokes and I had a conversation with a customer today that effectively distills down to this. As they said today, "it's great to block deployments if tags are missing, but even better to just inject the right tags automatically for all of our stacks in the first place." I do wonder where this belongs -- as it's somewhere between transformations and policies. |
I am trying to create a policy to check for tags: def tags_validator(args: ResourceValidationArgs, report_violation: ReportViolation):
if "tags" in args.props:
tags = args.props["tags"]
for tag in ["Project"]:
if tag not in tags:
report_violation("Must have a tag name {tag}")
tags = ResourceValidationPolicy(
name="tags",
description="Must have tags and specific one",
validate=tags_validator,
)
PolicyPack(
name="azure-python",
enforcement_level=EnforcementLevel.MANDATORY,
policies=[
tags,
],
) But not violation is reported if no tags are assigned to a resource. Instead using: if "tags" not in args.props:
report_violation("Must have a tags") will report a violation even if no tags can be assigned to the resource (ie |
This was fixed with #314 (and associated CLI changes) |
Cannot close issue:
Please fix these problems and try again. |
A user had the suggestion to allow write operations from policies. Two examples:
This seems like a very powerful capability — but potentially very dangerous and/or confusing also, and probably one where you'd want dials to control what rewrites were allowed to run where.
The text was updated successfully, but these errors were encountered: