Skip to content

Prmp 841 - Bulk report #716

Prmp 841 - Bulk report

Prmp 841 - Bulk report #716

# .github/workflows/terraform-dev
name: 'Development CI Feature to Main'
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
pull-requests: write
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
terraform_process:
runs-on: ubuntu-latest
environment: development
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }}
role-skip-session-tagging: true
aws-region: ${{ vars.AWS_REGION }}
- name: View AWS Role
run: aws sts get-caller-identity
# Install the latest version of Terraform CLI and configure the Terraform CLI configuration file with a Terraform Cloud user API token
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.5.4
terraform_wrapper: false
- name: Terraform Init
id: init
run: terraform init -backend-config=backend.conf
working-directory: ./infrastructure
shell: bash
- name: Terraform Set Workspace
id: workspace
run: terraform workspace select ${{ secrets.AWS_WORKSPACE }}
working-directory: ./infrastructure
shell: bash
# Checks that all Terraform configuration files adhere to a canonical format
- name: Terraform Format
run: terraform fmt -check
working-directory: ./infrastructure
- name: Terraform Plan
id: plan
run: |
terraform plan -input=false -no-color -var-file="${{vars.TF_VARS_FILE}}" -out tf.plan
working-directory: ./infrastructure
shell: bash
# Terraform apply will only occur on a push (merge request completion)
- name: Terraform Apply
if: github.ref == 'refs/heads/main'
run: terraform apply -auto-approve -input=false tf.plan
working-directory: ./infrastructure
run_main_repo_deploy_lambdas:
name: Deploy Lambdas on NDR Functional Repo
needs: ['terraform_process']
if: github.ref == 'refs/heads/main'
uses: nhsconnect/national-document-repository/.github/workflows/lambdas-deploy-feature-to-sandbox.yml@main
with:
build_branch: main
sandbox: ndr-dev
environment: development
secrets:
AWS_ASSUME_ROLE: ${{ secrets.AWS_ASSUME_ROLE }}
run_main_repo_deploy_ui:
name: Deploy Lambdas on NDR Functional Repo
needs: ['terraform_process']
if: github.ref == 'refs/heads/main'
uses: nhsconnect/national-document-repository/.github/workflows/ui-deploy-feature-to-sandbox-manual.yml@main
with:
build_branch: main
sandbox: ndr-dev
environment: development
secrets:
AWS_ASSUME_ROLE: ${{ secrets.AWS_ASSUME_ROLE }}