-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e09a65a
commit 7f7583b
Showing
1 changed file
with
19 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,61 @@ | ||
name: Rule Sets Pipeline | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- rule-sets-DTSPO-17918 | ||
push: | ||
branches: | ||
- rule-sets-DTSPO-17918 | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
jobs: | ||
plan-and-apply: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 60 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: 'Az CLI login' | ||
run: | | ||
az login --service-principal \ | ||
-u ${{ secrets.ARM_CLIENT_ID }} \ | ||
-p ${{ secrets.ARM_CLIENT_SECRET }} \ | ||
--tenant ${{ secrets.ARM_TENANT_ID }} | ||
az account set --subscription ${{ secrets.DCD_CFT_SANDBOX_SUBSCRIPTION }} | ||
|
||
- 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: Initialize Terraform | ||
working-directory: components | ||
env: | ||
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }} | ||
ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }} | ||
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.ARM_TENANT_ID }} | ||
ARM_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | ||
run: | | ||
terraform init \ | ||
-backend-config="resource_group_name=rule-set-rg" \ | ||
-backend-config="storage_account_name=rulesetsa" \ | ||
-backend-config="container_name=tfstate" \ | ||
-backend-config="key=terraform.tfstate" | ||
- name: Plan and Apply Terraform | ||
working-directory: components | ||
env: | ||
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }} | ||
ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }} | ||
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.ARM_TENANT_ID }} | ||
ARM_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | ||
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} | ||
run: | | ||
terraform plan -out=tfplan \ | ||
-var="location=UK South" \ | ||
-var="override_action=plan" \ | ||
-var="github_token=${{ secrets.PAT_TOKEN }}" | ||
terraform apply -auto-approve tfplan | ||
terraform apply -auto-approve tfplan |