Skip to content
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

POL-1307 Custom Meta Parent Templates / Tag Cardinality Report Fix #2545

Open
wants to merge 135 commits into
base: master
Choose a base branch
from

Conversation

XOmniverse
Copy link
Contributor

@XOmniverse XOmniverse commented Aug 15, 2024

Description

Meta Parent Custom Templates

This enables policy templates to use a custom template for meta parent policy generation. To make use of this new functionality, place a .pt.template file in the same directory as the child policy template and put the name of the file in the meta_template field in the info block. For example:

info(
  version: "3.2.0",
  provider: "AWS",
  service: "Tags",
  policy_set: "Tag Cardinality",
  meta_template: "aws_tag_cardinality_meta_parent.pt.template"
)

This will cause the automation that generates meta parent policy templates to use the specified template instead of the default one. The intended use-case here is for policy templates where simply combining incidents results in undesired behavior. An example is with the other change made with this PR.

Tag Cardinality Report Meta Parent Fix

When combining incidents from child policy templates, the meta parent for the Tag Cardinality Report policy templates would list the same key multiple times if it appears in multiple cloud accounts. As a result, it was not actually correctly reporting cardinality and was instead reporting per-account cardinality.

Using the functionality above, these policies now have custom meta parent templates with additional logic to properly combine the incidents into a single, correct cardinality report.

Issues Resolved

In addition to the above, this fixes an issue where the publish flag was incorrectly being used to determine the deprecated flag in meta parent policies. This flag is now correctly aligned with the deprecated flag in the child policy.

Link to Example Applied Policy

Contribution Check List

  • New functionality includes testing.
  • New functionality has been documented in the README if applicable
  • New functionality has been documented in CHANGELOG.MD

@XOmniverse XOmniverse requested a review from a team as a code owner August 15, 2024 13:14
Copy link
Contributor

github-actions bot commented Aug 15, 2024

1 Error
🚫

README_META_POLICIES.md

Markdown syntax errors found:

README_META_POLICIES.md:186: MD033 Inline HTML
README_META_POLICIES.md:186: MD033 Inline HTML

Further documentation is available for these failures:

  • MD033: https://github.com/markdownlint/markdownlint/blob/main/docs/RULES.md#md033—inline-html
2 Warnings
⚠️

operational/aws/tag_cardinality/aws_tag_cardinality.pt

Policy template updated but associated README.md file has not been. Please verify that any necessary changes have been made to the README.

⚠️

operational/azure/tag_cardinality/azure_tag_cardinality.pt

Policy template updated but associated README.md file has not been. Please verify that any necessary changes have been made to the README.

1 Message
📖 Github Pull Request
Pull Request is missing READY-FOR-REVIEW label. Please add this label if this Pull Request is ready for review.

Please note that this message may be a false positive if you've added the label after Dangerfile tests were run, since adding labels does not trigger them to run again. In these cases, simply ignore this message.

Spell Checker found issues

README_META_POLICIES.md

Line Typo
288 nd the list defined in [tools/meta_parent_policy_compiler/meta_parent_policy_compiler.r
288 s/meta_parent_policy_compiler/meta_parent_policy_compiler.rb](tools/meta_parent_policy_com
290 More information at [tools/meta_parent_policy_compiler/README.md](tools/meta_parent_
290 s/meta_parent_policy_compiler/README.md](tools/meta_parent_policy_com

Generated by 🚫 Danger

@XOmniverse XOmniverse changed the title POL-1307 Custom Meta Parent Templates / AWS Tag Cardinality Report Fix POL-1307 Custom Meta Parent Templates / Tag Cardinality Report Fix Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant