Skip to content

update deploy.yml

update deploy.yml #18

Workflow file for this run

name: "Terraform Cloud Deploy "
on:
push:
branches:
- main
env:
TF_API_TOKEN: "${{ secrets.TF_API_TOKEN }}"
TF_API_URL: "app.terraform.io"
CONFIG_DIRECTORY: "labs-17"
jobs:
terraform:
runs-on: ubuntu-latest
steps:
- name: Checkout le code
uses: actions/checkout@v2
- name: Set up Terraform CLI
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.6.6 # Modifiez en fonction de la version souhaitée
- name: Configure Terraform Cloud
run: |
echo "credentials \"$TF_API_URL\" {" >> ~/.terraformrc
echo " token = \"${{ secrets.TF_API_TOKEN }}\"" >> ~/.terraformrc
echo "}" >> ~/.terraformrc
working-directory: ${{ env.CONFIG_DIRECTORY }}
- name: Initialize Terraform
run: |
terraform init
ls -a
working-directory: ${{ env.CONFIG_DIRECTORY }}
- name: Terraform apply
run: |
terraform apply --auto-approve
working-directory: ${{ env.CONFIG_DIRECTORY }}