Mise à jour du nombre de nœuds ouvriers dans la configuration de prod… #89
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
name: Terraform Validation | |
on: | |
push: | |
branches: | |
- main # ou votre branche cible | |
jobs: | |
terraform_validation: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Create certificate.ovpn from GitHub Secret | |
run: | | |
echo "${{ secrets.VPN_CERTIFICATE_PROD }}" | base64 --decode > certificate.ovpn | |
- name: Connect to openVPN | |
run: | | |
sudo apt-get update | |
sudo apt-get install openvpn -y | |
sudo openvpn --config certificate.ovpn --daemon | |
echo "Connected to VPN" | |
- name: Wait for a VPN connection | |
timeout-minutes: 1 | |
run: until ping -c1 192.168.1.1; do sleep 1; done | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v1 | |
with: | |
terraform_version: 1.7.3 | |
- name: Create temp_backend.tfvars from GitHub Secret | |
run: | | |
echo "${{ secrets.BACKEND_PROD }}" | base64 --decode > temp_backend.tfvars | |
- name: Terraform Init | |
run: terraform init -backend-config="temp_backend.tfvars" -reconfigure | |
- name: Terraform Validate | |
run: terraform validate | |
- name: Create secrets_prod.tfvars from GitHub Secret | |
run: | | |
echo "${{ secrets.SECRETS_PROD }}" | base64 --decode > secrets_prod.tfvars | |
- name: Terraform Plan | |
run: terraform plan -var-file="secrets_prod.tfvars" -var-file="configurations/prod.tfvars" | |
- name: Terraform apply | |
run: terraform apply -auto-approve -var-file="secrets_prod.tfvars" -var-file="configurations/prod.tfvars" | |
# - name: Terraform destroy | |
# run: terraform destroy -auto-approve -var-file="secrets_prod.tfvars" -var-file="configurations/prod.tfvars" | |