73 lines
1.5 KiB
YAML
73 lines
1.5 KiB
YAML
---
|
|
kind: pipeline
|
|
type: kubernetes
|
|
name: Terraform root module
|
|
|
|
trigger:
|
|
event:
|
|
- cron
|
|
- push
|
|
branch:
|
|
- main
|
|
|
|
environment:
|
|
TF_IN_AUTOMATION: "1"
|
|
|
|
steps:
|
|
- name: terraform init
|
|
image: hashicorp/terraform:1.1.8
|
|
commands:
|
|
- mkdir -p ~/.ssh
|
|
- chmod 755 ~/.ssh
|
|
- echo "$${CI_SSH_KEY}" | base64 -d > ~/.ssh/id_rsa
|
|
- chmod 600 ~/.ssh/id_rsa
|
|
- terraform init
|
|
environment:
|
|
GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no"
|
|
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 -out .tfplan
|
|
environment:
|
|
AWS_ACCESS_KEY_ID:
|
|
from_secret: terraform-aws-key-id
|
|
AWS_SECRET_ACCESS_KEY:
|
|
from_secret: terraform-aws-secret-access-key
|
|
GITEA_TOKEN:
|
|
from_secret: gitea-token
|
|
KUBE_TOKEN:
|
|
from_secret: lawndale-k8s-ci-token
|
|
|
|
- name: terraform apply
|
|
when:
|
|
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
|
|
GITEA_TOKEN:
|
|
from_secret: gitea-token
|
|
KUBE_TOKEN:
|
|
from_secret: lawndale-k8s-ci-token
|
|
|
|
---
|
|
kind: signature
|
|
hmac: 6950738d3bbe37bb7d5201b9fd7a086ee09a2206a433f19d01c2570cc5718b61
|
|
|
|
...
|