Skip to content

Commit 627f0f5

Browse files
committed
Allow fetching module in GitHub workflow
* Adding a personal access token as repository secret * Fetch the module via https
1 parent 0ead1d3 commit 627f0f5

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.github/workflows/deploy-backup-infrastructure.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: Deploy Backup vault infrastructure
22
run-name: Deploy backup vault infrastructure for ${{ inputs.environment }}
33

44
on:
5+
push:
56
workflow_dispatch:
67
inputs:
78
environment:
@@ -46,8 +47,11 @@ jobs:
4647
terraform_version: 1.10.5
4748
- name: Terraform Plan
4849
id: plan
50+
env:
51+
PERSONAL_ACCESS_TOKEN: ${{ secrets.BACKUP_MODULES_ACCESS_TOKEN }}
4952
run: |
5053
set -e
54+
git config --global url."https://foo:${PERSONAL_ACCESS_TOKEN}@github.com/NHSDigital".insteadOf "https://github.com/NHSDigital"
5155
terraform init -backend-config="env/${{ inputs.environment }}-backend.hcl" -upgrade
5256
terraform plan -var-file="env/${{ inputs.environment }}.tfvars" \
5357
-out ${{ runner.temp }}/tfplan | tee ${{ runner.temp }}/tf_stdout
@@ -86,7 +90,10 @@ jobs:
8690
with:
8791
terraform_version: 1.10.5
8892
- name: Apply the changes
93+
env:
94+
PERSONAL_ACCESS_TOKEN: ${{ secrets.BACKUP_MODULES_ACCESS_TOKEN }}
8995
run: |
9096
set -e
97+
git config --global url."https://foo:${PERSONAL_ACCESS_TOKEN}@github.com/NHSDigital".insteadOf "https://github.com/NHSDigital"
9198
terraform init -backend-config="env/${{ inputs.environment }}-backend.hcl" -upgrade
9299
terraform apply ${{ runner.temp }}/tfplan

terraform/backup/source/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ resource "aws_kms_key" "backup_notifications" {
116116
# Now we can deploy the source and destination modules, referencing the resources we've created above.
117117

118118
module "source" {
119-
source = "git@github.com:NHSDigital/terraform-aws-backup.git//modules/aws-backup-source?ref=v1.1.0"
119+
source = "github.com/NHSDigital/terraform-aws-backup.git//modules/aws-backup-source?ref=v1.1.0"
120120

121121
backup_copy_vault_account_id = local.destination_account_id
122122
backup_copy_vault_arn = var.destination_vault_arn

0 commit comments

Comments
 (0)