feat: execute terraform workflow
This commit is contained in:
42
.gitea/workflows/opdracht-3.yaml
Normal file
42
.gitea/workflows/opdracht-3.yaml
Normal file
@@ -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
|
@@ -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:
|
Demo of assignment 2:
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user