fix(reverse-import): pass customer assume-role auth to the closure discoverer (presets#770)#198
Merged
Merged
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
…scoverer (presets#770)
The Mars reverse-import job pod runs as the platform Argo role; terraform
reaches the customer account via generated assume_role { role_arn } blocks.
The closure/dep-chase discoverer hits the AWS SDK directly, so it must
adopt the SAME assume-role identity — otherwise its calls run as the wrong
principal and the customer account returns AccessDenied (presets#739
defect 2). Pre-#770 the discoverer used raw ambient pod creds.
- Bump insideout-terraform-presets to 6f2675350c14 (presets#770), which
added the trailing reversedisco.AWSAssumeRole arg to reversedisco.New
and exported reverseimport.ResolveAWSProviderAuth.
- Resolve the customer auth eagerly at Main via ResolveAWSProviderAuth
(cheap, network-free: TF_VAR_bootstrap_role / TF_VAR_aws_external_id
env, then outputs/cloud-provision.json, then tf/auto-vars) and thread
it through discovererFactory + lazyDiscoverer to reversedisco.New. The
cloud is still dialed lazily, preserving validate-before-dial ordering.
- A resolve error (corrupt artifacts) is logged and downgraded to empty
(ambient) auth; the engine's own ResolveAWSProviderAuth in Run surfaces
the same error fatally if it actually matters for the provider blocks.
Tests: assert Main threads the resolved RoleARN/ExternalID to the
factory, and that empty env yields empty (ambient) auth.
282d689 to
3f42386
Compare
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
Pass the customer-account assume-role identity to the reverse-import closure discoverer, completing the presets#739 credentials fix in the deployed (Mars job pod) context.
Why
assume_role { role_arn }blocks.AccessDenied(presets#739 defect 2).reversedisco.AWSAssumeRolearg toreversedisco.Newand exportedreverseimport.ResolveAWSProviderAuthso the discoverer-construction site and the engine share one resolution path. This PR consumes that.Changes
insideout-terraform-presetsto6f2675350c14(presets#770).MainviaResolveAWSProviderAuth(cheap, network-free:TF_VAR_bootstrap_role/TF_VAR_aws_external_idenv — present in the job pod env — thenoutputs/cloud-provision.json, thentf/auto-vars), and thread it throughdiscovererFactory+lazyDiscoverertoreversedisco.New. The cloud is still dialed lazily, preserving the validate-before-dial ordering (codex P2 on fix(reverse-import): wire closure-capable discoverer into the job (#195) #196).ResolveAWSProviderAuthinsideRunsurfaces the same error fatally if it matters for the provider blocks.Tests
TestMainResolvesAndPassesAssumeRoleAuth: setsTF_VAR_*env, drivesMainwith a recording fake factory, asserts the factory received that RoleARN/ExternalID. Failing-proof verified (temporarily passing an empty struct makes it fail).TestMainPassesEmptyAssumeRoleAuthWhenUnset: empty env → emptyAWSAssumeRole(ambient).go build ./... && go vet ./... && go test ./...green (68 tests, 17 packages); gofmt clean.Zero behavior change beyond the auth wiring + pin bump.