init: copy from lawndale-infra
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2022-05-27 22:07:43 +02:00
commit 3ca47a84ce
12 changed files with 420 additions and 0 deletions

86
.drone.yml Normal file
View File

@@ -0,0 +1,86 @@
---
kind: pipeline
type: kubernetes
name: Terraform root module
environment:
TF_IN_AUTOMATION: "1"
GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no -i $${PWD}/id_rsa"
AWS_REGION: eu-central-1
trigger:
ref:
- refs/heads/main
- refs/pull/*/head
steps:
- name: terraform init
image: hashicorp/terraform:1.1.8
commands:
- echo "$${CI_SSH_KEY}" | base64 -d > id_rsa
- chmod 600 id_rsa
- terraform init
environment:
CI_SSH_KEY:
from_secret: ci-ssh-key
AWS_ACCESS_KEY_ID:
from_secret: terraform-aws-key-id
AWS_SECRET_ACCESS_KEY:
from_secret: terraform-aws-secret-access-key
- name: terraform plan
image: hashicorp/terraform:1.1.8
commands:
- terraform plan $([[ $${DRONE_BUILD_EVENT} = cron ]] && echo "--detailed-exit-code") -var-file ci.tfvars -out .tfplan
environment:
AWS_ACCESS_KEY_ID:
from_secret: terraform-aws-key-id
AWS_SECRET_ACCESS_KEY:
from_secret: terraform-aws-secret-access-key
KUBE_TOKEN:
from_secret: lawndale-k8s-ci-token
- name: terraform apply
when:
branch:
- main
event:
- push
image: hashicorp/terraform:1.1.8
commands:
- terraform apply .tfplan
environment:
AWS_ACCESS_KEY_ID:
from_secret: terraform-aws-key-id
AWS_SECRET_ACCESS_KEY:
from_secret: terraform-aws-secret-access-key
KUBE_TOKEN:
from_secret: lawndale-k8s-ci-token
---
kind: pipeline
type: kubernetes
name: Check docs and format
environment:
TF_IN_AUTOMATION: "1"
trigger:
ref:
- refs/pull/*/head
steps:
- name: format and generate docs
image: hashicorp/terraform:1.1.8
commands:
- apk add bash wget
- wget -q https://github.com/terraform-docs/terraform-docs/releases/download/v0.16.0/terraform-docs-v0.16.0-linux-amd64.tar.gz -O - | tar -xz terraform-docs -C /usr/local/bin
- terraform fmt
- terraform-docs .
- git diff --exit-code
---
kind: signature
hmac: e92c995f7f899f06d1320e1e0660cb6cfa28f14d2e3ffe182fd2930534c83e7e
...