Skip to content

Commit 4a44cc5

Browse files
committed
Use SSM parameters for secrets
1 parent adee573 commit 4a44cc5

2 files changed

Lines changed: 64 additions & 0 deletions

File tree

.github/actions/acceptance-tests-e2e/action.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,31 @@ runs:
5959
pipx install poetry
6060
cd tests/e2e-tests && poetry install
6161
62+
- name: Retrieve acceptance test secrets from SSM
63+
if: ${{ steps.check_proxy_deployed.outputs.proxy_deployed == 'true' }}
64+
shell: bash
65+
run: |
66+
get_param() {
67+
aws ssm get-parameter --name "$1" --with-decryption --query "Parameter.Value" --output text)
68+
}
69+
70+
APIM_API_KEY=$(get_param '/acceptance/apiKeys/main')
71+
echo "::add-mask::$APIM_API_KEY"
72+
echo "APIM_API_KEY=$APIM_API_KEY" >> $GITHUB_ENV
73+
74+
APIM_PR_API_KEY=$(get_param '/acceptance/apiKeys/pr')
75+
echo "::add-mask::$APIM_PR_API_KEY"
76+
echo "APIM_PR_API_KEY=$APIM_PR_API_KEY" >> $GITHUB_ENV
77+
78+
APIM_STATUS_API_KEY=$(get_param '/acceptance/apiKeys/status')
79+
echo "::add-mask::$APIM_STATUS_API_KEY"
80+
echo "APIM_STATUS_API_KEY=$APIM_STATUS_API_KEY" >> $GITHUB_ENV
81+
82+
SUPPLIER_API_PRIVATE_KEY=$(get_param '/acceptance/keys/nonprod/private')
83+
echo "::add-mask::$SUPPLIER_API_PRIVATE_KEY"
84+
echo "SUPPLIER_API_PRIVATE_KEY=$SUPPLIER_API_PRIVATE_KEY" >> $GITHUB_ENV
85+
86+
6287
- name: Run tests
6388
if: ${{ steps.check_proxy_deployed.outputs.proxy_deployed == 'true' }}
6489
shell: bash
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
resource "aws_ssm_parameter" "acceptance_api_key_main" {
2+
3+
count = var.environment == "main" || startswith(var.environment, "pr") ? 1 : 0
4+
5+
name = "/acceptance/apiKeys/main"
6+
description = "The APIM API key for the main dev environment, to be overwritten by the internal repo when acceptance tests run"
7+
type = "SecureString"
8+
value = "Dummy"
9+
}
10+
11+
resource "aws_ssm_parameter" "acceptance_api_key_pr" {
12+
13+
count = var.environment == "main" || startswith(var.environment, "pr") ? 1 : 0
14+
15+
name = "/acceptance/apiKeys/pr"
16+
description = "The APIM API key for the PR dev environment, to be overwritten by the internal repo when acceptance tests run"
17+
type = "SecureString"
18+
value = "Dummy"
19+
}
20+
21+
resource "aws_ssm_parameter" "acceptance_api_key_status" {
22+
23+
count = var.environment == "main" || startswith(var.environment, "pr") ? 1 : 0
24+
25+
name = "/acceptance/apiKeys/status"
26+
description = "The APIM API key for the status endpoint, to be overwritten by the internal repo when acceptance tests run"
27+
type = "SecureString"
28+
value = "Dummy"
29+
}
30+
31+
resource "aws_ssm_parameter" "acceptance_key_nonprod_private" {
32+
33+
count = var.environment == "main" || startswith(var.environment, "pr") ? 1 : 0
34+
35+
name = "/acceptance/keys/nonprod/private"
36+
description = "The non-prod private key for the supplier API, to be overwritten by the internal repo when acceptance tests run"
37+
type = "SecureString"
38+
value = "Dummy"
39+
}

0 commit comments

Comments
 (0)