Repository navigation
Conversation
…nforcement Define the four mandatory tags (owner, project, environment, data-class) once in policies/tags/standard.yml and enforce them at every stack: - tflint: bundled configs for the aws and azurerm rulesets, run by the tflint composite as a second pass with --only <provider>_resource_missing_tags when require-tags is on, so the consumer's own .tflint.hcl stays untouched. lint-iac.yml exposes require-tags (default true) and tags-provider. - checkov: SPK_TAG_1 and SPK_TAG_2 custom YAML policies require the four keys in AWS default_tags and Google default_labels; loaded with --external-checks-dir policies/tags/checkov. - conftest: tags.rego in the k8s-policy bundle checks required labels, enums and patterns on workloads and namespaces. It is dormant until the standard is loaded as data, which the composite does when require-tags is on; k8s-policy.yml exposes require-tags (default true). - CDK: RequiredTagsAspect in Python and TypeScript under docs/examples/cdk, failing synth on a missing key or a value outside the enum. tests/tagging/run.sh runs each point against pass and fail fixtures; CI installs the tools and aws-cdk-lib, runs the suite, and dogfoods the tflint and k8s-policy composites with require-tags on the same fixtures. The #77 chart and kustomize fixtures gain the labels so their dogfood stays green. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NPH9145e4gFo6bmXvMgBoF
schemastore matches policies/**/*.yaml to the aerleon policy schema, so MegaLinter's v8r rejected the checkov custom policies. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NPH9145e4gFo6bmXvMgBoF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #114. Stacked on #151 (
issue-77-k8s-policy) for the conftest bundle; retarget tomainonce that merges.What
policies/tags/standard.yml(single source:owner,project,environment,data-classwith the patterns and enums from the issue;label_patternfor Kubernetes where@is not a legal label character) anddocs/tagging-standard.md.policies/tags/tflint/{aws,azurerm}.tflint.hclenableaws_resource_missing_tags/azurerm_resource_missing_tagswith the four keys. Thetflintcomposite gainsrequire-tags(defaulttrue) andtags-provider: a second passtflint --config <bundled> --only <provider>_resource_missing_tags --minimum-failure-severity=notice, so the consuming repo's.tflint.hclis untouched. AWS providerdefault_tagssatisfy the rule.lint-iac.ymlexposes both inputs. No Google label rule exists in that ruleset; documented.policies/tags/checkov/spk_tag_{1,2}.yaml:provider.awsmust declaredefault_tags.tags.<key>andprovider.googledefault_labels.<key>for the four keys (--external-checks-dir policies/tags/checkov). Wiring arequire-tagsinput intoiac-scan.ymlis a one-line follow-up once feat(#6): IaC misconfiguration scan reusable workflow — checkov #141 merges.tags.regoadded to the k8s-policy bundle: required labels, enum and pattern checks on every workload kind andNamespace. Dormant unless the standard is loaded as data (two-dfiles cannot both set a key, so off means not loaded). The composite loads it whenrequire-tags(defaulttrue);k8s-policy.ymlexposes the input. The feat: IaC/K8s — org policy gate on rendered manifests with conftest (PR/CI) #77 chart and kustomize fixtures gain the labels so their dogfood stays green;tests/k8s-policy/run.shis unaffected (no data, policy dormant).docs/examples/cdk/required_tags_aspect.pyandrequired-tags-aspect.ts: READONLY-priority aspect that reads the resolvedTagManagervalues and adds an error annotation per missing key or out-of-enum value; tokens skipped.dr-check-cdk.ymlwiring follows feat: DR readiness — cdk-nag resilience rules for AWS CDK (PR/CI) #94.Taggingjob installs tflint, conftest, checkov (same checksum-verified downloads as the composites) andaws-cdk-lib, runstests/tagging/run.sh, then dogfoods thetflintandk8s-policycomposites on tagged (must pass) and untagged (must fail) fixtures. The root tflint smoke job setsrequire-tags: "false"because the fixtures include a deliberately untagged stack.Tests
tests/tagging/run.sh: tflint aws and azurerm pass/fail, checkovSPK_TAG_1/SPK_TAG_2pass/fail (andSPK_TAG_2ignoring AWS), conftest exact deny set on the untagged manifests (missing labels, bad enum, bad patterns), tagged manifests clean, policy dormant without data, and the CDK aspect (tagged stack clean, untagged stack exactly three errors) whenaws-cdk-libis importable. Verified locally with tflint 0.63.1, conftest 0.71.1, checkov 3.3.27 and aws-cdk-lib 2.273.0.Deferred
iac-scan.ymlrequire-tagsinput (after feat(#6): IaC misconfiguration scan reusable workflow — checkov #141),dr-check-cdk.ymlrequire-tagsinput (after feat: DR readiness — cdk-nag resilience rules for AWS CDK (PR/CI) #94), enum cross-check with the classification doc once docs: PII — data classification policy template and recognizer mapping #100 lands.🤖 Generated with Claude Code
https://claude.ai/code/session_01NPH9145e4gFo6bmXvMgBoF