diff --git a/.github/workflows/CI-Terraform.yml b/.github/workflows/CI-Terraform.yml new file mode 100644 index 0000000..8964e5f --- /dev/null +++ b/.github/workflows/CI-Terraform.yml @@ -0,0 +1,55 @@ +name: 'Terraform' +on: + pull_request: + branches: + - "*" + paths-ignore: + - ".devcontainer/**" + - ".github/**" + - ".gitignore" + - ".terraform.lock.hcl" + - "README.md" + push: + branches-ignore: + - "main" + branches: + - "*" + paths-ignore: + - ".devcontainer/**" + - ".github/**" + - ".gitignore" + - ".terraform.lock.hcl" + - "README.md" + + +permissions: + contents: read + +jobs: + terraform: + name: 'Terraform' + env: + ARM_CLIENT_ID: ${{ secrets.AZURE_AD_CLIENT_ID }} + ARM_CLIENT_SECRET: ${{ secrets.AZURE_AD_CLIENT_SECRET }} + ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + ARM_TENANT_ID: ${{ secrets.AZURE_AD_TENANT_ID }} + runs-on: ubuntu-latest + environment: production + + # Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest + steps: + # Checkout the repository to the GitHub Actions runner + - name: Checkout + uses: actions/checkout@v4 + + # 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@v1 + + # Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc. + - name: Terraform Init + run: terraform init + + # Generates an execution plan for Terraform + - name: Terraform Plan + run: terraform plan -input=false