Repository navigation
Conversation
…th output inventory.py turns OpenTofu plan JSON (root and child modules, for_each and count instances by full address) or CDK synth templates into inventory.json: one record per managed resource with type, stack, region, tags, the required tags it is missing, and the source path where the input carries one. It renders a Graphviz diagram (DOT and SVG) and a Mermaid block clustered by project, environment and owner, filled by data-class with violations outlined in red, and diffs against a base inventory into added, removed and retagged resources. The schema lives in docs/asset-inventory.schema.json. The composite wraps the script and writes SHA256SUMS. asset-inventory.yml downloads the caller's plan artefact, fetches the last published inventory.json from the repo's asset-inventory-latest release for the PR diff, keeps one PR comment, and on pushes to the default branch publishes the register to that rolling release. tests/asset-inventory/run.sh covers both parsers, taggable heuristics, the diff, DOT and Mermaid snapshots, the schema and the usage errors; CI runs it and the composite on the fixtures. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NPH9145e4gFo6bmXvMgBoF
Current GitHub-hosted images do not ship dot, so the SVG was missing and SHA256SUMS failed. Also a shellcheck SC2016 on a backticked grep in the test script. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NPH9145e4gFo6bmXvMgBoF
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NPH9145e4gFo6bmXvMgBoF
This was referenced Oct 12, 2026
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 #115. Stacked on #164 (
issue-114-tagging) for the tagging standard; retarget once that merges. The plan and synth artefacts are produced by the caller (the shared plan step from #89/#93 and the CDK synth from #90/#94 are not built yet), which is how the issue'splan-artifactinput is defined anyway.What
.github/actions/asset-inventory/inventory.py(stdlib): OpenTofu parser walksplanned_values.root_moduleand nestedchild_modules, so module,for_eachandcountinstances appear by full address; tags fromtags_all,tags,effective_labelsorlabels; region fromconfiguration.provider_config; data sources skipped; a type with no tags attribute istaggable: falseand never gets violations. CDK parser reads every*.template.json, tags fromProperties.Tags,source.pathfromMetadata["aws:cdk:path"],AWS::CDK::Metadataskipped, taggable by a known-type list orTagspresence.tag_violationslists missing required keys (values are the feat: inventory — tagging standard and PR-time enforcement across IaC stacks #114 gate's job). Plan JSON carries no source positions, sosource.path/lineare null for OpenTofu andaccountis null unless given (documented).dot, present on hosted runners) and Mermaid, both clustered project, environment, owner, filled bydata-class, violations outlined red. The report embeds Mermaid up tomermaid-max-nodes, else points at the SVG artefact.inventory.json:added,removed,retagged(id,key,before,after); owner changes bold in the report. Report carries the<!-- asset-inventory -->marker.docs/asset-inventory.schema.json(draft 2020-12);docs/asset-inventory.mddocuments fields, limits, publishing, andinframap/cdk-diaas unwired add-ons.stack,input-dir,required-tags,account,base-inventory,mermaid-max-nodes,output-dir; outputsresource-count,violation-count,added-count,report-path; writesSHA256SUMS. Never fails on findings.asset-inventory.yml: inputs from the issue plusrequired-tags,account,comment,actions-ref. Downloadsplan-artifact; on PRs fetchesinventory.jsonfrom the repo'sasset-inventory-latestrelease (notice if none) and keeps one PR comment (fork PRs skipped); on pushes to the default branch withpublishcreates or updates that rolling release withinventory.json,inventory.svg,inventory.mmd,SHA256SUMS. Artefact always uploaded.Asset Inventoryjob: fixtures suite (installscheck-jsonschema), composite on the OpenTofu fixture with the base inventory and on the CDK fixture, output and SVG assertions,SHA256SUMScheck. README rows and section.Tests
tests/asset-inventory/run.sh: exact resource sets for the OpenTofu fixture (two stacks, child and nested modules,for_eachkeys,countindex, Google labels, untaggablerandom_id, data source skipped) and the CDK fixture (taggable role without tags, partially tagged topic, untaggable permission, metadata skipped);--accountand--required-tags; diff categories and the bold owner change; DOT and Mermaid snapshots (fixtures/expected); Mermaid threshold; SVG render whendotis present; schema validation of three inventories withcheck-jsonschema; empty input and usage errors.Deferred
🤖 Generated with Claude Code
https://claude.ai/code/session_01NPH9145e4gFo6bmXvMgBoF