Skip to content

Commit

Permalink
Trigger vpc (#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
soerenmartius authored Apr 23, 2024
2 parents bbf50db + d00f382 commit c5b50f3
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 34 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ jobs:
- name: Run Terraform init on all changed stacks
if: steps.list-changed.outputs.stdout
run: |
terramate run-script \
terramate script run \
-C stacks \
--parallel 1
--changed
--parallel 1 \
--changed \
terraform init
env:
GITHUB_TOKEN: ${{ github.token }}
Expand All @@ -77,9 +77,9 @@ jobs:
id: deploy
if: steps.list-changed.outputs.stdout
run: |
terramate run-script \
terramate script run \
-C stacks \
--parallel 5
--parallel 5 \
--changed \
terraform deploy
env:
Expand All @@ -88,10 +88,10 @@ jobs:
- name: Run drift detection
if: steps.list-changed.outputs.stdout && ! cancelled() && steps.deploy.outcome != 'skipped'
run: |
terramate run-script \
terramate script run \
-C stacks \
--parallel 5
--parallel 5 \
--changed \
terraform detect-drift
terraform drift detect
env:
GITHUB_TOKEN: ${{ github.token }}
10 changes: 5 additions & 5 deletions .github/workflows/drift-detection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ jobs:
- name: Run Terraform init on all stacks
if: steps.list-drifted.outputs.stdout
run: |
terramate run-script \
terramate script run \
-C stacks \
--parallel 1
--parallel 1 \
terraform init
env:
GITHUB_TOKEN: ${{ github.token }}
Expand All @@ -77,7 +77,7 @@ jobs:
if: steps.list-drifted.outputs.stdout
id: drift-detect
run: |
terramate run-script \
terramate script run \
-C stacks \
--parallel 5 \
--continue-on-error \
Expand All @@ -90,10 +90,10 @@ jobs:
if: steps.list-drifted.outputs.stdout
id: drift-reconcile
run: |
terramate run-script \
terramate script run \
-C stacks \
--tags reconcile \
--parallel 5
--parallel 5 \
--continue-on-error \
-- \
terraform drift reconcile
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,18 @@ jobs:
- name: Run Terraform init on all changed stacks
if: steps.list-changed.outputs.stdout
run: |
terramate run-script \
terramate script run \
-C stacks \
--changed
--parallel 1
--changed \
--parallel 1 \
terraform init
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Plan Terraform changes in changed stacks
if: steps.list-changed.outputs.stdout
run: |
terramate run-script \
terramate script run \
-C stacks \
--changed \
--parallel 5 \
Expand Down
50 changes: 33 additions & 17 deletions workflows.tm.hcl
Original file line number Diff line number Diff line change
@@ -1,12 +1,35 @@
script "terraform" "init" {
name = "Terraform Init"
description = "Downloads the required provider plugins and modules and setting up the backend"

job {
commands = [
["terraform", "init", "-lock-timeout=5m"],
]
}
}

script "terraform" "preview" {
name = "Terraform Deployment Preview"
description = "Create a preview of Terraform Changes and synchronize it to Terramate Cloud."

job {
commands = [
["terraform", "validate"],
["terraform", "plan", "-out", "out.tfplan", "-detailed-exitcode", "-lock=false", {
cloud_sync_preview = true
cloud_sync_terraform_plan_file = "out.tfplan"
}],
]
}
}

script "terraform" "deploy" {
name = "Terraform Deployment"
description = "Run a full Terraform deployment cycle and synchronize the result to Terramate Cloud."

job {
# name = "Terraform Apply"
# description = "Initialize, validate, plan, and apply Terraform changes."
commands = [
["terraform", "init", "-lock-timeout=5m"],
["terraform", "validate"],
["terraform", "plan", "-out", "out.tfplan", "-lock=false"],
["terraform", "apply", "-input=false", "-auto-approve", "-lock-timeout=5m", "out.tfplan", {
Expand All @@ -17,15 +40,12 @@ script "terraform" "deploy" {
}
}

script "terraform" "detect-drift" {
script "terraform" "drift" "detect" {
name = "Terraform Drift Check"
description = "Detect drifts in Terraform configuration and synchronize it to Terramate Cloud."

job {
# name = "Terraform Plan"
# description = "Initialize, validate, and plan Terraform changes."
commands = [
["terraform", "init", "-lock-timeout=5m"],
["terraform", "plan", "-out", "out.tfplan", "-detailed-exitcode", "-lock=false", {
cloud_sync_drift_status = true
cloud_sync_terraform_plan_file = "out.tfplan"
Expand All @@ -34,19 +54,15 @@ script "terraform" "detect-drift" {
}
}

script "terraform" "preview" {
name = "Terraform Deployment Preview"
description = "Create a preview of Terraform Changes and synchronize it to Terramate Cloud."
script "terraform" "drift" "reconcile" {
name = "Terraform Drift Reconciliation"
description = "Reconciles drifts in all changed stacks."

job {
# name = "Terraform Plan"
# description = "Initialize, validate, and plan Terraform changes."
commands = [
["terraform", "init", "-lock-timeout=5m"],
["terraform", "validate"],
["terraform", "plan", "-out", "out.tfplan", "-detailed-exitcode", "-lock=false", {
cloud_sync_preview = true
cloud_sync_terraform_plan_file = "out.tfplan"
["terraform", "plan", "-out", "drift.tfplan", "-detailed-exitcode", "-lock=false", {
cloud_sync_drift_status = true
cloud_sync_terraform_plan_file = "drift.tfplan"
}],
]
}
Expand Down

0 comments on commit c5b50f3

Please sign in to comment.