diff --git a/.gitea/workflows/opdracht-3.yaml b/.gitea/workflows/opdracht-3.yaml new file mode 100644 index 0000000..a45a608 --- /dev/null +++ b/.gitea/workflows/opdracht-3.yaml @@ -0,0 +1,42 @@ +name: Terraform Provision + +on: + push: + branches: + - main + paths: + - opdracht-3/**/*.tf + - opdracht-3/**/*.tfvars + - opdracht-3/**/*.tftpl + +jobs: + terraform: + name: Terraform Apply + runs-on: ubuntu-latest + + env: + TF_VAR_esxi_hostname: ${{ secrets.ESXI_HOSTNAME }} + TF_VAR_esxi_username: ${{ secrets.ESXI_USERNAME }} + TF_VAR_esxi_password: ${{ secrets.ESXI_PASSWORD }} + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Terraform + uses: hashicorp/setup-terraform@v3 + + - name: Terraform Init + run: terraform init + + - name: Terraform Format + run: terraform fmt -check + + - name: Terraform Validate + run: terraform validate + + - name: Terraform Plan + run: terraform plan + + - name: Terraform Apply + run: terraform apply -auto-approve diff --git a/readme.md b/readme.md index c7fd2a0..0b663e4 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ -For the CI/CD pipelines [this website](https://spacelift.io/blog/github-actions-ansible) was used. +For the CI/CD pipelines [this website for Ansible](https://spacelift.io/blog/github-actions-ansible) and [this website for Terraform](https://spacelift.io/blog/github-actions-terraform) was used. -The runner is installed using the playbook in the `opdracht-2` directory. +The Gitea runner is installed using the playbook in the `opdracht-2` directory. The Terraform state backend is installed using the same playbook. Demo of assignment 2: