54 lines
1.4 KiB
YAML
54 lines
1.4 KiB
YAML
kind: pipeline
|
|
type: kubernetes
|
|
name: Terraform
|
|
|
|
steps:
|
|
- name: Terraform Init
|
|
image: bv11-cr01.bessems.eu/library/packer-extended
|
|
commands:
|
|
- set -x
|
|
- |
|
|
terraform init \
|
|
-chdir=terraform \
|
|
-input=false \
|
|
-backend-config="conn_str=$${PG_CONNECTIONSTRING}"
|
|
environment:
|
|
PG_CONNECTIONSTRING: postgres://${PG_USERNAME}:${PG_PASSWORD}@${PG_HOST}/${PG_DATABASE}?sslmode=disable
|
|
PG_HOST: tfstate.default.svc.cluster.local
|
|
PG_DATABASE: terraform_backend
|
|
PG_USERNAME: terraform
|
|
PG_PASSWORD: terraform
|
|
TF_AUTOMATION: yes
|
|
# TF_LOG: TRACE
|
|
- name: Terraform Plan
|
|
image: bv11-cr01.bessems.eu/library/packer-extended
|
|
commands:
|
|
- |
|
|
terraform plan \
|
|
-var='vsphere_password=$${VSPHERE_PASSWORD}' -var='repo_username=$${REPO_USERNAME}' -var='repo_password=$${REPO_PASSWORD}' \
|
|
-var-file='vsphere.tfvars' \
|
|
-chdir=terraform \
|
|
-input=false \
|
|
-out=terraform.plan
|
|
environment:
|
|
TF_AUTOMATION: yes
|
|
VSPHERE_PASSWORD:
|
|
from_secret: vsphere_password
|
|
REPO_USERNAME:
|
|
from_secret: repo_username
|
|
REPO_PASSWORD:
|
|
from_secret: repo_password
|
|
# TF_LOG: TRACE
|
|
- name: Terraform Apply
|
|
image: bv11-cr01.bessems.eu/library/packer-extended
|
|
commands:
|
|
- |
|
|
terraform apply \
|
|
-chdir=terraform \
|
|
-input=false \
|
|
-auto-approve \
|
|
terraform.plan
|
|
environment:
|
|
TF_AUTOMATION: yes
|
|
# TF_LOG: TRACE
|