2022-06-09 02:29:59 +00:00
|
|
|
pipeline:
|
|
|
|
validate:
|
2022-06-09 02:45:38 +00:00
|
|
|
image: alpine:3.16
|
2022-06-09 02:29:59 +00:00
|
|
|
when:
|
|
|
|
path: "dns/**"
|
|
|
|
event: pull_request
|
|
|
|
commands:
|
|
|
|
- apk add --no-cache terraform
|
|
|
|
- terraform version
|
2022-06-09 02:45:38 +00:00
|
|
|
- cd dns
|
2022-06-09 03:54:44 +00:00
|
|
|
- env
|
2022-06-09 02:45:38 +00:00
|
|
|
- terraform init
|
|
|
|
- terraform validate
|
|
|
|
- terraform plan -var "token=$LINODE_TOKEN"
|
2022-06-09 03:54:44 +00:00
|
|
|
environment:
|
|
|
|
LINODE_TOKEN:
|
|
|
|
from_secret: linode_token
|
|
|
|
AWS_ACCESS_KEY_ID:
|
|
|
|
from_secret: aws_access_key_id
|
|
|
|
AWS_SECRET_ACCESS_KEY:
|
|
|
|
from_secret: aws_secret_access_key
|
2022-06-09 03:51:32 +00:00
|
|
|
secrets: [linode_token, aws_access_key_id, aws_secret_access_key]
|
2022-06-09 02:29:59 +00:00
|
|
|
|
|
|
|
deploy:
|
2022-06-09 02:45:38 +00:00
|
|
|
image: alpine:3.16
|
2022-06-09 02:29:59 +00:00
|
|
|
when:
|
|
|
|
path: "dns/**"
|
2022-06-09 02:45:38 +00:00
|
|
|
branch: main
|
2022-06-09 02:29:59 +00:00
|
|
|
event: push
|
|
|
|
commands:
|
|
|
|
- apk add --no-cache terraform
|
|
|
|
- terraform version
|
2022-06-09 02:45:38 +00:00
|
|
|
- cd dns
|
|
|
|
- terraform init
|
|
|
|
- terraform validate
|
|
|
|
- terraform plan -out deploy.plan -var "token=$LINODE_TOKEN"
|
|
|
|
- terraform apply deploy.plan -var "token=$LINODE_TOKEN"
|
2022-06-09 03:51:32 +00:00
|
|
|
secrets: [linode_token, aws_access_key_id, aws_secret_access_key]
|