File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3434 aws_role="$(ROLE)"
3535 echo "assume role: '${aws_role}'"
3636
37- if [[ "$AWS_ACCOUNT " =~ ^(prod|dev)$ ]]; then
38- echo "account is $AWS_ACCOUNT "
39- account_id="$(aws ssm get-parameter --name /account-ids/$AWS_ACCOUNT --query Parameter.Value --output text)"
37+ if [[ "${{ parameters.aws_account }} " =~ ^(prod|dev)$ ]]; then # NOSONAR
38+ echo "account is ${{ parameters.aws_account }} "
39+ account_id="$(aws ssm get-parameter --name /account-ids/${{ parameters.aws_account }} --query Parameter.Value --output text)"
4040 if [[ "${aws_role}" != arn:aws:iam:* ]]; then
4141 aws_role="arn:aws:iam::${account_id}:role/${aws_role}"
4242 fi
4646 echo "check if role exists"
4747 # iam synchronisation issues can take a few to make the role appear
4848 for i in {1..15}; do
49- if aws iam get-role --role-name ${aws_role} > /dev/null; then
49+ if aws iam get-role --role-name " ${aws_role}" > /dev/null; then
5050 echo role exists
5151 sleep 2
5252 break
9494 sed -i "s#\[default\]#\[profile ${profile}\]#" ~/.aws/config
9595 fi
9696 env:
97- AWS_ACCOUNT: ${{ parameters.aws_account }}
9897 PROFILE: ${{ parameters.profile }}
9998 displayName: assume role
10099 condition: and(succeeded(), eq(variables['ROLE_EXISTS'], 'true'))
You can’t perform that action at this time.
0 commit comments