Skip to content

Commit

Permalink
chore: update and use terramate 0.8.0 (#156)
Browse files Browse the repository at this point in the history
- update Terramate to v0.8.0
- allow manual drift runs
- use new short cloud sync options in scripts and run
- fix preview link to Terramate Cloud
  • Loading branch information
soerenmartius authored Apr 27, 2024
2 parents e59e8c3 + f37131c commit 5c242a9
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 19 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/drift-detection.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: Scheduled Terraform Drift Detection

on:
workflow_dispatch:
schedule:
# Run this workflow at the top of every hour
- cron: '0 * * * *'
- cron: "0 * * * *"

jobs:
drift-detection:
Expand Down Expand Up @@ -82,7 +83,7 @@ jobs:
terramate script run \
-C stacks \
--tags reconcile \
--cloud-status=drifted \
--status=drifted \
--parallel 5 \
--continue-on-error \
-- \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:
run: |
echo >>pr-comment.txt "## Preview of Terraform changes in ${{ github.event.pull_request.head.sha }}"
echo >>pr-comment.txt
echo >>pr-comment.txt "[:mag: View Details on Terramate Cloud]($(cat stacks/preview_url.txt))"
echo >>pr-comment.txt "[:mag: View Details on Terramate Cloud](https://cloud.terramate.io/o/terramate-demo/review-requests)"
echo >>pr-comment.txt
echo >>pr-comment.txt "### Changed Stacks"
echo >>pr-comment.txt
Expand Down Expand Up @@ -146,7 +146,7 @@ jobs:
run: |
echo >>pr-comment.txt "## Preview of Terraform changes in ${{ github.event.pull_request.head.sha }}"
echo >>pr-comment.txt
echo >>pr-comment.txt "[:mag: View Details on Terramate Cloud]($(cat stacks/preview_url.txt))"
echo >>pr-comment.txt "[:mag: View Details on Terramate Cloud](https://cloud.terramate.io/o/terramate-demo/review-requests)"
echo >>pr-comment.txt
echo >>pr-comment.txt "### Changed Stacks"
echo >>pr-comment.txt
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
trigger {
ctime = 1714148293
reason = "Created using Terramate CLI without setting specific reason."
type = changed
context = stack
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
trigger {
ctime = 1714148293
reason = "Created using Terramate CLI without setting specific reason."
type = changed
context = stack
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
trigger {
ctime = 1714148293
reason = "Created using Terramate CLI without setting specific reason."
type = changed
context = stack
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
trigger {
ctime = 1714148293
reason = "Created using Terramate CLI without setting specific reason."
type = changed
context = stack
}
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
terraform 1.7.5
terramate 0.6.3
terramate 0.8.0
pre-commit 3.6.2
4 changes: 2 additions & 2 deletions scripts/script_terraform_deploy.tm
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ script "terraform" "deploy" {
["terraform", "validate"],
["terraform", "plan", "-out", "plan.tfplan", "-lock=false"],
["terraform", "apply", "-input=false", "-auto-approve", "-lock-timeout=5m", "plan.tfplan", {
cloud_sync_deployment = true
cloud_sync_terraform_plan_file = "plan.tfplan"
sync_deployment = true
terraform_plan_file = "plan.tfplan"
}],
]
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/script_terraform_detect_drift.tm
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ script "terraform" "detect-drift" {
commands = [
["terraform", "init", "-lock-timeout=5m"],
["terraform", "plan", "-out", "drift.tfplan", "-detailed-exitcode", "-lock=false", {
cloud_sync_drift_status = true
cloud_sync_terraform_plan_file = "drift.tfplan"
sync_drift_status = true
terraform_plan_file = "drift.tfplan"
}],
]
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/script_terraform_preview.tm
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ script "terraform" "preview" {
["terraform", "init", "-lock-timeout=5m"],
["terraform", "validate"],
["terraform", "plan", "-out", "preview.tfplan", "-detailed-exitcode", "-lock=false", {
cloud_sync_preview = true
cloud_sync_terraform_plan_file = "preview.tfplan"
sync_preview = true
terraform_plan_file = "preview.tfplan"
}],
]
}
Expand Down
16 changes: 8 additions & 8 deletions workflows.tm.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ script "terraform" "preview" {
commands = [
["terraform", "validate"],
["terraform", "plan", "-out", "out.tfplan", "-detailed-exitcode", "-lock=false", {
cloud_sync_preview = true
cloud_sync_terraform_plan_file = "out.tfplan"
sync_preview = true
terraform_plan_file = "out.tfplan"
}],
]
}
Expand All @@ -33,8 +33,8 @@ script "terraform" "deploy" {
["terraform", "validate"],
["terraform", "plan", "-out", "out.tfplan", "-lock=false"],
["terraform", "apply", "-input=false", "-auto-approve", "-lock-timeout=5m", "out.tfplan", {
cloud_sync_deployment = true
cloud_sync_terraform_plan_file = "out.tfplan"
sync_deployment = true
terraform_plan_file = "out.tfplan"
}],
]
}
Expand All @@ -47,8 +47,8 @@ script "terraform" "drift" "detect" {
job {
commands = [
["terraform", "plan", "-out", "out.tfplan", "-detailed-exitcode", "-lock=false", {
cloud_sync_drift_status = true
cloud_sync_terraform_plan_file = "out.tfplan"
sync_drift_status = true
terraform_plan_file = "out.tfplan"
}],
]
}
Expand All @@ -61,8 +61,8 @@ script "terraform" "drift" "reconcile" {
job {
commands = [
["terraform", "plan", "-out", "drift.tfplan", "-detailed-exitcode", "-lock=false", {
cloud_sync_drift_status = true
cloud_sync_terraform_plan_file = "drift.tfplan"
sync_drift_status = true
terraform_plan_file = "drift.tfplan"
}],
]
}
Expand Down

0 comments on commit 5c242a9

Please sign in to comment.