Skip to content

Commit

Permalink
fix(output): disable terraform wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
Marius Boden authored and m4s-b3n committed Oct 25, 2023
1 parent 75cbecc commit c17c641
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 35 deletions.
96 changes: 67 additions & 29 deletions .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,16 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

test-setup:
name: Test Setup
test-pull-request:
name: Test Pull Request
runs-on: ubuntu-latest
needs:
- test-simple
if: ${{ github.event_name == 'pull_request' }}
strategy:
matrix:
terramate-version: ["0.4.2", "latest"]
terraform-version: ["1.5.7", "latest"]
terraform-plan-file: ["out.tfplan", "plan.out"]
tmp-file: ["tmp.txt", "file.tmp"]
terramate-args: ["--changed", ""]
comment-pull-request: ["true", "false"]
cleanup: ["true", "false"]
fail-fast: true
steps:
- name: Checkout
Expand All @@ -47,22 +46,23 @@ jobs:
- name: Test
uses: "./"
with:
terraform-version: ${{ matrix.terraform-version }}
terraform-plan-file: ${{ matrix.terraform-plan-file }}
terramate-args: ${{ matrix.terramate-args }}
comment-pull-request: ${{ matrix.comment-pull-request }}
github-token: ${{ secrets.GITHUB_TOKEN }}

test-args:
name: Test Arguments
test-setup:
name: Test Setup
runs-on: ubuntu-latest
needs:
- test-simple
strategy:
matrix:
terramate-args: ["--changed", ""]
terraform-common-args: ["-no-color", ""]
terraform-init-args: ["-upgrade", ""]
terraform-validate-args: ["-json", ""]
terraform-plan-args: ["-parallelism=3", ""]
terraform-apply-args: ["-parallelism=2", ""]
terraform-destroy-args: ["-compact-warnings", ""]
go-version: ["1.17", "latest"]
terramate-version: ["v0.4.2", "latest"]
terraform-version: ["1.5.7", "latest"]
terraform-plan-file: ["out.tfplan", "plan.out"]
tmp-file: ["tmp.txt", "file.tmp"]
cleanup: ["true", "false"]
fail-fast: true
steps:
- name: Checkout
Expand All @@ -73,20 +73,19 @@ jobs:
- name: Test
uses: "./"
with:
terramate-args: ${{ matrix.terramate-args }}
terraform-common-args: ${{ matrix.terraform-common-args }}
terraform-init-args: ${{ matrix.terraform-init-args }}
terraform-validate-args: ${{ matrix.terraform-validate-args }}
terraform-plan-args: ${{ matrix.terraform-plan-args }}
terraform-apply-args: ${{ matrix.terraform-apply-args }}
terraform-destroy-args: ${{ matrix.terraform-destroy-args }}
apply: true
destroy: true
github-token: ${{ secrets.GITHUB_TOKEN }}
go-version: ${{ matrix.go-version }}
terramate-version: ${{ matrix.terramate-version }}
terraform-version: ${{ matrix.terraform-version }}
terraform-plan-file: ${{ matrix.terraform-plan-file }}
temp-file: ${{ matrix.tmp-file }}
cleanup: ${{ matrix.cleanup }}
comment-pull-request: false

test-jobs:
name: Test Jobs
runs-on: ubuntu-latest
needs:
- test-setup
strategy:
matrix:
lint: ["true", "false"]
Expand All @@ -110,7 +109,7 @@ jobs:
plan: ${{ matrix.plan }}
apply: ${{ matrix.apply }}
destroy: ${{ matrix.destroy }}
github-token: ${{ secrets.GITHUB_TOKEN }}
comment-pull-request: false
- name: Test With Init Only
uses: "./"
with:
Expand All @@ -122,6 +121,7 @@ jobs:
apply: ${{ matrix.apply }}
destroy: ${{ matrix.destroy }}
github-token: ${{ secrets.GITHUB_TOKEN }}
comment-pull-request: false
- name: Test Without Setup And Init
uses: "./"
with:
Expand All @@ -133,6 +133,44 @@ jobs:
apply: ${{ matrix.apply }}
destroy: ${{ matrix.destroy }}
github-token: ${{ secrets.GITHUB_TOKEN }}
comment-pull-request: false

