-
Notifications
You must be signed in to change notification settings - Fork 4
54 lines (48 loc) · 2.28 KB
/
_seed-database.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
47
48
49
50
51
52
53
54
on:
workflow_call:
inputs:
workspace:
description: 'Suffix of the environment_config_file_ artifact to download'
required: true
type: string
jobs:
terraform_workflow:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@cbb722410c2e876e24abbe8de2cc27693e501dcb # pin@v3
with:
fetch-depth: '0'
- name: configure AWS credentials for terraform
uses: aws-actions/configure-aws-credentials@97834a484a5ab3c40fa9e2eb40fcf8041105a573 # [email protected]
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_ACTIONS }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_ACTIONS }}
aws-region: eu-west-1
role-duration-seconds: 1800
role-session-name: OPGUseAnLPASeedGithubAction
- name: download cluster_config
uses: actions/download-artifact@d0ce8fd1167ed839810201de977912a090ab10a7
with:
name: environment_config_file_${{ inputs.workspace }}
path: terraform/environment
- name: install python
uses: actions/setup-python@55aad42e4674b58b2b2fb7d8e7552402d922b4e7 # [email protected]
with:
python-version: '3.10'
cache: 'pip'
- name: install requirements
run: pip install -r service-api/seeding/requirements.txt
- name: seed dynamodb
run: |
export AWS_ACCOUNT_ID=$(cat ./terraform/environment/cluster_config.json | jq .account_id | xargs)
if [[ "${AWS_ACCOUNT_ID}" == "690083044361" ]]
then
echo "Production account detected. Exiting"
exit 1
fi
export DYNAMODB_TABLE_ACTOR_CODES=$(cat ./terraform/environment/cluster_config.json | jq .actor_lpa_codes_table | xargs)
export DYNAMODB_TABLE_VIEWER_CODES=$(cat ./terraform/environment/cluster_config.json | jq .viewer_codes_table | xargs)
export DYNAMODB_TABLE_ACTOR_USERS=$(cat ./terraform/environment/cluster_config.json | jq .use_users_table | xargs)
export DYNAMODB_TABLE_USER_LPA_ACTOR_MAP=$(cat ./terraform/environment/cluster_config.json | jq .user_lpa_actor_map | xargs)
export DYNAMODB_TABLE_STATS=$(cat ./terraform/environment/cluster_config.json | jq .stats_table | xargs)
python service-api/seeding/dynamodb.py