-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (43 loc) · 1.54 KB
/
aws-secretsmanager-get-oauth2.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: AWS Secrets Manager for OAuth2 Environment
on:
workflow_call:
inputs:
environment:
description: 'Environment name'
required: true
type: string
aws_region:
description: 'AWS region'
default: 'us-west-2'
required: false
type: string
outputs:
token_url:
description: 'OAuth2 token URL'
value: ${{ jobs.get-value.outputs.token_url }}
secret_key:
description: 'OAuth2 secret key'
value: ${{ jobs.get-value.outputs.secret_key }}
jobs:
get-value:
name: Get OAuth2 Secret From AWS Secrets Manager and Output
runs-on: ubuntu-20.04
outputs:
token_url: ${{ steps.get-value.outputs.token_url }}
secret_key: ${{ steps.get-value.outputs.secret_key }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ inputs.aws_region }}
mask-aws-account-id: false
- name: Get and Output OAuth2 Secret Values
id: get-value
env:
environment: ${{ inputs.environment }}
run: |
json=$(aws secretsmanager get-secret-value --secret-id /$environment/oauth2 --query SecretString --output json | jq -r .)
echo "token_url=$(echo $json | jq -r .token_url)" >> $GITHUB_OUTPUT
echo "secret_key=$(echo $json | jq -r .secret_key)" >> $GITHUB_OUTPUT