82 lines
2.1 KiB
YAML
82 lines
2.1 KiB
YAML
---
|
|
kind: pipeline
|
|
name: default
|
|
type: docker
|
|
|
|
trigger:
|
|
branch:
|
|
- main
|
|
|
|
steps:
|
|
- name: terraform init
|
|
image: hashicorp/terraform:1.5
|
|
commands:
|
|
- terraform -chdir=infrastructure init
|
|
|
|
- name: Terraform syntax check for pull request
|
|
image: hashicorp/terraform:1.5
|
|
commands:
|
|
- terraform -chdir=infrastructure fmt -write=false -diff -check -recursive
|
|
when:
|
|
event:
|
|
- pull_request
|
|
|
|
- name: terraform plan for pull request
|
|
image: hashicorp/terraform:1.5
|
|
commands:
|
|
- terraform -chdir=infrastructure validate
|
|
- terraform -chdir=infrastructure plan
|
|
environment:
|
|
TF_VAR_virtual_environment_endpoint:
|
|
from_secret: virtual_environment_endpoint
|
|
TF_VAR_virtual_environment_api_token:
|
|
from_secret: virtual_environment_api_token
|
|
when:
|
|
event:
|
|
- pull_request
|
|
|
|
- name: Terraform infrastructure syntax check
|
|
image: hashicorp/terraform:1.5
|
|
commands:
|
|
- terraform -chdir=infrastructure fmt -diff -check
|
|
when:
|
|
branch:
|
|
- main
|
|
event:
|
|
- push
|
|
- tag
|
|
|
|
- name: terraform infrastructure plan
|
|
image: hashicorp/terraform:1.5
|
|
commands:
|
|
- terraform -chdir=infrastructure validate
|
|
- terraform -chdir=infrastructure plan
|
|
environment:
|
|
TF_VAR_virtual_environment_endpoint:
|
|
from_secret: virtual_environment_endpoint
|
|
TF_VAR_virtual_environment_api_token:
|
|
from_secret: virtual_environment_api_token
|
|
when:
|
|
branch:
|
|
- main
|
|
event:
|
|
- push
|
|
- tag
|
|
|
|
- name: terraform infrastructure apply
|
|
image: hashicorp/terraform:1.5
|
|
commands:
|
|
- terraform -chdir=infrastructure validate
|
|
- terraform -chdir=infrastructure plan -out tfapply
|
|
- terraform -chdir=infrastructure apply -auto-approve tfapply
|
|
environment:
|
|
TF_VAR_virtual_environment_endpoint:
|
|
from_secret: virtual_environment_endpoint
|
|
TF_VAR_virtual_environment_api_token:
|
|
from_secret: virtual_environment_api_token
|
|
when:
|
|
branch:
|
|
- main
|
|
event:
|
|
- push
|
|
- tag |