ci: fix drift detection by setting --detailed-exitcode if running as cron
From terraform plan --help > -detailed-exitcode Return detailed exit codes when the command exits. This > will change the meaning of exit codes to: > 0 - Succeeded, diff is empty (no changes) > 1 - Errored > 2 - Succeeded, there is a diff
This commit is contained in:
16
.drone.yml
16
.drone.yml
@@ -34,7 +34,7 @@ steps:
|
|||||||
- name: terraform plan
|
- name: terraform plan
|
||||||
image: hashicorp/terraform:1.1.8
|
image: hashicorp/terraform:1.1.8
|
||||||
commands:
|
commands:
|
||||||
- terraform plan -var-file ci.tfvars -out .tfplan
|
- terraform plan $([[ $${DRONE_BUILD_EVENT} = cron ]] && echo "--detailed-exit-code") -var-file ci.tfvars -out .tfplan
|
||||||
environment:
|
environment:
|
||||||
AWS_ACCESS_KEY_ID:
|
AWS_ACCESS_KEY_ID:
|
||||||
from_secret: terraform-aws-key-id
|
from_secret: terraform-aws-key-id
|
||||||
@@ -56,18 +56,6 @@ steps:
|
|||||||
image: hashicorp/terraform:1.1.8
|
image: hashicorp/terraform:1.1.8
|
||||||
commands:
|
commands:
|
||||||
- terraform apply .tfplan
|
- 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
|
|
||||||
TF_VAR_lawndale_dns_key_secret:
|
|
||||||
from_secret: lawndale-dns-key-secret
|
|
||||||
TF_VAR_lawndale_dns_key_algorithm:
|
|
||||||
from_secret: lawndale-dns-key-algorithm
|
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: kubernetes
|
type: kubernetes
|
||||||
@@ -92,6 +80,6 @@ steps:
|
|||||||
|
|
||||||
---
|
---
|
||||||
kind: signature
|
kind: signature
|
||||||
hmac: 1a1e96092143802284d04077f335273f767aeeb7122438b1538e170da4d35da5
|
hmac: 3fc2a7491b8914bbb9225195340bc9cf7ead5c3e7e25a847923c6ad78be405a2
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|||||||
Reference in New Issue
Block a user