-
Notifications
You must be signed in to change notification settings - Fork 0
Fix AWS account parameter usage and improve role existence check #627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
b0d27ef
03b7fc0
5a438e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,9 +34,9 @@ | |
| aws_role="$(ROLE)" | ||
| echo "assume role: '${aws_role}'" | ||
|
|
||
| if [[ "$AWS_ACCOUNT" =~ ^(prod|dev)$ ]]; then | ||
| echo "account is $AWS_ACCOUNT" | ||
| account_id="$(aws ssm get-parameter --name /account-ids/$AWS_ACCOUNT --query Parameter.Value --output text)" | ||
| if [[ "${{ parameters.aws_account }}" =~ ^(prod|dev)$ ]]; then # NOSONAR | ||
|
Check failure on line 37 in azure/components/aws-assume-role.yml
|
||
| echo "account is ${{ parameters.aws_account }}" | ||
|
Check failure on line 38 in azure/components/aws-assume-role.yml
|
||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
| account_id="$(aws ssm get-parameter --name /account-ids/${{ parameters.aws_account }} --query Parameter.Value --output text)" | ||
|
Check failure on line 39 in azure/components/aws-assume-role.yml
|
||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
| if [[ "${aws_role}" != arn:aws:iam:* ]]; then | ||
| aws_role="arn:aws:iam::${account_id}:role/${aws_role}" | ||
| fi | ||
|
|
@@ -46,7 +46,7 @@ | |
| echo "check if role exists" | ||
| # iam synchronisation issues can take a few to make the role appear | ||
| for i in {1..15}; do | ||
| if aws iam get-role --role-name ${aws_role} > /dev/null; then | ||
| if aws iam get-role --role-name "${aws_role}" > /dev/null; then | ||
| echo role exists | ||
| sleep 2 | ||
| break | ||
|
|
@@ -94,7 +94,6 @@ | |
| sed -i "s#\[default\]#\[profile ${profile}\]#" ~/.aws/config | ||
| fi | ||
| env: | ||
| AWS_ACCOUNT: ${{ parameters.aws_account }} | ||
| PROFILE: ${{ parameters.profile }} | ||
| displayName: assume role | ||
| condition: and(succeeded(), eq(variables['ROLE_EXISTS'], 'true')) | ||
Uh oh!
There was an error while loading. Please reload this page.