Skip to content

Commit bd87238

Browse files
committed
Revert "CCM-11029: remove dupe ssh param"
This reverts commit 2509d17.
1 parent 27aa3b1 commit bd87238

File tree

8 files changed

+29
-5
lines changed

8 files changed

+29
-5
lines changed

amplify.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ applications:
88
- cd ..
99
- nvm install 20.13.1
1010
- nvm use 20.13.1
11-
- export GITHUB_TOKEN=$(aws ssm get-parameter --name "$GITHUB_PAT_SSM_PARAM_NAME" --with-decryption --query Parameter.Value --output text)
11+
- export GITHUB_TOKEN=$(aws ssm get-parameter --name "$GITHUB_PACKAGES_READ_PAT_SSM_PARAM_NAME" --with-decryption --query Parameter.Value --output text)
1212
- ./scripts/set_github_token.sh
1313
- npm ci --cache .npm --prefer-offline
1414
- npm run create-amplify-outputs env

infrastructure/terraform/components/acct/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
| Name | Description |
5252
|------|-------------|
5353
| <a name="output_dns_zone"></a> [dns\_zone](#output\_dns\_zone) | n/a |
54+
| <a name="output_github_packages_read_pat_ssm_param_name"></a> [github\_packages\_read\_pat\_ssm\_param\_name](#output\_github\_packages\_read\_pat\_ssm\_param\_name) | n/a |
5455
| <a name="output_github_pat_ssm_param_name"></a> [github\_pat\_ssm\_param\_name](#output\_github\_pat\_ssm\_param\_name) | n/a |
5556
| <a name="output_log_subscription_role_arn"></a> [log\_subscription\_role\_arn](#output\_log\_subscription\_role\_arn) | n/a |
5657
| <a name="output_s3_buckets"></a> [s3\_buckets](#output\_s3\_buckets) | n/a |

infrastructure/terraform/components/acct/outputs.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ output "github_pat_ssm_param_name" {
1010
value = aws_ssm_parameter.github_pat.name
1111
}
1212

13+
output "github_packages_read_pat_ssm_param_name" {
14+
value = aws_ssm_parameter.github_packages_read_pat.name
15+
}
16+
1317
output "s3_buckets" {
1418
value = {
1519
access_logs = {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
resource "aws_ssm_parameter" "github_packages_read_pat" {
2+
name = "/${local.csi}/github_packages_read_pat"
3+
description = "A GitHub PAT token with read:packages scope, used by Amplify to download packages from GitHub package repo"
4+
type = "SecureString"
5+
value = try(var.initial_cli_secrets_provision_override.github_packages_read_pat, "UNSET")
6+
7+
lifecycle {
8+
ignore_changes = [value]
9+
}
10+
}
11+
12+
# This can be set at provision time like:
13+
# PARAM_OBJECT=$(jq -n \
14+
# --arg github_packages_read_pat "github_pat_123abc" \
15+
# '{github_packages_read_pat:$github_packages_read_pat}' | jq -R)
16+
# .bin/terraform <args> .. -a apply -- -var="initial_cli_secrets_provision_override=${PARAM_OBJECT}"

infrastructure/terraform/components/app/amplify_app.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
resource "aws_amplify_app" "main" {
22
name = local.csi
33
repository = "https://github.com/NHSDigital/nhs-notify-web-template-management"
4-
access_token = data.aws_ssm_parameter.github_pat.value
4+
access_token = data.aws_ssm_parameter.github_pat_ssm_param_name.value
55

66
iam_service_role_arn = aws_iam_role.amplify.arn
77

@@ -32,7 +32,7 @@ resource "aws_amplify_app" "main" {
3232
AMPLIFY_MONOREPO_APP_ROOT = "frontend"
3333
API_BASE_URL = module.backend_api.api_base_url
3434
CSRF_SECRET = aws_ssm_parameter.csrf_secret.value
35-
GITHUB_PAT_SSM_PARAM_NAME = data.aws_ssm_parameter.github_pat.name
35+
GITHUB_PACKAGES_READ_PAT_SSM_PARAM_NAME = data.aws_ssm_parameter.github_packages_read_pat.name
3636
NEXT_PUBLIC_PROMPT_SECONDS_BEFORE_LOGOUT = 120
3737
NEXT_PUBLIC_TIME_TILL_LOGOUT_SECONDS = 900
3838
NOTIFY_ENVIRONMENT = var.environment
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
data "aws_ssm_parameter" "github_packages_read_pat" {
2+
name = local.acct.github_packages_read_pat_ssm_param_name
3+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
data "aws_ssm_parameter" "github_pat" {
1+
data "aws_ssm_parameter" "github_pat_ssm_param_name" {
22
name = local.acct.github_pat_ssm_param_name
33
}

infrastructure/terraform/components/app/iam_role_amplify.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ data "aws_iam_policy_document" "amplify" {
7474
]
7575

7676
resources = [
77-
data.aws_ssm_parameter.github_pat.arn
77+
data.aws_ssm_parameter.github_packages_read_pat.arn
7878
]
7979
}
8080
}

0 commit comments

Comments
 (0)