-
Notifications
You must be signed in to change notification settings - Fork 2
49 lines (38 loc) · 1.11 KB
/
deploy.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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: |
ls
cd labs-17
terraform init
ls -a
working-directory: ${{ env.CONFIG_DIRECTORY }}
- name: Terraform apply
run: |
ls
cd labs-17
terraform apply
working-directory: ${{ env.CONFIG_DIRECTORY }}