44 lines
1.1 KiB
YAML
44 lines
1.1 KiB
YAML
kind: pipeline
|
|
type: kubernetes
|
|
name: default
|
|
|
|
steps:
|
|
- name: PRepare terraform files
|
|
image: alpine
|
|
commands:
|
|
- "apk update && apk add jq curl git git-crypt"
|
|
- |
|
|
curl -k https://kubernetes:6443/api/v1/namespaces/drone/configmaps/git-crypt-key -H "Authorization:Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" | jq -r .data.key | base64 -d > /tmp/key
|
|
- "git-crypt unlock /tmp/key"
|
|
- name: Terraform apply
|
|
image: hashicorp/terraform:latest
|
|
environment:
|
|
TF_VAR_prod: "true"
|
|
commands:
|
|
- "terraform init"
|
|
- "terraform plan -target=module.kubernetes_cluster"
|
|
|
|
# - name: Update configmap
|
|
# image: alpine
|
|
# commands:
|
|
# - "apk update && apk add curl"
|
|
# - "head terraform.tfstate"
|
|
# plan: true
|
|
# root_dir: "/data/src"
|
|
# var_files:
|
|
# - "/terraform.tfvars"
|
|
# remote:
|
|
# backend:
|
|
|
|
|
|
# ---
|
|
# kind: secret
|
|
# name: tfstate
|
|
# get:
|
|
# path: tfstate-default-state
|
|
# name: tfstate
|
|
|
|
# ---
|
|
# kind: secret
|
|
# name: tfstate
|
|
# data: zQSRlrUlUyY/lJL4AADpjTt+CfLmybuZqI4uHbPKv8kn2Aq4jomsNmseYgvrxbOF
|