test-args:
name: Test Arguments
runs-on: ubuntu-latest
needs:
- test-jobs
strategy:
matrix:
terramate-args: ["--changed", ""]
terraform-common-args: ["-no-color", ""]
terraform-init-args: ["-upgrade", ""]
terraform-validate-args: ["-json", ""]
terraform-plan-args: ["-parallelism=3", ""]
terraform-show-args: ["-no-color", ""]
terraform-apply-args: ["-parallelism=2", ""]
terraform-destroy-args: ["-compact-warnings", ""]
fail-fast: true
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Test
uses: "./"
with:
terramate-args: ${{ matrix.terramate-args }}
terraform-common-args: ${{ matrix.terraform-common-args }}
terraform-init-args: ${{ matrix.terraform-init-args }}
terraform-validate-args: ${{ matrix.terraform-validate-args }}
terraform-plan-args: ${{ matrix.terraform-plan-args }}
terraform-show-args: ${{ matrix.terraform-plan-args }}
terraform-apply-args: ${{ matrix.terraform-apply-args }}
terraform-destroy-args: ${{ matrix.terraform-destroy-args }}
apply: true
destroy: true
comment-pull-request: false

release:
name: Release
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# ci
out.tfplan
pr-comment.txt
plan.out
tmp.txt
file.tmp
_terramate_generated_*
.terraform.lock.hcl
.tools-version
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
apply: true
```
>Note: If you use terramate with a [git config](https://terramate.io/docs/cli/configuration/#terramate-config-git-block-schema) tracking uncommited files add the `terraform-plan-file` and `temp-file` to yout `.gitignore` file to prevent ci errors. See the [default filenames](#inputs) if you do not specify different within your workflow.
>Note: If you use terramate with a [git config](https://terramate.io/docs/cli/configuration/#terramate-config-git-block-schema) tracking uncommited files add the `terraform-plan-file` and `temp-file` to your `.gitignore` file to prevent errors. See the [default filenames](#inputs) if you do not specify different within your workflow.

## Inputs

Expand Down
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ runs:
if: ${{ inputs.setup == 'true' }}
uses: hashicorp/setup-terraform@v2
with:
terraform_wrapper: false
terraform_version: ${{ inputs.terraform-version }}
- name: Lint
if: ${{ inputs.lint == 'true' }}
Expand Down Expand Up @@ -174,6 +175,7 @@ runs:
github.event_name == 'pull_request'
}}
run: |
set +x
if [[ -z '${{ steps.list.outputs.stdout }}' ]]; then
echo >>${{ inputs.temp-file }} '### No changed stacks.'
cat ${{ inputs.temp-file }} >>$GITHUB_STEP_SUMMARY
Expand All @@ -191,7 +193,9 @@ runs:
-- terraform show \
${{ inputs.terraform-common-args }} \
${{ inputs.terraform-show-args }} \
${{ inputs.terraform-plan-file }} 2>/dev/null >>${{ inputs.temp-file }}
${{ inputs.terraform-plan-file }} \
2>&1 \
>>${{ inputs.temp-file }}
echo >>${{ inputs.temp-file }} '```'
cat ${{ inputs.temp-file }} >>$GITHUB_STEP_SUMMARY
fi
Expand Down
8 changes: 5 additions & 3 deletions terramate.tm.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ terramate {

config {
git {
check_untracked = false
check_uncommitted = false
check_remote = false
default_branch = "main"
default_remote = "origin"
check_untracked = true
check_uncommitted = true
check_remote = true
}
}
}

0 comments on commit c17c641

Please sign in to comment.