ROUTE53: support named AWS profiles (including SSO) and init command#4312
Open
tresni wants to merge 2 commits into
Open
ROUTE53: support named AWS profiles (including SSO) and init command#4312tresni wants to merge 2 commits into
tresni wants to merge 2 commits into
Conversation
Adds a Profile field to the Route53 provider creds so each provider entry can target a specific named profile from ~/.aws/config, including AWS IAM Identity Center (SSO) profiles. This enables managing multiple AWS accounts from a single dnscontrol run without juggling AWS_PROFILE. Profile is mutually exclusive with KeyId/SecretKey but composes with RoleArn (profile supplies the source creds, RoleArn is assumed on top).
Register CredsMetadata for ROUTE53 so the provider is offered by the `dnscontrol init` wizard. The wizard prompts for one of three auth methods (named profile / static access key / default credential chain) and optionally a RoleArn, ExternalId, and DelegationSet on top.
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
Two related additions to the Route 53 provider:
Profilefield increds.json— point each provider entry at a specific named profile from~/.aws/config, including AWS IAM Identity Center (SSO) profiles. Enables managing multiple AWS accounts from a singlednscontrol push.initcommand support —RegisterCredsMetadataso thednscontrol initwizard offersROUTE53and walks the user through picking an auth method.Motivation
Today the provider only accepts
KeyId/SecretKey/Tokenand (optionally)RoleArn/ExternalId. Operators who use AWS Identity Center to manage multiple AWS accounts can't point each Route53 provider entry at a different SSO profile — the SDK's default chain only honors a singleAWS_PROFILEenv var, so a singlednscontrol pushacross multiple accounts is impossible without manually exporting temporary credentials between runs.Going through
RoleArndoesn't help here: AWS-reserved SSO roles (AWSReservedSSO_*) have SAML-federation trust policies and cannot be reached viasts:AssumeRolefrom a regular IAM identity.ProfilebehaviorProfilefield is read frommand, when set, appended to the SDK load options asconfig.WithSharedConfigProfile(profile).Profileis mutually exclusive withKeyId/SecretKey. Setting both returns an explicit error.Profilecomposes withRoleArn: the profile supplies the source credentials, andRoleArnis then assumed on top via STS — matching the existing flow.Example
creds.json:{ "r53_prod": { "TYPE": "ROUTE53", "Profile": "aws-prod" }, "r53_dev": { "TYPE": "ROUTE53", "Profile": "aws-dev" }, "r53_stage": { "TYPE": "ROUTE53", "Profile": "aws-stage" } }With
aws sso login --sso-session <session>cached, a singlednscontrol pushcan now operate across all three accounts.initcommand behaviorRegisterCredsMetadatais called withKind: KindDNS | KindRegistrar(Route 53 acts as both) and an_authMethodselector offering three branches:~/.aws/config, including SSO) → prompts forProfile.KeyId,SecretKey, and optionalToken, each pre-filled from the matchingAWS_*env var when present.Optional fields shown for all branches:
RoleArn,ExternalId,DelegationSet.Scope
Only
providers/route53/usesconfig.LoadDefaultConfig—grep -r LoadDefaultConfig providers/returns just the Route53 file — so no other provider is affected.Test plan
go build ./...succeedsgo vet ./providers/route53/...cleanbin/generate-all.shproduces no diffdnscontrol initlists ROUTE53 and writes a valid entry for each of the three auth methodsaws sso login --sso-session <session>thendnscontrol check-creds r53_prod ROUTE53against an SSO-backed profileProfile+KeyIdin the same entry returns the mutual-exclusion errorProfile+RoleArnchains correctly (source creds from profile, STS assume on top)