-
Notifications
You must be signed in to change notification settings - Fork 0
33 lines (25 loc) · 1.04 KB
/
terraform.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
name: Terraform Deployment
on:
pull_request:
types: [closed]
branches:
- main # Sostituisci con il tuo branch principale, se diverso
jobs:
terraform:
name: Run Terraform
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.4.5 # Sostituisci con la versione di Terraform che stai usando
- name: Terraform Init
run: terraform init -backend-config="storage_account_name=${{ secrets.AZURE_STORAGE_ACCOUNT_NAME }}" -backend-config="container_name=${{ secrets.AZURE_STORAGE_CONTAINER_NAME }}" -backend-config="access_key=${{ secrets.AZURE_STORAGE_ACCESS_KEY }}" -backend-config="key=terraform.tfstate"
- name: Terraform Validate
run: terraform validate
- name: Terraform Plan
run: terraform plan -var-file=environment/dev/terraform.tfvars
- name: Terraform Apply
run: terraform apply -auto-approve -var-file=environment/dev/terraform.tfvars