Add script reporting Terraform-managed vs unmanaged AWS resources - #202
Merged
Conversation
Enumerates the incubator account natively per service and buckets resources by their managed-by tag. The Resource Groups Tagging API is a backstop only: it under-reports most services because it largely indexes resources that already carry a tag. Closes #199
10 tasks
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.
Adds
scripts/aws-terraform-coverage.ps1andscripts/README.md, reporting which resources in the incubator account (035866691871) carry amanaged-byTerraform tag and which do not.Resolves #199. Its dependency, hackforla/devops-security#172, is merged and verified live —
gha-incubatornow returnsmanaged-by=terraform-devops-security.Two deviations from the ticket
jqis not a dependency at all; JSON is parsed withConvertFrom-Json.resourcegroupstaggingapisweep. It is not the only one — the API under-reports nearly every service, because it largely indexes only resources that already carry a tag, which is the wrong bias for a report that exists to find untagged resources. In us-west-2: log groups 26 live / 9 returned, ECR 12/6, Secrets Manager 10/3, ACM 7/2, SSM 45/36, SNS 2/0, and Route 53 8 zones / 0.So every service is enumerated natively and the tagging sweep runs last as a backstop. It currently adds zero resources, meaning the native collectors are a strict superset. The tagging API alone sees 203 resources; the script reports 486.
Other behaviour worth review
Invoke-AwsClirefuses any subcommand that is notdescribe-*,list-*orget-*.Verified against hackforla/incubator#155
Every claim in that hand-captured record reproduces: the VPC,
incubator-prodECS cluster, ASG, ALB, 7 us-west-2 ACM certificates, 8 of 8 Route 53 hosted zones and 2 of 3 Cognito user pools all come back unmanaged. No disagreement to report back to #155.Scoped to local runs against an AWS profile. Scheduling it would need an OIDC role for
hackforla/devops, which does not exist; out of scope per the ticket.