Skip to content

Commit

Permalink
Revert "feat: Add OpenTofu" (#159)
Browse files Browse the repository at this point in the history
Reverts #157
  • Loading branch information
mariux authored May 3, 2024
2 parents 754fce3 + 9ac5377 commit a722008
Show file tree
Hide file tree
Showing 38 changed files with 19 additions and 199 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ jobs:
asdf plugin add terraform
asdf install terraform
- name: Install OpenTofu with asdf
run: |
asdf plugin add opentofu
asdf install opentofu
### Check for changed stacks

- name: List changed stacks
Expand Down Expand Up @@ -74,7 +69,7 @@ jobs:
-C stacks \
--parallel 1 \
--changed \
init
terraform init
env:
GITHUB_TOKEN: ${{ github.token }}

Expand All @@ -86,7 +81,7 @@ jobs:
-C stacks \
--parallel 5 \
--changed \
deploy
terraform deploy
env:
GITHUB_TOKEN: ${{ github.token }}

Expand All @@ -97,6 +92,6 @@ jobs:
-C stacks \
--parallel 5 \
--changed \
drift detect
terraform drift detect
env:
GITHUB_TOKEN: ${{ github.token }}
11 changes: 3 additions & 8 deletions .github/workflows/drift-detection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ jobs:
asdf plugin add terraform
asdf install terraform
- name: Install OpenTofu with asdf
run: |
asdf plugin add opentofu
asdf install opentofu
### Configure cloud credentials

- name: Configure AWS credentials
Expand All @@ -66,7 +61,7 @@ jobs:
terramate script run \
-C stacks \
--parallel 1 \
init
terraform init
env:
GITHUB_TOKEN: ${{ github.token }}

Expand All @@ -78,7 +73,7 @@ jobs:
--parallel 5 \
--continue-on-error \
-- \
drift detect
terraform drift detect
env:
GITHUB_TOKEN: ${{ github.token }}

Expand All @@ -92,6 +87,6 @@ jobs:
--parallel 5 \
--continue-on-error \
-- \
drift reconcile
terraform drift reconcile
env:
GITHUB_TOKEN: ${{ github.token }}
17 changes: 3 additions & 14 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ jobs:
asdf plugin add terraform
asdf install terraform
- name: Install OpenTofu with asdf
run: |
asdf plugin add opentofu
asdf install opentofu
### Linting

- name: Check Terramate formatting
Expand Down Expand Up @@ -95,7 +90,7 @@ jobs:
-C stacks \
--changed \
--parallel 1 \
init
terraform init
env:
GITHUB_TOKEN: ${{ github.token }}

Expand All @@ -108,7 +103,7 @@ jobs:
--parallel 5 \
--continue-on-error \
-- \
preview
terraform preview
env:
GITHUB_TOKEN: ${{ github.token }}

Expand All @@ -131,15 +126,9 @@ jobs:
echo >>pr-comment.txt "#### Terraform Plan"
echo >>pr-comment.txt
echo >>pr-comment.txt '```terraform'
terramate run -C stacks/terraform --changed -- terraform show -no-color out.tfplan |& dd bs=1024 count=248 >>pr-comment.txt
terramate run -C stacks --changed -- terraform show -no-color out.tfplan |& dd bs=1024 count=248 >>pr-comment.txt
[ "${PIPESTATUS[0]}" == "141" ] && sed -i 's/#### Terraform Plan/#### :warning: Terraform Plan truncated: please check console output :warning:/' pr-comment.txt
echo >>pr-comment.txt '```'
echo >>pr-comment.txt "#### OpenTofu Plan"
echo >>pr-comment.txt
echo >>pr-comment.txt '```terraform'
terramate run -C stacks/opentofu --changed -- tofu show -no-color out.tfplan |& dd bs=1024 count=248 >>pr-comment.txt
[ "${PIPESTATUS[0]}" == "141" ] && sed -i 's/#### OpenTofu Plan/#### :warning: OpenTofu Plan truncated: please check console output :warning:/' pr-comment.txt
echo >>pr-comment.txt '```'
cat pr-comment.txt >>$GITHUB_STEP_SUMMARY
- name: Generate preview when no stacks changed
Expand Down
1 change: 0 additions & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
terraform 1.7.5
terramate 0.8.0
pre-commit 3.6.2
opentofu 1.6.2
2 changes: 1 addition & 1 deletion _bootstrap/terraform-state-bucket/config.tm.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ generate_hcl "_main.tf" {
}

resource "aws_dynamodb_table" "terraform-lock" {
name = tm_try(global.terraform.backend.dyanmodb_table, "terraform-lock")
name = tm_try(global.terraform.backend.dyanmodb_table, "terraform_state")
read_capacity = 5
write_capacity = 5
hash_key = "LockID"
Expand Down
5 changes: 3 additions & 2 deletions config.tm.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ globals "terraform" {
}

globals "terraform" "backend" {
bucket = "terramate-example-terraform-state-backend"
region = "us-east-1"
bucket = "terramate-example-terraform-state-backend"
dyanmodb_table = "terraform-lock"
region = "us-east-1"
}

globals "aws" "oidc" {
Expand Down
2 changes: 1 addition & 1 deletion imports/mixins/backend.tm.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ generate_hcl "backend.tf" {
backend "s3" {
region = global.terraform.backend.region
bucket = global.terraform.backend.bucket
key = tm_try(global.terraform.backend.key, "terraform/stacks/by-id/${terramate.stack.id}/terraform.tfstate")
key = "terraform/stacks/by-id/${terramate.stack.id}/terraform.tfstate"
encrypt = true
dynamodb_table = tm_try(global.terraform.backend.dyanmodb_table, "terraform-lock")
}
Expand Down
18 changes: 0 additions & 18 deletions scripts/script_tofu_deploy.tm

This file was deleted.

16 changes: 0 additions & 16 deletions scripts/script_tofu_detect_drift.tm

This file was deleted.

17 changes: 0 additions & 17 deletions scripts/script_tofu_preview.tm

This file was deleted.

File renamed without changes.
7 changes: 0 additions & 7 deletions stacks/opentofu/config.tm.hcl

This file was deleted.

11 changes: 0 additions & 11 deletions stacks/opentofu/empty/backend.tf

This file was deleted.

5 changes: 0 additions & 5 deletions stacks/opentofu/empty/stack.tm.hcl

This file was deleted.

16 changes: 0 additions & 16 deletions stacks/opentofu/empty/terraform.tf

This file was deleted.

69 changes: 0 additions & 69 deletions stacks/opentofu/workflows.tm.hcl

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions stacks/terraform/workflows.tm.hcl → workflows.tm.hcl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
script "init" {
script "terraform" "init" {
name = "Terraform Init"
description = "Downloads the required provider plugins and modules and setting up the backend"

Expand All @@ -9,7 +9,7 @@ script "init" {
}
}

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

Expand All @@ -24,7 +24,7 @@ script "preview" {
}
}

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

Expand All @@ -40,7 +40,7 @@ script "deploy" {
}
}

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

Expand All @@ -54,7 +54,7 @@ script "drift" "detect" {
}
}

script "drift" "reconcile" {
script "terraform" "drift" "reconcile" {
name = "Terraform Drift Reconciliation"
description = "Reconciles drifts in all changed stacks."

Expand Down

0 comments on commit a722008

Please sign in to comment.