fix(extractor): resolve region from provider config for real AWS plans#2
Merged
Conversation
Real terraform plans set region on the provider block, not individual resources. The extractor was exhausting all resource-level lookups and falling back to known_after_apply, causing all resources to be skipped. Changes: - Add extractProviderRegion() — reads configuration.provider_config - Add providerRegion as 5th fallback in resolveRegion() - Add plannedValuesMap fallback for instance_type resolution - Add TerraformPlan interface for proper typing Also adds: - fixtures/tfplan.e2e.json — real AWS plan fixture (credentials stripped) - .github/workflows/greenops-e2e.yml — live Action e2e test on PRs
🌱 GreenOps Infrastructure Impact
Resource Breakdown
Recommendations
|
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.
What
Fixes a bug found during live E2E testing against a real AWS account where all resources were being skipped as
known_after_apply.Root cause
Real
terraform planoutput sets region on the provider block, not on individual resources. The extractor was exhausting all resource-level region lookups (arn, availability_zone, region attribute) and falling back toknown_after_apply, skipping everything.Changes
extractProviderRegion()— readsconfiguration.provider_config.aws.expressions.region.constant_valueresolveRegion()— adds provider region as 5th fallbackplannedValuesMap— fallback for instance type fromplanned_valuesblockTerraformPlaninterface for proper typingfixtures/tfplan.e2e.json— real AWS plan fixture (credentials stripped).github/workflows/greenops-e2e.yml— live Action e2e testVerified
Tested against a live
terraform planon a real AWS account: