Skip to content

Commit

Permalink
adding config + pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnorOKane-Kainos committed Jul 3, 2024
1 parent 4ee73f8 commit 65c3bf2
Showing 1 changed file with 4 additions and 36 deletions.
40 changes: 4 additions & 36 deletions .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ permissions:
contents: read

jobs:
precheck-sbox:
plan-and-apply:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
Expand Down Expand Up @@ -45,7 +45,7 @@ jobs:
-backend-config="container_name=tfstate" \
-backend-config="key=terraform.tfstate"
- name: Plan Terraform
- name: Plan and Apply Terraform
working-directory: components
env:
ARM_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
Expand All @@ -54,40 +54,8 @@ jobs:
ARM_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
terraform plan \
terraform plan -out=tfplan \
-var="location=UK South" \
-var="override_action=plan" \
-var="github_token=${{ secrets.PAT_TOKEN }}"
apply:
runs-on: ubuntu-latest
needs: precheck-sbox
if: github.ref == 'refs/heads/rule-sets-DTSPO-17918' # Ensure apply only runs on the target branch
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Log in to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Setup Terraform
uses: hashicorp/setup-terraform@v1

- name: Change directory to Terraform config
run: cd components

- name: Apply Terraform
working-directory: components
env:
ARM_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
ARM_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
ARM_SUBSCRIPTION_ID: ${{ secrets.DCD_CFT_SANDBOX_SUBSCRIPTION }}
ARM_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
terraform apply -auto-approve \
-var="location=UK South" \
-var="override_action=apply" \
-var="github_token=${{ secrets.PAT_TOKEN }}"
terraform apply -auto-approve tfplan

0 comments on commit 65c3bf2

Please sign in to comment.