infra/.drone.yml

45 lines
1.1 KiB
YAML
Raw Normal View History

2021-02-12 21:42:16 +00:00
kind: pipeline
type: kubernetes
name: default
steps:
2021-02-14 13:17:24 +00:00
- name: PRepare terraform files
2021-02-12 21:42:16 +00:00
image: alpine
commands:
2021-02-14 13:17:24 +00:00
- "apk update && apk add jq curl git git-crypt"
2021-02-12 21:42:16 +00:00
- |
2021-02-14 13:17:24 +00:00
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"
2021-02-12 21:42:16 +00:00
- name: Terraform apply
image: hashicorp/terraform:latest
2021-02-14 13:17:24 +00:00
environment:
TF_VAR_prod: "true"
2021-02-12 21:42:16 +00:00
commands:
2021-02-13 02:10:39 +00:00
- "terraform init"
- "terraform plan -target=module.kubernetes_cluster"
2021-02-14 13:17:24 +00:00
# - name: Update configmap
# image: alpine
# commands:
# - "apk update && apk add curl"
# - "head terraform.tfstate"
2021-02-12 21:42:16 +00:00
# plan: true
# root_dir: "/data/src"
# var_files:
# - "/terraform.tfvars"
# remote:
# backend:
# ---
# kind: secret
# name: tfstate
# get:
# path: tfstate-default-state
# name: tfstate
2021-02-14 13:17:24 +00:00
# ---
# kind: secret
# name: tfstate
# data: zQSRlrUlUyY/lJL4AADpjTt+CfLmybuZqI4uHbPKv8kn2Aq4jomsNmseYgvrxbOF