Skip to content
This repository has been archived by the owner on Feb 7, 2025. It is now read-only.

Commit

Permalink
Use environments for the different deploys
Browse files Browse the repository at this point in the history
  • Loading branch information
halprin committed Feb 5, 2024
1 parent 4279616 commit d0114a4
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
needs: ci
uses: ./.github/workflows/terraform-deploy_reusable.yml
with:
ENVIRONMENT: stg
TERRAFORM_DIRECTORY: operations/environments/staging
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CDC_CLIENT_ID }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/deploy_reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ on:
jobs:
build:
runs-on: ubuntu-latest
environment:
name: ${{ inputs.ENVIRONMENT }}
permissions:
id-token: write
contents: read
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/dev-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
name: Dev Infrastructure Deploy
uses: ./.github/workflows/terraform-deploy_reusable.yml
with:
ENVIRONMENT: dev
TERRAFORM_DIRECTORY: operations/environments/dev
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CDC_CLIENT_ID }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/internal-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
name: Internal Infrastructure Deploy
uses: ./.github/workflows/terraform-deploy_reusable.yml
with:
ENVIRONMENT: internal
TERRAFORM_DIRECTORY: operations/environments/internal
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/prod-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
needs: ci
uses: ./.github/workflows/terraform-deploy_reusable.yml
with:
ENVIRONMENT: prd
TERRAFORM_DIRECTORY: operations/environments/prod
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CDC_CLIENT_ID }}
Expand All @@ -27,7 +28,7 @@ jobs:
needs: terraform-deploy
uses: ./.github/workflows/deploy_reusable.yml
with:
ENVIRONMENT: prod
ENVIRONMENT: prd
REPO: trusted-intermediary-router
REPO_DOCS: trusted-intermediary-docs
APP: ${{ needs.terraform-deploy.outputs.APP }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/terraform-ci-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
uses: ./.github/workflows/terraform-deploy_reusable.yml
if: needs.paths-filter.outputs.operations == 'true'
with:
ENVIRONMENT: pr
TERRAFORM_DIRECTORY: operations/environments/pr
TERRAFORM_INIT_PARAMETERS: -backend-config="key=pr_${{ github.event.number }}.tfstate"
TERRAFORM_APPLY_PARAMETERS: -var="pr_number=${{ github.event.number }}"
Expand Down Expand Up @@ -76,6 +77,8 @@ jobs:

destroy-environment:
name: Destroy PR Environment
environment:
name: pr
needs:
- pr-deploy
- paths-filter
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/terraform-deploy_reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: Terraform Deploy
on:
workflow_call:
inputs:
ENVIRONMENT:
required: true
type: string
TERRAFORM_DIRECTORY:
type: string
required: true
Expand Down Expand Up @@ -32,6 +35,8 @@ on:
jobs:
terraform-deploy:
name: Terraform Deploy
environment:
name: ${{ inputs.ENVIRONMENT }}
runs-on: ubuntu-latest
env:
ARM_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
Expand Down

0 comments on commit d0114a4

Please sign in to comment.