Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions azure/components/get-aws-secrets-and-ssm-params.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ parameters:
- name: config_ids
type: object
default: []
- name: aws_account
type: string
default: 'ptl'

steps:
- ${{ if parameters.secret_file_ids }}:
Expand All @@ -19,7 +22,7 @@ steps:
- bash: |
set -euo pipefail
secret_name=$(expr match ${{ secret_file_id }} '.*/\(.*\)')
secret_value=$(aws --profile apm_ptl secretsmanager get-secret-value --secret-id ${{ secret_file_id }} --query SecretString --output text)
secret_value=$(aws --profile apm_${{ aws_account }} secretsmanager get-secret-value --secret-id ${{ secret_file_id }} --query SecretString --output text)
secret_file_name=".${secret_name}"
echo "Storing multiline secret..."
echo "$secret_value" > "$secret_file_name"
Expand All @@ -32,7 +35,7 @@ steps:
- bash: |
set -euo pipefail
secret_name=$(expr match ${{ secret_id }} '.*/\(.*\)')
secret_value=$(aws --profile apm_ptl secretsmanager get-secret-value --secret-id ${{ secret_id }} --query SecretString --output text)
secret_value=$(aws --profile apm_${{ aws_account }} secretsmanager get-secret-value --secret-id ${{ secret_id }} --query SecretString --output text)

export LINES=`echo "$secret_value" | wc -l`
if (( $LINES > 1 )); then
Expand All @@ -47,6 +50,6 @@ steps:
- bash: |
set -euo pipefail
param_name=$(expr match ${{ config_id }} '.*/\(.*\)')
param_value=$(aws --profile apm_ptl ssm get-parameter --with-decryption --name ${{ config_id }} --query 'Parameter.Value' --output text)
param_value=$(aws --profile apm_${{ aws_account }} ssm get-parameter --with-decryption --name ${{ config_id }} --query 'Parameter.Value' --output text)
echo "##vso[task.setvariable variable=${param_name}]${param_value}"
displayName: 'Get config ${{ config_id }}'
4 changes: 4 additions & 0 deletions azure/components/set-facts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ parameters:
- name: config_ids
displayName: AWS SSM Config IDs
type: object
- name: aws_account
type: string
default: 'ptl'

steps:
- bash: |
Expand Down Expand Up @@ -44,6 +47,7 @@ steps:
secret_file_ids: ${{ parameters.secret_file_ids }}
secret_ids: ${{ parameters.secret_ids }}
config_ids: ${{ parameters.config_ids }}
aws_account: ${{ parameters.aws_account }}

- template: ../components/get-mfa-code.yml
parameters:
Expand Down