Terraform.VirtualMachines/.drone.yml

52 lines
1.5 KiB
YAML
Raw Normal View History

2021-02-02 12:06:52 +00:00
kind: pipeline
type: kubernetes
name: Terraform
steps:
- name: Terraform Init
image: bv11-cr01.bessems.eu/library/packer-extended
commands:
- |
terraform -chdir=terraform init \
2021-03-31 07:33:00 +00:00
-upgrade \
2021-02-02 12:06:52 +00:00
-input=false \
2021-02-02 12:08:27 +00:00
-backend-config="conn_str=$${PG_CONNECTIONSTRING}"
2021-03-31 07:47:41 +00:00
# - cat terraform/.terraform.lock.hcl
2021-02-02 12:06:52 +00:00
environment:
2021-02-02 12:14:50 +00:00
PG_CONNECTIONSTRING: postgres://terraform:terraform@tfstate.default.svc.cluster.local/terraform_backend?sslmode=disable
2021-02-02 12:06:52 +00:00
TF_AUTOMATION: yes
# TF_LOG: TRACE
2021-02-02 12:06:52 +00:00
- name: Terraform Plan
image: bv11-cr01.bessems.eu/library/packer-extended
commands:
- |
terraform -chdir=terraform plan \
-var="hv_password=$${VSPHERE_PASSWORD}" -var="repo_username=$${REPO_USERNAME}" -var="repo_password=$${REPO_PASSWORD}" -var="adds_password=$${ADDS_PASSWORD}" -var="vault_token=$${VAULT_TOKEN}" \
2021-03-31 07:43:22 +00:00
-var-file='vsphere.tfvars' -var-file='vm.tfvars' \
2021-02-02 12:06:52 +00:00
-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
2021-02-04 08:32:03 +00:00
ADDS_PASSWORD:
from_secret: adds_password
VAULT_TOKEN:
from_secret: vault_token
2021-02-02 12:46:40 +00:00
# TF_LOG: TRACE
2021-02-02 12:06:52 +00:00
- name: Terraform Apply
image: bv11-cr01.bessems.eu/library/packer-extended
commands:
- |
2021-02-02 13:03:16 +00:00
terraform -chdir=terraform apply \
2021-02-02 12:06:52 +00:00
-input=false \
-auto-approve \
terraform.plan
environment:
TF_AUTOMATION: yes
# TF_LOG: TRACE