This repository was archived by the owner on Dec 15, 2022. It is now read-only.
generated from crossplane/provider-template
-
Notifications
You must be signed in to change notification settings - Fork 29
feat(pc): add assumeRoleARN to providerConfig like "native" provider-aws #160
Merged
muvaf
merged 1 commit into
crossplane-contrib:main
from
haarchri:feature/assumeRoleARN-providerconfig
Feb 28, 2022
+156
−242
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| ## How can assumeRoleARN be used with provider-jet-aws ? | ||
|
|
||
| provider-jet-aws will be configured to connect to AWS Account A via `InjectedIdentity` or `Secret` , request security credentials, and then `assumeRoleARN` to assume a role in AWS Account B to manage the resources within AWS Account B. | ||
|
|
||
| The first thing that needs to be done is to create an IAM role within AWS Account B that provider-jet-aws will `assumeRoleARN` into. | ||
|
|
||
| - From within the AWS console of AWS Account B, navigate to IAM > Roles > Create role > Another AWS account. | ||
|
|
||
| - Enter the Account ID of Account A (the account provider-jet-aws will call `assumeRoleARN` from). | ||
|
|
||
| Next, the provider-jet-aws must be configured to use `assumeRoleARN`. The code snippet below shows how to configure provider-jet-aws to connect to AWS Account A and assumeRoleARN into a role within AWS Account B. | ||
|
|
||
| ```bash | ||
| cat > provider-config.yaml <<EOF | ||
| apiVersion: aws.jet.crossplane.io/v1alpha1 | ||
| kind: ProviderConfig | ||
| metadata: | ||
| name: account-b | ||
| spec: | ||
| assumeRoleARN: "arn:aws:iam::999999999999:role/account-b" | ||
| credentials: | ||
| source: InjectedIdentity | ||
| EOF | ||
| ``` | ||
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| apiVersion: pkg.crossplane.io/v1 | ||
| kind: Provider | ||
| metadata: | ||
| name: provider-aws | ||
| spec: | ||
| package: crossplane/provider-jet-aws:main |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| --- | ||
| apiVersion: aws.jet.crossplane.io/v1alpha1 | ||
| kind: ProviderConfig | ||
| metadata: | ||
| name: aws-jet-provider-account-b | ||
| spec: | ||
| assumeRoleARN: "arn:aws:iam::999999999999:role/account_b" | ||
| credentials: | ||
| source: Secret | ||
| secretRef: | ||
| name: example-aws-jet-creds | ||
| namespace: crossplane-system | ||
| key: credentials |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # This is a helper script that uses the AWS CLI configuration to construct an | ||
| # JET-AWS ProviderConfig. | ||
|
|
||
| cd "$(dirname "$0")" | ||
|
|
||
| set -e -o pipefail | ||
|
|
||
| AWS_PROFILE=${AWS_PROFILE:=default} # retrieve profile's credentials, save it under 'default' profile, and base64 encode it | ||
| BASE64ENCODED_AWS_ACCOUNT_CREDS=$(echo "[default]\naws_access_key_id = $(aws configure get aws_access_key_id --profile $AWS_PROFILE)\naws_secret_access_key = $(aws configure get aws_secret_access_key --profile $AWS_PROFILE)" | base64 | tr -d "\n") | ||
|
|
||
| cat providerconfig.yaml | sed "s/<REPLACEME>/${BASE64ENCODED_AWS_ACCOUNT_CREDS}/g" | kubectl apply -f - |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to just redirect people to https://github.com/crossplane/provider-aws/blob/master/AUTHENTICATION.md ? I think we fully cover all methods now, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes could be also one option externalID is missing since we will add this with v0.24 ;) but then yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@muvaf so i can remove the md and add a link in readme ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to avoid confusion, I think it's better to have this doc in this repo instead of redirecting the users to different repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vara-bonthu Good point. We can possibly copy the doc from there and change all provider-aws references to provider-jet-aws because it's more extensive and covers more cases.