fix(deploy): link external Identity providers for CDK wiring#973
Open
fix(deploy): link external Identity providers for CDK wiring#973
Conversation
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.
Summary
credentials[].namewhen no local credential value is availableagentcore/.cli/deployed-state.jsonso CDK-managed resources can consume provider ARNsMotivation
Some AgentCore resources are configured through CDK/CloudFormation and require credential provider ARNs at deploy time. A concrete example is gateway target outbound auth, where the CDK construct maps
outboundAuth.credentialNameto anapiKeyCredentialProvider.providerArnoroauthCredentialProvider.providerArn.Before this change, deploy could only populate those ARNs through the local secret sync path: values from
agentcore/.env.localor process env would create or update AgentCore Identity credential providers, and the returned ARN would be written to deployed state. That made it difficult to manage infrastructure through CLI/CDK while keeping credential provider secrets externally managed, for example through the AgentCore console, another project, or internal IaC/security workflows.This change adds a secretless link path: when local secret values are absent, deploy looks up an existing AgentCore Identity credential provider by name and records its ARN in deployed state for CDK wiring.
Scope
This does not change the agent runtime credential retrieval path. Agent code can already request credentials by provider name, for example with
@requires_api_key(provider_name=...). This change is for deploy/CDK wiring where a provider ARN is required, such as gateway target outbound auth.If local credential values are present, deploy preserves the existing create/update behavior. The link path is used only when the matching local secret values are absent.
Manual verification
OpenAIManualLinkCodexTokyoinap-northeast-1via the AWS consoleagentcore.jsonreferences that credential nameagentcore/.env.localempty and unset the matching process env varagentcore deploy --target default --diff --yes --verboseCreating credentials...succeededagentcore/.cli/deployed-state.jsoncontains the linkedcredentialProviderArn.env.localnor an existing provider is availableTest plan
npm test -- src/cli/operations/identity/__tests__/api-key-credential-provider.test.ts src/cli/operations/deploy/__tests__/pre-deploy-identity.test.tsnpm run typechecknpm run lint(0 errors, existing warnings only)npm run buildnpx prettier --check docs/commands.md docs/configuration.md src/cli/commands/deploy/actions.ts src/cli/operations/deploy/pre-deploy-identity.ts src/cli/operations/deploy/__tests__/pre-deploy-identity.test.ts src/cli/operations/identity/api-key-credential-provider.ts src/cli/operations/identity/__tests__/api-key-credential-provider.test.ts src/cli/operations/identity/index.ts src/cli/tui/hooks/useCdkPreflight.tsgit diff --check(CRLF warnings only)