serverctl/.drone.yml

27 lines
1.1 KiB
YAML
Raw Normal View History

2022-02-17 22:02:50 +01:00
kind: pipeline
2022-02-17 22:02:20 +01:00
name: Serverctl
steps:
- name: terraform plan
2022-02-17 22:00:52 +01:00
image: alpine
2022-02-17 21:55:03 +01:00
environment:
HCLOUD_TOKEN:
from_secret: serverctl_hcloud_token
2022-02-17 22:00:52 +01:00
ACCESS_KEY:
from_secret: serverctl_access_key
SECRET_KEY:
from_secret: serverctl_secret_key
2022-02-18 16:26:35 +01:00
SSH_ZIP_KEY:
from_secret: serverctl_ssh_zip_key
2022-02-17 22:00:52 +01:00
commands:
2022-02-18 16:26:35 +01:00
- apk --update add curl zip
- cd infrastructure && unzip-ssh-keys "$SSH_ZIP_KEY" && cd ..
2022-02-17 22:00:52 +01:00
- curl --silent --output terraform.zip "https://releases.hashicorp.com/terraform/1.1.6/terraform_1.1.6_linux_amd64.zip"
- unzip terraform.zip ; rm -f terraform.zip; chmod +x terraform
- mkdir -p ${HOME}/bin ; export PATH=${PATH}:${HOME}/bin; mv terraform ${HOME}/bin/
- terraform -v
- cd infrastructure/create-resources
2022-02-17 22:05:42 +01:00
- terraform init -backend-config="access_key=$ACCESS_KEY" -backend-config="secret_key=$SECRET_KEY"
2022-02-17 22:00:52 +01:00
- terraform validate
2022-02-18 16:26:35 +01:00
- terraform apply -auto-approve -var "hcloud_token=$HCLOUD_TOKEN" -var "pvt_key='../ssh_keys/id_ed25519'" -var "pub_key='../ssh_keys/id_ed25519.pub'"