diff --git a/.gitattributes b/.gitattributes index 3fcee21f27..50335fced2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,3 @@ *.tm linguist-language=HCL +* text=auto +_*.tf text eol=lf diff --git a/.github/workflows/ci-experimental.yml b/.github/workflows/ci-experimental.yml index bc3d084c0d..abc3e67b87 100644 --- a/.github/workflows/ci-experimental.yml +++ b/.github/workflows/ci-experimental.yml @@ -41,7 +41,7 @@ jobs: run: make build - name: make generate - run: make generate + run: make generate && git diff - name: make test run: make test diff --git a/.github/workflows/ci.yml b/.github/workflows/ci-sync-deployment.yml similarity index 69% rename from .github/workflows/ci.yml rename to .github/workflows/ci-sync-deployment.yml index b558007b40..201636759b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci-sync-deployment.yml @@ -8,43 +8,28 @@ on: branches: - main - v0.4.x - pull_request: + - v0.6.x + - v0.9.x jobs: - checks: - runs-on: ubuntu-20.04 - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - uses: actions/setup-go@v4 - with: - go-version: '1.21' - - - name: build Terramate - run: make build - - - name: checking go mod tidyness - run: ./bin/terramate run --tags golang --changed -- make mod/check - - - name: linting code - run: ./bin/terramate run --tags golang --changed -- make lint - - - name: checking license on source code - run: ./bin/terramate run --tags golang --changed -- make license/check - build_test: name: Build and Test - runs-on: ${{ matrix.os }} + runs-on: ${{ matrix.os.value }} + permissions: - id-token: write # This is required for requesting the JWT - contents: read # This is required for actions/checkout + id-token: write + contents: read + pull-requests: write + checks: read strategy: + fail-fast: false matrix: - os: ["ubuntu-20.04", "macos-13"] + os: + - name: ubuntu-focal + value: "ubuntu-20.04" + - name: macos-ventura + value: "macos-13" go: ["1.21"] steps: @@ -52,7 +37,7 @@ jobs: with: ref: ${{ github.head_ref }} fetch-depth: 0 - + - uses: actions/setup-go@v5 with: go-version: ${{ matrix.go }} @@ -63,21 +48,59 @@ jobs: tofu_wrapper: false github_token: ${{ secrets.GITHUB_TOKEN }} + - uses: hashicorp/setup-terraform@v3 + with: + terraform_version: "1.7.5" + terraform_wrapper: false + + - name: Install Terramate + uses: terramate-io/terramate-action@i4k-fix-macos + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: build Terramate - run: make build + run: make build && cp -v ./bin/terramate /usr/local/bin/terramate-bin - name: make generate run: make generate - - name: make test + ### Check for changed stacks + + - name: List changed stacks + id: list + run: terramate list --tags golang --changed + + ### Linting + + - name: linting code + if: steps.list.outputs.stdout + run: make lint + + - name: checking go mod tidyness + if: steps.list.outputs.stdout + run: make mod/check + + - name: checking license on source code + if: steps.list.outputs.stdout + run: make license/check + + - name: Check Terramate formatting + run: terramate fmt --check + + - name: Check Terraform formatting + if: steps.list.outputs.stdout + run: terraform fmt -recursive -check -diff + + ### Run the Terramate tests and create a Cloud deployment + + - name: Run Terraform deployment on changed + if: steps.list.outputs.stdout timeout-minutes: 30 - run: ./bin/terramate run --tags golang --changed -- make test + run: terramate script run --changed --tags golang --target ${{ matrix.os.name }} --parallel 12 deploy env: + GITHUB_TOKEN: ${{ github.token }} TM_TEST_TERRAFORM_REQUIRED_VERSION: "1.7.5" - - name: check cloud info - run: ./bin/terramate run --tags golang --changed -- ./bin/terramate -vv experimental cloud info - gh_integration_test: name: GHA Integration Test @@ -98,7 +121,7 @@ jobs: run: make build - name: make test/ci - run: ./bin/terramate run --tags golang --changed -- make test/ci + run: make test/ci release_dry_run: name: Release Dry Run @@ -158,7 +181,6 @@ jobs: cosign verify-blob --key cosign.pub --signature ${{ env.SIGNATURE_FILE }} ${{ env.CHECKSUM_FILE }} ci: needs: - - checks - build_test - gh_integration_test runs-on: ubuntu-20.04 diff --git a/.github/workflows/ci-sync-preview.yml b/.github/workflows/ci-sync-preview.yml new file mode 100644 index 0000000000..7c3cf93e55 --- /dev/null +++ b/.github/workflows/ci-sync-preview.yml @@ -0,0 +1,238 @@ +# Copyright 2023 Terramate GmbH +# SPDX-License-Identifier: MPL-2.0 + +name: ci + +on: + pull_request: + +jobs: + build_test: + name: Build and Test + runs-on: ${{ matrix.os.value }} + + permissions: + id-token: write # This is required for requesting the JWT + contents: read # This is required for actions/checkout + pull-requests: write + checks: read + + strategy: + fail-fast: false + matrix: + os: + - name: ubuntu-focal + value: "ubuntu-20.04" + - name: macos-ventura + value: "macos-13" + go: ["1.21"] + + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + fetch-depth: 0 + + - uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go }} + + - name: check all packages with tests are Terramate Stacks + run: ./hack/check-stacks.sh + + - uses: opentofu/setup-opentofu@v1 + with: + tofu_version: 1.6.2 + tofu_wrapper: false + github_token: ${{ secrets.GITHUB_TOKEN }} + + - uses: hashicorp/setup-terraform@v3 + with: + terraform_version: "1.7.5" + terraform_wrapper: false + + - name: Install Terramate + uses: terramate-io/terramate-action@i4k-fix-macos + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: build Terramate + run: make build && cp -v ./bin/terramate /usr/local/bin/terramate-bin + + - name: make generate + run: make generate + + ### Check for changed stacks + + - name: List changed stacks + id: list + run: terramate list --tags golang --changed + + ### Linting + + - name: linting code + if: steps.list.outputs.stdout + run: make lint + + - name: checking go mod tidyness + if: steps.list.outputs.stdout + run: make mod/check + + - name: checking license on source code + if: steps.list.outputs.stdout + run: make license/check + + - name: Check Terramate formatting + run: terramate fmt --check + + - name: Check Terraform formatting + if: steps.list.outputs.stdout + run: terraform fmt -recursive -check -diff + + ### Run the Terramate tests and create a Cloud Preview + + - name: Temporary PR Preview Link generation + run: echo >preview_url.txt "https://cloud.terramate.io/o/terramate-tests/review-requests" + + - name: Run Terraform preview on changed + if: steps.list.outputs.stdout + timeout-minutes: 30 + run: terramate script run --changed --tags golang --target ${{ matrix.os.name }} --parallel 12 preview + env: + GITHUB_TOKEN: ${{ github.token }} + TM_TEST_TERRAFORM_REQUIRED_VERSION: "1.7.5" + + ### Update Pull Request comment + + - name: Generate Preview Comment + if: steps.list.outputs.stdout + id: comment + run: | + echo >>pr-comment.txt "## Preview of ${{ matrix.os.name }}/go${{matrix.go}} tests in ${{ github.event.pull_request.head.sha }}" + echo >>pr-comment.txt + echo >>pr-comment.txt "[:mag: View Details on Terramate Cloud]($(cat preview_url.txt))" + echo >>pr-comment.txt + echo >>pr-comment.txt "### " + echo >>pr-comment.txt + echo >>pr-comment.txt '```bash' + echo >>pr-comment.txt "${{ steps.list.outputs.stdout }}" + echo >>pr-comment.txt '```' + cat pr-comment.txt >>$GITHUB_STEP_SUMMARY + + - name: Inform about no Changed Stacks + if: success() && !steps.list.outputs.stdout + run: | + echo >>pr-comment.txt "## Preview of ${{ matrix.os.name }}/go${{matrix.go}} tests in ${{ github.event.pull_request.head.sha }}" + echo >>pr-comment.txt + echo >>pr-comment.txt "### Changed Stacks" + echo >>pr-comment.txt + echo >>pr-comment.txt 'No changed stacks, no detailed preview will be generated.' + cat pr-comment.txt >>$GITHUB_STEP_SUMMARY + + - name: Inform about failure + if: failure() + run: | + echo >>pr-comment.txt "## Preview of ${{ matrix.os.name }}/go${{matrix.go}} tests in ${{ github.event.pull_request.head.sha }}" + echo >>pr-comment.txt + echo >>pr-comment.txt "[:mag: View Details on Terramate Cloud]($(cat preview_url.txt))" + echo >>pr-comment.txt + echo >>pr-comment.txt "### Changed Stacks" + echo >>pr-comment.txt + echo >>pr-comment.txt '```bash' + echo >>pr-comment.txt "${{ steps.list.outputs.stdout }}" + echo >>pr-comment.txt '```' + echo >>pr-comment.txt ":boom: Generating preview failed. [Please see details on Terramate Cloud]($(cat preview_url.txt))" + cat pr-comment.txt >>$GITHUB_STEP_SUMMARY + + - name: Publish Plans for Changed Stacks + uses: marocchino/sticky-pull-request-comment@v2 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + header: preview-${{ matrix.os.name }}-go-${{matrix.go}} + path: pr-comment.txt + + gh_integration_test: + name: GHA Integration Test + + runs-on: "ubuntu-20.04" + + steps: + - uses: actions/checkout@v4 + with: + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + fetch-depth: 0 + + - uses: actions/setup-go@v5 + with: + go-version: '1.21' + + - name: build Terramate + run: make build + + - name: make test/ci + run: make test/ci + + release_dry_run: + name: Release Dry Run + + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v4 + with: + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + fetch-depth: 0 + - uses: actions/setup-go@v5 + with: + go-version: '1.21' + + - name: install cosign + run: go install github.com/sigstore/cosign/v2/cmd/cosign@v2.2.4 + - name: install goreleaser + run: | + curl -sL https://github.com/goreleaser/goreleaser-pro/releases/download/v1.14.0-pro/goreleaser-pro_Linux_x86_64.tar.gz -o /tmp/goreleaser.tar.gz + cd /tmp && tar -xzf goreleaser.tar.gz && chmod +x goreleaser + sudo mv /tmp/goreleaser /usr/local/bin/ + + - name: Create cosign.pub file + run: echo "${{ secrets.COSIGN_PUBLIC_KEY }}" > cosign.pub + + - name: release dry run + run: make release/dry-run + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GORELEASER_KEY: ${{ secrets.GORELEASER_API_KEY }} + FURY_TOKEN: ${{ secrets.FURY_TOKEN}} + COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD}} + COSIGN_PRIVATE_KEY: ${{secrets.COSIGN_PRIVATE_KEY }} + + - name: Locate checksum file + id: find_checksum + run: | + if [ -z "$(ls dist/*checksums.txt)" ]; then + echo "Error: Checksum file not found." + exit 1 + fi + echo "CHECKSUM_FILE=$(ls dist/*checksums.txt)" >> $GITHUB_ENV + + - name: Locate signature file + id: find_signature + run: | + if [ -z "$(ls dist/*checksum*.txt.sig)" ]; then + echo "Error: Signature file not found." + exit 1 + fi + echo "SIGNATURE_FILE=$(ls dist/*checksum*.txt.sig)" >> $GITHUB_ENV + + - name: Verify checksums with cosign + run: | + cosign verify-blob --key cosign.pub --signature ${{ env.SIGNATURE_FILE }} ${{ env.CHECKSUM_FILE }} + ci: + needs: + - build_test + - gh_integration_test + runs-on: ubuntu-20.04 + steps: + - run: echo "All jobs ran successfully" diff --git a/.gitignore b/.gitignore index 9ee7410dee..fc2604bade 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ coverage.txt cpu.prof mem.prof *.test +*.tfplan *.plan # Go Workspaces artifacts diff --git a/_test_mock.tf b/_test_mock.tf new file mode 100644 index 0000000000..a9edc5a99d --- /dev/null +++ b/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "terramate" { + content = "terramate" + filename = "${path.module}/mock-/.ignore" +} diff --git a/cloud/_test_mock.tf b/cloud/_test_mock.tf new file mode 100644 index 0000000000..80ddb4e269 --- /dev/null +++ b/cloud/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "cloud" { + content = "package cloud // import \"github.com/terramate-io/terramate/cloud\"" + filename = "${path.module}/mock-cloud.ignore" +} diff --git a/cloud/deployment/_test_mock.tf b/cloud/deployment/_test_mock.tf new file mode 100644 index 0000000000..3061829d28 --- /dev/null +++ b/cloud/deployment/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "deployment" { + content = "package deployment // import \"github.com/terramate-io/terramate/cloud/deployment\"" + filename = "${path.module}/mock-deployment.ignore" +} diff --git a/cloud/deployment/stack.tm.hcl b/cloud/deployment/stack.tm.hcl new file mode 100644 index 0000000000..5dcc01c239 --- /dev/null +++ b/cloud/deployment/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package deployment // import \"github.com/terramate-io/terramate/cloud/deployment\"" + description = "package deployment // import \"github.com/terramate-io/terramate/cloud/deployment\"" + tags = ["cloud", "deployment", "golang"] + id = "8f7fced1-1649-4c71-bdb1-5d861141a953" +} diff --git a/cloud/drift/_test_mock.tf b/cloud/drift/_test_mock.tf new file mode 100644 index 0000000000..1078cd6b3c --- /dev/null +++ b/cloud/drift/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "drift" { + content = "package drift // import \"github.com/terramate-io/terramate/cloud/drift\"" + filename = "${path.module}/mock-drift.ignore" +} diff --git a/cloud/drift/stack.tm.hcl b/cloud/drift/stack.tm.hcl new file mode 100644 index 0000000000..11bcfb89c0 --- /dev/null +++ b/cloud/drift/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package drift // import \"github.com/terramate-io/terramate/cloud/drift\"" + description = "package drift // import \"github.com/terramate-io/terramate/cloud/drift\"" + tags = ["cloud", "drift", "golang"] + id = "feadf9e7-6cee-4f5e-9f75-a91c98ce4679" +} diff --git a/cloud/preview/_test_mock.tf b/cloud/preview/_test_mock.tf new file mode 100644 index 0000000000..3fbc785dce --- /dev/null +++ b/cloud/preview/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "preview" { + content = "package preview // import \"github.com/terramate-io/terramate/cloud/preview\"" + filename = "${path.module}/mock-preview.ignore" +} diff --git a/cloud/preview/stack.tm.hcl b/cloud/preview/stack.tm.hcl new file mode 100644 index 0000000000..c92d4a80da --- /dev/null +++ b/cloud/preview/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package preview // import \"github.com/terramate-io/terramate/cloud/preview\"" + description = "package preview // import \"github.com/terramate-io/terramate/cloud/preview\"" + tags = ["cloud", "golang", "preview"] + id = "90d86bc8-5cac-4576-9241-cfa9f9adc93d" +} diff --git a/cloud/stack.tm.hcl b/cloud/stack.tm.hcl new file mode 100644 index 0000000000..a18f88b3ea --- /dev/null +++ b/cloud/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package cloud // import \"github.com/terramate-io/terramate/cloud\"" + description = "package cloud // import \"github.com/terramate-io/terramate/cloud\"" + tags = ["cloud", "golang"] + id = "1d457835-4401-4ed9-bbbf-d4676c0e9b0c" +} diff --git a/cloud/stack/_test_mock.tf b/cloud/stack/_test_mock.tf new file mode 100644 index 0000000000..ef16387b01 --- /dev/null +++ b/cloud/stack/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "stack" { + content = "package stack // import \"github.com/terramate-io/terramate/cloud/stack\"" + filename = "${path.module}/mock-stack.ignore" +} diff --git a/cloud/stack/stack.tm.hcl b/cloud/stack/stack.tm.hcl new file mode 100644 index 0000000000..e21454e75d --- /dev/null +++ b/cloud/stack/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package stack // import \"github.com/terramate-io/terramate/cloud/stack\"" + description = "package stack // import \"github.com/terramate-io/terramate/cloud/stack\"" + tags = ["cloud", "golang", "stack"] + id = "6b9cce64-2b44-43ed-bb2c-dc9525dd2585" +} diff --git a/cloud/testserver/_test_mock.tf b/cloud/testserver/_test_mock.tf new file mode 100644 index 0000000000..1ab824976d --- /dev/null +++ b/cloud/testserver/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "testserver" { + content = "package testserver // import \"github.com/terramate-io/terramate/cloud/testserver\"" + filename = "${path.module}/mock-testserver.ignore" +} diff --git a/cloud/testserver/cloudstore/_test_mock.tf b/cloud/testserver/cloudstore/_test_mock.tf new file mode 100644 index 0000000000..f13252c9dd --- /dev/null +++ b/cloud/testserver/cloudstore/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "cloudstore" { + content = "package cloudstore // import \"github.com/terramate-io/terramate/cloud/testserver/cloudstore\"" + filename = "${path.module}/mock-cloudstore.ignore" +} diff --git a/cloud/testserver/cloudstore/stack.tm.hcl b/cloud/testserver/cloudstore/stack.tm.hcl new file mode 100644 index 0000000000..4cc1322eb0 --- /dev/null +++ b/cloud/testserver/cloudstore/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package cloudstore // import \"github.com/terramate-io/terramate/cloud/testserver/cloudstore\"" + description = "package cloudstore // import \"github.com/terramate-io/terramate/cloud/testserver/cloudstore\"" + tags = ["cloud", "cloudstore", "golang", "testserver"] + id = "264e8e28-bddc-4244-a2c9-9dfb4e9cfd33" +} diff --git a/cloud/testserver/cmd/testserver/_test_mock.tf b/cloud/testserver/cmd/testserver/_test_mock.tf new file mode 100644 index 0000000000..04a58c2cee --- /dev/null +++ b/cloud/testserver/cmd/testserver/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "testserver" { + content = "Package main implements the cloudmock service." + filename = "${path.module}/mock-testserver.ignore" +} diff --git a/cloud/testserver/cmd/testserver/stack.tm.hcl b/cloud/testserver/cmd/testserver/stack.tm.hcl new file mode 100644 index 0000000000..8c565f8163 --- /dev/null +++ b/cloud/testserver/cmd/testserver/stack.tm.hcl @@ -0,0 +1,6 @@ +stack { + name = "Package main implements the cloudmock service." + description = "Package main implements the cloudmock service." + tags = ["cloud", "cmd", "golang", "testserver"] + id = "a78ef8cc-4dae-4eb4-8da3-fec38efa4104" +} diff --git a/cloud/testserver/stack.tm.hcl b/cloud/testserver/stack.tm.hcl new file mode 100644 index 0000000000..0cb8303977 --- /dev/null +++ b/cloud/testserver/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package testserver // import \"github.com/terramate-io/terramate/cloud/testserver\"" + description = "package testserver // import \"github.com/terramate-io/terramate/cloud/testserver\"" + tags = ["cloud", "golang", "testserver"] + id = "6f6e494b-d500-4024-95ef-b273f459b61c" +} diff --git a/cmd/terramate-ls/_test_mock.tf b/cmd/terramate-ls/_test_mock.tf new file mode 100644 index 0000000000..22fe5f07fb --- /dev/null +++ b/cmd/terramate-ls/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "terramate-ls" { + content = "Terramate-ls is a language server. For details on how to use it just run:" + filename = "${path.module}/mock-terramate-ls.ignore" +} diff --git a/cmd/terramate-ls/stack.tm.hcl b/cmd/terramate-ls/stack.tm.hcl new file mode 100644 index 0000000000..01c878d20f --- /dev/null +++ b/cmd/terramate-ls/stack.tm.hcl @@ -0,0 +1,6 @@ +stack { + name = "Terramate-ls is a language server. For details on how to use it just run:" + description = "Terramate-ls is a language server. For details on how to use it just run:" + tags = ["cmd", "golang", "terramate-ls"] + id = "9c987e01-fea1-49e8-a0a3-91c8e70f29f1" +} diff --git a/cmd/terramate/_test_mock.tf b/cmd/terramate/_test_mock.tf new file mode 100644 index 0000000000..84364f06c3 --- /dev/null +++ b/cmd/terramate/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "terramate" { + content = "Terramate is a tool for managing multiple Terraform stacks. Providing stack" + filename = "${path.module}/mock-terramate.ignore" +} diff --git a/cmd/terramate/cli/_test_mock.tf b/cmd/terramate/cli/_test_mock.tf new file mode 100644 index 0000000000..68132a482d --- /dev/null +++ b/cmd/terramate/cli/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "cli" { + content = "package cli // import \"github.com/terramate-io/terramate/cmd/terramate/cli\"" + filename = "${path.module}/mock-cli.ignore" +} diff --git a/cmd/terramate/cli/cliconfig/_test_mock.tf b/cmd/terramate/cli/cliconfig/_test_mock.tf new file mode 100644 index 0000000000..9fc08a8a05 --- /dev/null +++ b/cmd/terramate/cli/cliconfig/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "cliconfig" { + content = "package cliconfig // import \"github.com/terramate-io/terramate/cmd/terramate/cli/cliconfig\"" + filename = "${path.module}/mock-cliconfig.ignore" +} diff --git a/cmd/terramate/cli/cliconfig/stack.tm.hcl b/cmd/terramate/cli/cliconfig/stack.tm.hcl new file mode 100644 index 0000000000..7a74f56a46 --- /dev/null +++ b/cmd/terramate/cli/cliconfig/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package cliconfig // import \"github.com/terramate-io/terramate/cmd/terramate/cli/cliconfig\"" + description = "package cliconfig // import \"github.com/terramate-io/terramate/cmd/terramate/cli/cliconfig\"" + tags = ["cli", "cliconfig", "cmd", "golang", "terramate"] + id = "d9636c0a-f69c-47c7-8657-9ff5cdc454f3" +} diff --git a/cmd/terramate/cli/clitest/_test_mock.tf b/cmd/terramate/cli/clitest/_test_mock.tf new file mode 100644 index 0000000000..f076fe3afa --- /dev/null +++ b/cmd/terramate/cli/clitest/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "clitest" { + content = "package clitest // import \"github.com/terramate-io/terramate/cmd/terramate/cli/clitest\"" + filename = "${path.module}/mock-clitest.ignore" +} diff --git a/cmd/terramate/cli/clitest/stack.tm.hcl b/cmd/terramate/cli/clitest/stack.tm.hcl new file mode 100644 index 0000000000..1a97c51644 --- /dev/null +++ b/cmd/terramate/cli/clitest/stack.tm.hcl @@ -0,0 +1,6 @@ +stack { + name = "package clitest // import \"github.com/terramate-io/terramate/cmd/terramate/cli/clitest\"" + description = "package clitest // import \"github.com/terramate-io/terramate/cmd/terramate/cli/clitest\"" + tags = ["cli", "clitest", "cmd", "golang", "terramate"] + id = "29609032-7421-4c97-b26f-b84ba5d33d28" +} diff --git a/cmd/terramate/cli/cloud.go b/cmd/terramate/cli/cloud.go index 14c06b7a5c..45ad4bfac4 100644 --- a/cmd/terramate/cli/cloud.go +++ b/cmd/terramate/cli/cloud.go @@ -73,7 +73,7 @@ const ( // newCloudRequiredError creates an error indicating that a cloud login is required to use requested features. func newCloudRequiredError(requestedFeatures []string) *errors.DetailedError { - err := errors.D("This command uses Terramate Cloud features and requires you to be logged in.") + err := errors.D(clitest.CloudLoginRequiredMessage) for _, s := range requestedFeatures { err = err.WithDetailf(verbosity.V1, "%s", s) @@ -195,7 +195,7 @@ func (c *cli) cloudEnabled() bool { } func (c *cli) disableCloudFeatures(err error) { - log.Warn().Err(err).Msg(clitest.CloudDisablingMessage) + printer.Stderr.WarnWithDetails(clitest.CloudDisablingMessage, errors.E(err.Error())) c.cloud.disabled = true } diff --git a/cmd/terramate/cli/github/_test_mock.tf b/cmd/terramate/cli/github/_test_mock.tf new file mode 100644 index 0000000000..5f7f60b43e --- /dev/null +++ b/cmd/terramate/cli/github/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "github" { + content = "package github // import \"github.com/terramate-io/terramate/cmd/terramate/cli/github\"" + filename = "${path.module}/mock-github.ignore" +} diff --git a/cmd/terramate/cli/github/stack.tm.hcl b/cmd/terramate/cli/github/stack.tm.hcl new file mode 100644 index 0000000000..974aa0c03e --- /dev/null +++ b/cmd/terramate/cli/github/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package github // import \"github.com/terramate-io/terramate/cmd/terramate/cli/github\"" + description = "package github // import \"github.com/terramate-io/terramate/cmd/terramate/cli/github\"" + tags = ["cli", "cmd", "github", "golang", "terramate"] + id = "6347be57-01f6-47cf-871a-6a7afe89b553" +} diff --git a/cmd/terramate/cli/gitlab/_test_mock.tf b/cmd/terramate/cli/gitlab/_test_mock.tf new file mode 100644 index 0000000000..c35319bd11 --- /dev/null +++ b/cmd/terramate/cli/gitlab/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "gitlab" { + content = "package gitlab // import \"github.com/terramate-io/terramate/cmd/terramate/cli/gitlab\"" + filename = "${path.module}/mock-gitlab.ignore" +} diff --git a/cmd/terramate/cli/gitlab/stack.tm.hcl b/cmd/terramate/cli/gitlab/stack.tm.hcl new file mode 100644 index 0000000000..6daf904fab --- /dev/null +++ b/cmd/terramate/cli/gitlab/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package gitlab // import \"github.com/terramate-io/terramate/cmd/terramate/cli/gitlab\"" + description = "package gitlab // import \"github.com/terramate-io/terramate/cmd/terramate/cli/gitlab\"" + tags = ["cli", "cmd", "gitlab", "golang", "terramate"] + id = "9be406d8-ca18-48fb-ac5d-6c84efe8ff9d" +} diff --git a/cmd/terramate/cli/out/_test_mock.tf b/cmd/terramate/cli/out/_test_mock.tf new file mode 100644 index 0000000000..f55a816e24 --- /dev/null +++ b/cmd/terramate/cli/out/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "out" { + content = "package out // import \"github.com/terramate-io/terramate/cmd/terramate/cli/out\"" + filename = "${path.module}/mock-out.ignore" +} diff --git a/cmd/terramate/cli/out/stack.tm.hcl b/cmd/terramate/cli/out/stack.tm.hcl new file mode 100644 index 0000000000..c095efb90d --- /dev/null +++ b/cmd/terramate/cli/out/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package out // import \"github.com/terramate-io/terramate/cmd/terramate/cli/out\"" + description = "package out // import \"github.com/terramate-io/terramate/cmd/terramate/cli/out\"" + tags = ["cli", "cmd", "golang", "out", "terramate"] + id = "db0b206f-34f0-441a-814d-16a4c308183d" +} diff --git a/cmd/terramate/cli/stack.tm.hcl b/cmd/terramate/cli/stack.tm.hcl new file mode 100644 index 0000000000..5aeb3f7064 --- /dev/null +++ b/cmd/terramate/cli/stack.tm.hcl @@ -0,0 +1,6 @@ +stack { + name = "package cli // import \"github.com/terramate-io/terramate/cmd/terramate/cli\"" + description = "package cli // import \"github.com/terramate-io/terramate/cmd/terramate/cli\"" + tags = ["cli", "cmd", "golang", "terramate"] + id = "45fce01f-1d4a-4ebd-b1b2-558aea15d80c" +} diff --git a/cmd/terramate/stack.tm.hcl b/cmd/terramate/stack.tm.hcl new file mode 100644 index 0000000000..ced5158e79 --- /dev/null +++ b/cmd/terramate/stack.tm.hcl @@ -0,0 +1,6 @@ +stack { + name = "Terramate is a tool for managing multiple Terraform stacks. Providing stack" + description = "Terramate is a tool for managing multiple Terraform stacks. Providing stack" + tags = ["cmd", "golang", "terramate"] + id = "a79a1857-2b23-4e23-9d89-8a5d8ce0821a" +} diff --git a/cmd/tgdeps/_test_mock.tf b/cmd/tgdeps/_test_mock.tf new file mode 100644 index 0000000000..73479328e4 --- /dev/null +++ b/cmd/tgdeps/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "tgdeps" { + content = "Package main implements tgdeps." + filename = "${path.module}/mock-tgdeps.ignore" +} diff --git a/cmd/tgdeps/stack.tm.hcl b/cmd/tgdeps/stack.tm.hcl new file mode 100644 index 0000000000..eb1fe8ec7c --- /dev/null +++ b/cmd/tgdeps/stack.tm.hcl @@ -0,0 +1,6 @@ +stack { + name = "Package main implements tgdeps." + description = "Package main implements tgdeps." + tags = ["cmd", "golang", "tgdeps"] + id = "43e814fd-cbf4-49a1-b7bb-136df74f0a6b" +} diff --git a/config/_test_mock.tf b/config/_test_mock.tf new file mode 100644 index 0000000000..201b076fb2 --- /dev/null +++ b/config/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "config" { + content = "package config // import \"github.com/terramate-io/terramate/config\"" + filename = "${path.module}/mock-config.ignore" +} diff --git a/config/filter/_test_mock.tf b/config/filter/_test_mock.tf new file mode 100644 index 0000000000..ac3173196d --- /dev/null +++ b/config/filter/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "filter" { + content = "package filter // import \"github.com/terramate-io/terramate/config/filter\"" + filename = "${path.module}/mock-filter.ignore" +} diff --git a/config/filter/stack.tm.hcl b/config/filter/stack.tm.hcl new file mode 100644 index 0000000000..932ed9b0c0 --- /dev/null +++ b/config/filter/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package filter // import \"github.com/terramate-io/terramate/config/filter\"" + description = "package filter // import \"github.com/terramate-io/terramate/config/filter\"" + tags = ["config", "filter", "golang"] + id = "a0d54dc3-56d1-49d0-b9c9-4cb1af7c1ba8" +} diff --git a/config/stack.tm.hcl b/config/stack.tm.hcl new file mode 100644 index 0000000000..d087f103a7 --- /dev/null +++ b/config/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package config // import \"github.com/terramate-io/terramate/config\"" + description = "package config // import \"github.com/terramate-io/terramate/config\"" + tags = ["config", "golang"] + id = "68518a25-8e45-44ca-898b-f8671370e9f4" +} diff --git a/config/tag/_test_mock.tf b/config/tag/_test_mock.tf new file mode 100644 index 0000000000..8c772625ad --- /dev/null +++ b/config/tag/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "tag" { + content = "package tag // import \"github.com/terramate-io/terramate/config/tag\"" + filename = "${path.module}/mock-tag.ignore" +} diff --git a/config/tag/stack.tm.hcl b/config/tag/stack.tm.hcl new file mode 100644 index 0000000000..688ee802ae --- /dev/null +++ b/config/tag/stack.tm.hcl @@ -0,0 +1,6 @@ +stack { + name = "package tag // import \"github.com/terramate-io/terramate/config/tag\"" + description = "package tag // import \"github.com/terramate-io/terramate/config/tag\"" + tags = ["config", "golang", "tag"] + id = "aa13dddb-2969-4a78-99dd-d56c221f8b38" +} diff --git a/e2etests/cloud/_test_mock.tf b/e2etests/cloud/_test_mock.tf new file mode 100644 index 0000000000..843011771e --- /dev/null +++ b/e2etests/cloud/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "cloud" { + content = "cloud" + filename = "${path.module}/mock-cloud.ignore" +} diff --git a/e2etests/cloud/generate-e2e-testserver.tm b/e2etests/cloud/generate-e2e-testserver.tm index 17c379adc3..489e5f8bd5 100644 --- a/e2etests/cloud/generate-e2e-testserver.tm +++ b/e2etests/cloud/generate-e2e-testserver.tm @@ -1,9 +1,8 @@ // Copyright 2023 Terramate GmbH // SPDX-License-Identifier: MPL-2.0 -generate_file "/e2etests/cloud/testdata/cloud.data.json" { - context = root - +generate_file "testdata/cloud.data.json" { + inherit = false lets { well_known = { required_version = "> 0.4.3" @@ -58,8 +57,8 @@ generate_file "/e2etests/cloud/testdata/cloud.data.json" { } lets { - github_get_pull_request_response = tm_jsondecode(tm_file("e2etests/cloud/testdata/github/get_pull_request_response.json")) - github_get_commit_response = tm_jsondecode(tm_file("e2etests/cloud/testdata/github/get_commit_response.json")) + github_get_pull_request_response = tm_try(tm_jsondecode(tm_file("testdata/github/get_pull_request_response.json")), null) + github_get_commit_response = tm_try(tm_jsondecode(tm_file("testdata/github/get_commit_response.json")), null) } content = tm_jsonencode({ diff --git a/e2etests/cloud/run_cloud_drift_test.go b/e2etests/cloud/run_cloud_drift_test.go index 3deb405729..152c9e7d7c 100644 --- a/e2etests/cloud/run_cloud_drift_test.go +++ b/e2etests/cloud/run_cloud_drift_test.go @@ -672,7 +672,6 @@ func TestCLIRunWithCloudSyncDriftStatus(t *testing.T) { } t.Run(name, func(t *testing.T) { t.Parallel() - cloudData, err := cloudstore.LoadDatastore(testserverJSONFile) assert.NoError(t, err) addr := startFakeTMCServer(t, cloudData) @@ -693,11 +692,10 @@ func TestCLIRunWithCloudSyncDriftStatus(t *testing.T) { s.BuildTree(tc.layout) s.Git().CommitAll("all stacks committed") - env := RemoveEnv(os.Environ(), "CI") + env := RemoveEnv(s.Env, "CI") env = append(env, tc.env...) env = append(env, "TMC_API_URL=http://"+addr) cli := NewCLI(t, filepath.Join(s.RootDir(), filepath.FromSlash(tc.workingDir)), env...) - cli.PrependToPath(filepath.Dir(TerraformTestPath)) s.Git().SetRemoteURL("origin", testRemoteRepoURL) runflags := []string{ "run", diff --git a/e2etests/cloud/run_script_cloud_drift_test.go b/e2etests/cloud/run_script_cloud_drift_test.go index 0a89c7825a..7f0aa753de 100644 --- a/e2etests/cloud/run_script_cloud_drift_test.go +++ b/e2etests/cloud/run_script_cloud_drift_test.go @@ -420,6 +420,7 @@ func TestScriptRunDriftStatus(t *testing.T) { }, env: []string{ `TF_VAR_content=my secret`, + "TMC_API_DEBUG=1", }, cmd: []string{"cmd"}, want: want{ @@ -558,11 +559,10 @@ func TestScriptRunDriftStatus(t *testing.T) { s.BuildTree(tc.layout) s.Git().CommitAll("all stacks committed") - env := RemoveEnv(os.Environ(), "CI") + env := RemoveEnv(s.Env, "CI") env = append(env, tc.env...) env = append(env, "TMC_API_URL=http://"+addr) cli := NewCLI(t, filepath.Join(s.RootDir(), filepath.FromSlash(tc.workingDir)), env...) - cli.PrependToPath(filepath.Dir(TerraformTestPath)) s.Git().SetRemoteURL("origin", testRemoteRepoURL) runflags := []string{ "script", diff --git a/e2etests/cloud/stack.tm.hcl b/e2etests/cloud/stack.tm.hcl new file mode 100644 index 0000000000..5bf7e46bd7 --- /dev/null +++ b/e2etests/cloud/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "cloud" + description = "cloud" + tags = ["cloud", "e2etests", "golang"] + id = "630a9ef7-e7e6-406d-816c-b7c6be5973cc" +} diff --git a/e2etests/cmd/helper/_test_mock.tf b/e2etests/cmd/helper/_test_mock.tf new file mode 100644 index 0000000000..47ee1a5bd4 --- /dev/null +++ b/e2etests/cmd/helper/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "helper" { + content = "helper is a utility command that implements behaviors that are useful when" + filename = "${path.module}/mock-helper.ignore" +} diff --git a/e2etests/cmd/helper/stack.tm.hcl b/e2etests/cmd/helper/stack.tm.hcl new file mode 100644 index 0000000000..4799fb0626 --- /dev/null +++ b/e2etests/cmd/helper/stack.tm.hcl @@ -0,0 +1,6 @@ +stack { + name = "helper is a utility command that implements behaviors that are useful when" + description = "helper is a utility command that implements behaviors that are useful when" + tags = ["cmd", "e2etests", "golang", "helper"] + id = "4612a756-184a-48a0-9908-0f5ff3b243b3" +} diff --git a/e2etests/core/_test_mock.tf b/e2etests/core/_test_mock.tf new file mode 100644 index 0000000000..be8652443e --- /dev/null +++ b/e2etests/core/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "core" { + content = "core" + filename = "${path.module}/mock-core.ignore" +} diff --git a/e2etests/core/run_test.go b/e2etests/core/run_test.go index b8fdfca9c1..92022d76f9 100644 --- a/e2etests/core/run_test.go +++ b/e2etests/core/run_test.go @@ -3229,8 +3229,6 @@ func TestRunWitCustomizedEnv(t *testing.T) { } wantenv := append(hostenv, - "ACTIONS_ID_TOKEN_REQUEST_URL=", - "ACTIONS_ID_TOKEN_REQUEST_TOKEN=", "CHECKPOINT_DISABLE=1", // e2e tests have telemetry disabled fmt.Sprintf("FROM_META=%s", stackName), fmt.Sprintf("FROM_GLOBAL=%s", stackGlobal), diff --git a/e2etests/core/stack.tm.hcl b/e2etests/core/stack.tm.hcl new file mode 100644 index 0000000000..ba6f78febc --- /dev/null +++ b/e2etests/core/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "core" + description = "core" + tags = ["core", "e2etests", "golang"] + id = "a1337cb5-9e73-4773-94dd-77c9f0bdfeec" +} diff --git a/e2etests/internal/runner/_test_mock.tf b/e2etests/internal/runner/_test_mock.tf new file mode 100644 index 0000000000..ab86116e56 --- /dev/null +++ b/e2etests/internal/runner/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "runner" { + content = "package runner // import \"github.com/terramate-io/terramate/e2etests/internal/runner\"" + filename = "${path.module}/mock-runner.ignore" +} diff --git a/e2etests/internal/runner/runner.go b/e2etests/internal/runner/runner.go index 5323d874a1..e9e57df088 100644 --- a/e2etests/internal/runner/runner.go +++ b/e2etests/internal/runner/runner.go @@ -10,6 +10,7 @@ import ( "os/exec" "path/filepath" "regexp" + "slices" "strings" "sync" "testing" @@ -83,14 +84,24 @@ func NewCLI(t *testing.T, chdir string, env ...string) CLI { // by default, it's assumed human mode env = RemoveEnv(os.Environ(), "CI", "GITHUB_ACTIONS", "GITHUB_TOKEN") } + // environments below are never used in automation. + env = RemoveEnv(env, "TMC_API_HOST", "TMC_API_IDP_KEY") + // this needs to be deleted from environment otherwise CLI GHA tests will try to issue JWT tokens. + env = RemoveEnv(env, "ACTIONS_ID_TOKEN_REQUEST_URL", "ACTIONS_ID_TOKEN_REQUEST_TOKEN") + // this must be always disabled otherwise we contaminate the telemetry endpoint. env = append(env, "CHECKPOINT_DISABLE=1") + // sanity check for cases where user has this configured in their environment. + if index := slices.Index(env, "TMC_API_URL"); index >= 0 { + apiURL := env[index] + if !strings.HasPrefix(apiURL, "http://") { + panic("tests are picking up the wrong API URL") + } + } // custom cliconfig file tm.userDir = test.TempDir(t) cliConfigPath := test.WriteFile(t, tm.userDir, "terramate.rc", fmt.Sprintf(testCliConfigFormat, strings.Replace(tm.userDir, "\\", "\\\\", -1))) env = append(env, "TM_CLI_CONFIG_FILE="+cliConfigPath, - "ACTIONS_ID_TOKEN_REQUEST_URL=", - "ACTIONS_ID_TOKEN_REQUEST_TOKEN=", ) tm.environ = env return tm diff --git a/e2etests/internal/runner/stack.tm.hcl b/e2etests/internal/runner/stack.tm.hcl new file mode 100644 index 0000000000..6c30f59ef0 --- /dev/null +++ b/e2etests/internal/runner/stack.tm.hcl @@ -0,0 +1,6 @@ +stack { + name = "package runner // import \"github.com/terramate-io/terramate/e2etests/internal/runner\"" + description = "package runner // import \"github.com/terramate-io/terramate/e2etests/internal/runner\"" + tags = ["e2etests", "golang", "internal", "runner"] + id = "b20d4bf6-01de-43da-a6e2-1394d64f15a7" +} diff --git a/errors/_test_mock.tf b/errors/_test_mock.tf new file mode 100644 index 0000000000..4ba3884c81 --- /dev/null +++ b/errors/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "errors" { + content = "package errors // import \"github.com/terramate-io/terramate/errors\"" + filename = "${path.module}/mock-errors.ignore" +} diff --git a/errors/errlog/_test_mock.tf b/errors/errlog/_test_mock.tf new file mode 100644 index 0000000000..96c19c53c8 --- /dev/null +++ b/errors/errlog/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "errlog" { + content = "package errlog // import \"github.com/terramate-io/terramate/errors/errlog\"" + filename = "${path.module}/mock-errlog.ignore" +} diff --git a/errors/errlog/stack.tm.hcl b/errors/errlog/stack.tm.hcl new file mode 100644 index 0000000000..9cbac05df3 --- /dev/null +++ b/errors/errlog/stack.tm.hcl @@ -0,0 +1,6 @@ +stack { + name = "package errlog // import \"github.com/terramate-io/terramate/errors/errlog\"" + description = "package errlog // import \"github.com/terramate-io/terramate/errors/errlog\"" + tags = ["errlog", "errors", "golang"] + id = "134adace-8e5e-415a-ae78-55ba53077ed8" +} diff --git a/errors/stack.tm.hcl b/errors/stack.tm.hcl new file mode 100644 index 0000000000..043f2d6092 --- /dev/null +++ b/errors/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package errors // import \"github.com/terramate-io/terramate/errors\"" + description = "package errors // import \"github.com/terramate-io/terramate/errors\"" + tags = ["errors", "golang"] + id = "c252e50b-e808-42a7-b81f-f369e99c3728" +} diff --git a/errors/verbosity/_test_mock.tf b/errors/verbosity/_test_mock.tf new file mode 100644 index 0000000000..af4703eb08 --- /dev/null +++ b/errors/verbosity/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "verbosity" { + content = "package verbosity // import \"github.com/terramate-io/terramate/errors/verbosity\"" + filename = "${path.module}/mock-verbosity.ignore" +} diff --git a/errors/verbosity/stack.tm.hcl b/errors/verbosity/stack.tm.hcl new file mode 100644 index 0000000000..511f8e1e9b --- /dev/null +++ b/errors/verbosity/stack.tm.hcl @@ -0,0 +1,6 @@ +stack { + name = "package verbosity // import \"github.com/terramate-io/terramate/errors/verbosity\"" + description = "package verbosity // import \"github.com/terramate-io/terramate/errors/verbosity\"" + tags = ["errors", "golang", "verbosity"] + id = "60b5407f-858b-4ae6-b431-127eb646738e" +} diff --git a/event/_test_mock.tf b/event/_test_mock.tf new file mode 100644 index 0000000000..6ac621fe59 --- /dev/null +++ b/event/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "event" { + content = "package event // import \"github.com/terramate-io/terramate/event\"" + filename = "${path.module}/mock-event.ignore" +} diff --git a/event/stack.tm.hcl b/event/stack.tm.hcl new file mode 100644 index 0000000000..42f6fac228 --- /dev/null +++ b/event/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package event // import \"github.com/terramate-io/terramate/event\"" + description = "package event // import \"github.com/terramate-io/terramate/event\"" + tags = ["event", "golang"] + id = "d8c0a185-8850-427f-96db-cbaab7d92472" +} diff --git a/fs/_test_mock.tf b/fs/_test_mock.tf new file mode 100644 index 0000000000..9a3cee2589 --- /dev/null +++ b/fs/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "fs" { + content = "package fs // import \"github.com/terramate-io/terramate/fs\"" + filename = "${path.module}/mock-fs.ignore" +} diff --git a/fs/stack.tm.hcl b/fs/stack.tm.hcl new file mode 100644 index 0000000000..875144691e --- /dev/null +++ b/fs/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package fs // import \"github.com/terramate-io/terramate/fs\"" + description = "package fs // import \"github.com/terramate-io/terramate/fs\"" + tags = ["fs", "golang"] + id = "fa006eea-04bf-4959-a6c3-01c626609fd5" +} diff --git a/generate/_test_mock.tf b/generate/_test_mock.tf new file mode 100644 index 0000000000..cbfbef5fdc --- /dev/null +++ b/generate/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "generate" { + content = "package generate // import \"github.com/terramate-io/terramate/generate\"" + filename = "${path.module}/mock-generate.ignore" +} diff --git a/generate/genfile/_test_mock.tf b/generate/genfile/_test_mock.tf new file mode 100644 index 0000000000..f787faf769 --- /dev/null +++ b/generate/genfile/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "genfile" { + content = "package genfile // import \"github.com/terramate-io/terramate/generate/genfile\"" + filename = "${path.module}/mock-genfile.ignore" +} diff --git a/generate/genfile/stack.tm.hcl b/generate/genfile/stack.tm.hcl new file mode 100644 index 0000000000..3f7bf7e125 --- /dev/null +++ b/generate/genfile/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package genfile // import \"github.com/terramate-io/terramate/generate/genfile\"" + description = "package genfile // import \"github.com/terramate-io/terramate/generate/genfile\"" + tags = ["generate", "genfile", "golang"] + id = "a81515e9-82c6-4375-97e8-0eb6cf305b7b" +} diff --git a/generate/genhcl/_test_mock.tf b/generate/genhcl/_test_mock.tf new file mode 100644 index 0000000000..ef270baf7e --- /dev/null +++ b/generate/genhcl/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "genhcl" { + content = "package genhcl // import \"github.com/terramate-io/terramate/generate/genhcl\"" + filename = "${path.module}/mock-genhcl.ignore" +} diff --git a/generate/genhcl/stack.tm.hcl b/generate/genhcl/stack.tm.hcl new file mode 100644 index 0000000000..7331828862 --- /dev/null +++ b/generate/genhcl/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package genhcl // import \"github.com/terramate-io/terramate/generate/genhcl\"" + description = "package genhcl // import \"github.com/terramate-io/terramate/generate/genhcl\"" + tags = ["generate", "genhcl", "golang"] + id = "ff690fdc-0ba1-47bb-9ec7-4bb87f3925f5" +} diff --git a/generate/sharing/_test_mock.tf b/generate/sharing/_test_mock.tf new file mode 100644 index 0000000000..a870b74865 --- /dev/null +++ b/generate/sharing/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "sharing" { + content = "package sharing // import \"github.com/terramate-io/terramate/generate/sharing\"" + filename = "${path.module}/mock-sharing.ignore" +} diff --git a/generate/sharing/stack.tm.hcl b/generate/sharing/stack.tm.hcl new file mode 100644 index 0000000000..e85acf5772 --- /dev/null +++ b/generate/sharing/stack.tm.hcl @@ -0,0 +1,6 @@ +stack { + name = "package sharing // import \"github.com/terramate-io/terramate/generate/sharing\"" + description = "package sharing // import \"github.com/terramate-io/terramate/generate/sharing\"" + tags = ["generate", "golang", "sharing"] + id = "718e68e5-758a-44c2-b6d5-ff1cc9aaedd5" +} diff --git a/generate/stack.tm.hcl b/generate/stack.tm.hcl new file mode 100644 index 0000000000..3aa6f671d0 --- /dev/null +++ b/generate/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package generate // import \"github.com/terramate-io/terramate/generate\"" + description = "package generate // import \"github.com/terramate-io/terramate/generate\"" + tags = ["generate", "golang"] + id = "f839a3c7-35b5-4ddb-8ece-cda62d49ab3d" +} diff --git a/generate_preview.tm b/generate_preview.tm new file mode 100644 index 0000000000..7d08079874 --- /dev/null +++ b/generate_preview.tm @@ -0,0 +1,17 @@ +# This file is required by the "preview" script. + +generate_hcl "_test_mock.tf" { + condition = tm_contains(terramate.stack.tags, "golang") + lets { + name = tm_ternary(terramate.stack.path.basename == "/", "terramate", terramate.stack.path.basename) + } + content { + tm_dynamic "local_file" { + labels = tm_concat(["local_file"], [let.name]) + attributes = { + content = terramate.stack.name + filename = "${path.module}/mock-${terramate.stack.path.basename}.ignore" + } + } + } +} diff --git a/git/_test_mock.tf b/git/_test_mock.tf new file mode 100644 index 0000000000..a1fd7312de --- /dev/null +++ b/git/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "git" { + content = "package git // import \"github.com/terramate-io/terramate/git\"" + filename = "${path.module}/mock-git.ignore" +} diff --git a/git/stack.tm.hcl b/git/stack.tm.hcl new file mode 100644 index 0000000000..cb977a5657 --- /dev/null +++ b/git/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package git // import \"github.com/terramate-io/terramate/git\"" + description = "package git // import \"github.com/terramate-io/terramate/git\"" + tags = ["git", "golang"] + id = "db5c782c-96b5-4ae9-9e9b-680f5c580c96" +} diff --git a/globals/_test_mock.tf b/globals/_test_mock.tf new file mode 100644 index 0000000000..1b5a16f72b --- /dev/null +++ b/globals/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "globals" { + content = "package globals // import \"github.com/terramate-io/terramate/globals\"" + filename = "${path.module}/mock-globals.ignore" +} diff --git a/globals/stack.tm.hcl b/globals/stack.tm.hcl new file mode 100644 index 0000000000..0fbe936af3 --- /dev/null +++ b/globals/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package globals // import \"github.com/terramate-io/terramate/globals\"" + description = "package globals // import \"github.com/terramate-io/terramate/globals\"" + tags = ["globals", "golang"] + id = "314f9cbe-7cf9-420b-83bd-5111aeb32d50" +} diff --git a/golangci.tm b/golangci.tm index 239e0d3f67..4f022abf24 100644 --- a/golangci.tm +++ b/golangci.tm @@ -18,7 +18,7 @@ generate_file "/.golangci.toml" { "exclude-rules" = [ { path = "(.+)_test\\.go" - text = "dot-imports:" + text = "dot-imports:" linters = ["revive"] } ] diff --git a/hack/check-stacks.sh b/hack/check-stacks.sh new file mode 100755 index 0000000000..f91b568b3f --- /dev/null +++ b/hack/check-stacks.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# Copyright 2024 Terramate GmbH +# SPDX-License-Identifier: MPL-2.0 + + +source "$(dirname "$0")/packages.sh" + +rootdir=$(git rev-parse --show-toplevel) + +for pkg in $(packages_with_tests); do + cd $pkg + projdir=${pkg#"$rootdir"} + if [ "x${projdir}" == "x" ]; then + projdir="/" + fi + if ! test -f stack.tm -o -f stack.tm.hcl; then + echo "Stack ${projdir} must be created! Please run ./hack/create-stacks.sh" + exit 1 + fi +done diff --git a/hack/create-stacks.sh b/hack/create-stacks.sh new file mode 100755 index 0000000000..f91d5aafd6 --- /dev/null +++ b/hack/create-stacks.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# Copyright 2024 Terramate GmbH +# SPDX-License-Identifier: MPL-2.0 + + +source "$(dirname "$0")/packages.sh" + +rootdir=$(git rev-parse --show-toplevel) + +for pkg in $(packages_with_tests); do + cd $pkg + projdir=${pkg#"$rootdir"} + if [ "x${projdir}" == "x" ]; then + projdir="/" + fi + if test -f stack.tm -o -f stack.tm.hcl; then + continue + fi + name=$(go doc . | head -n1) + desc=$(go doc .) + tags=$(terramate experimental eval 'tm_join(",", tm_distinct([for p in tm_split("/", "'$projdir'") : p if p != ""]))') + if ! test -z $tags; then + tags="--tags=golang,${tags}" + fi + terramate create . \ + --name="$name" \ + --description="$doc" \ + $tags +done diff --git a/hack/packages.sh b/hack/packages.sh new file mode 100644 index 0000000000..faf7c8273f --- /dev/null +++ b/hack/packages.sh @@ -0,0 +1,10 @@ +# Copyright 2024 Terramate GmbH +# SPDX-License-Identifier: MPL-2.0 + +packages() { + go list -f '{{.Dir}}' ./... | sort +} + +packages_with_tests() { + go list -f '{{.Dir}}' ./... | sort +} diff --git a/hcl/_test_mock.tf b/hcl/_test_mock.tf new file mode 100644 index 0000000000..b7733270ec --- /dev/null +++ b/hcl/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "hcl" { + content = "package hcl // import \"github.com/terramate-io/terramate/hcl\"" + filename = "${path.module}/mock-hcl.ignore" +} diff --git a/hcl/ast/_test_mock.tf b/hcl/ast/_test_mock.tf new file mode 100644 index 0000000000..2bf842e6e9 --- /dev/null +++ b/hcl/ast/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "ast" { + content = "package ast // import \"github.com/terramate-io/terramate/hcl/ast\"" + filename = "${path.module}/mock-ast.ignore" +} diff --git a/hcl/ast/stack.tm.hcl b/hcl/ast/stack.tm.hcl new file mode 100644 index 0000000000..ad6f6e2919 --- /dev/null +++ b/hcl/ast/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package ast // import \"github.com/terramate-io/terramate/hcl/ast\"" + description = "package ast // import \"github.com/terramate-io/terramate/hcl/ast\"" + tags = ["ast", "golang", "hcl"] + id = "e27eaeed-8f95-4036-8a58-2c87a2297c05" +} diff --git a/hcl/eval/_test_mock.tf b/hcl/eval/_test_mock.tf new file mode 100644 index 0000000000..d3f637e0fe --- /dev/null +++ b/hcl/eval/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "eval" { + content = "package eval // import \"github.com/terramate-io/terramate/hcl/eval\"" + filename = "${path.module}/mock-eval.ignore" +} diff --git a/hcl/eval/stack.tm.hcl b/hcl/eval/stack.tm.hcl new file mode 100644 index 0000000000..6d3ded33bf --- /dev/null +++ b/hcl/eval/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package eval // import \"github.com/terramate-io/terramate/hcl/eval\"" + description = "package eval // import \"github.com/terramate-io/terramate/hcl/eval\"" + tags = ["eval", "golang", "hcl"] + id = "2d187f5b-7220-423f-b2ff-edd5683fb5c8" +} diff --git a/hcl/fmt/_test_mock.tf b/hcl/fmt/_test_mock.tf new file mode 100644 index 0000000000..ba39deac3e --- /dev/null +++ b/hcl/fmt/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "fmt" { + content = "package fmt // import \"github.com/terramate-io/terramate/hcl/fmt\"" + filename = "${path.module}/mock-fmt.ignore" +} diff --git a/hcl/fmt/stack.tm.hcl b/hcl/fmt/stack.tm.hcl new file mode 100644 index 0000000000..2a6ea3ad58 --- /dev/null +++ b/hcl/fmt/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package fmt // import \"github.com/terramate-io/terramate/hcl/fmt\"" + description = "package fmt // import \"github.com/terramate-io/terramate/hcl/fmt\"" + tags = ["fmt", "golang", "hcl"] + id = "ae69565a-b6fd-4567-83de-659506f5e5e1" +} diff --git a/hcl/info/_test_mock.tf b/hcl/info/_test_mock.tf new file mode 100644 index 0000000000..a5f2e74950 --- /dev/null +++ b/hcl/info/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "info" { + content = "package info // import \"github.com/terramate-io/terramate/hcl/info\"" + filename = "${path.module}/mock-info.ignore" +} diff --git a/hcl/info/stack.tm.hcl b/hcl/info/stack.tm.hcl new file mode 100644 index 0000000000..bc4cf78fc8 --- /dev/null +++ b/hcl/info/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package info // import \"github.com/terramate-io/terramate/hcl/info\"" + description = "package info // import \"github.com/terramate-io/terramate/hcl/info\"" + tags = ["golang", "hcl", "info"] + id = "178b6aaa-0cfe-4988-84fd-85e266e22bb3" +} diff --git a/hcl/stack.tm.hcl b/hcl/stack.tm.hcl new file mode 100644 index 0000000000..1c38a13d7f --- /dev/null +++ b/hcl/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package hcl // import \"github.com/terramate-io/terramate/hcl\"" + description = "package hcl // import \"github.com/terramate-io/terramate/hcl\"" + tags = ["golang", "hcl"] + id = "e9c09f01-42a8-4d30-b3fb-0ea70638bc9a" +} diff --git a/lets/_test_mock.tf b/lets/_test_mock.tf new file mode 100644 index 0000000000..7dbfaf7b75 --- /dev/null +++ b/lets/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "lets" { + content = "package lets // import \"github.com/terramate-io/terramate/lets\"" + filename = "${path.module}/mock-lets.ignore" +} diff --git a/lets/stack.tm.hcl b/lets/stack.tm.hcl new file mode 100644 index 0000000000..ea9edd1855 --- /dev/null +++ b/lets/stack.tm.hcl @@ -0,0 +1,6 @@ +stack { + name = "package lets // import \"github.com/terramate-io/terramate/lets\"" + description = "package lets // import \"github.com/terramate-io/terramate/lets\"" + tags = ["golang", "lets"] + id = "3c2f7069-a92e-4408-a124-d130ec99a02f" +} diff --git a/ls/_test_mock.tf b/ls/_test_mock.tf new file mode 100644 index 0000000000..cc3602add0 --- /dev/null +++ b/ls/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "ls" { + content = "package tmls // import \"github.com/terramate-io/terramate/ls\"" + filename = "${path.module}/mock-ls.ignore" +} diff --git a/ls/stack.tm.hcl b/ls/stack.tm.hcl new file mode 100644 index 0000000000..0aadb3c4e2 --- /dev/null +++ b/ls/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package tmls // import \"github.com/terramate-io/terramate/ls\"" + description = "package tmls // import \"github.com/terramate-io/terramate/ls\"" + tags = ["golang", "ls"] + id = "70160527-f2ff-4137-8b83-14ef52396ea6" +} diff --git a/makefiles/common.mk b/makefiles/common.mk index f297656ec5..4f52c75d0c 100644 --- a/makefiles/common.mk +++ b/makefiles/common.mk @@ -1,7 +1,7 @@ GO_RELEASER_VERSION=v1.14.0 GOLANGCI_LINT_VERSION ?= v1.60.3 COVERAGE_REPORT ?= coverage.txt -RUN_ADD_LICENSE=go run github.com/google/addlicense@v1.0.0 -l mpl -s=only -ignore 'docs/**' +RUN_ADD_LICENSE=go run github.com/google/addlicense@v1.0.0 -l mpl -s=only -ignore 'docs/**' -ignore '**/*.tf' BENCH_CHECK=go run github.com/madlambda/benchcheck/cmd/benchcheck@743137fbfd827958b25ab6b13fa1180e0e933eb1 ## Build terramate tools into bin directory @@ -56,7 +56,7 @@ fmt: ## lint code .PHONY: lint lint: - go run github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) run ./... + go run github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) run . ## tidy up go modules .PHONY: mod diff --git a/makefiles/unix.mk b/makefiles/unix.mk index 16281e46f9..ffc2ccd248 100644 --- a/makefiles/unix.mk +++ b/makefiles/unix.mk @@ -41,6 +41,20 @@ test: test/helper build TM_TEST_ROOT_TEMPDIR=$(tempdir) ./bin/terramate run --no-recursive -- go test -race -count=1 -timeout 30m ./... ./bin/helper rm $(tempdir) +## test/sync code +.PHONY: test/sync +tempdir=$(shell ./bin/helper tempdir) +test/sync: test/helper build +# Using `terramate` because it detects and fails if the generated files are outdated. + TMC_API_HOST=api.stg.terramate.io \ + TM_TEST_ROOT_TEMPDIR=$(tempdir) \ + TM_CLOUD_ORGANIZATION=test \ + GITHUB_TOKEN=$(shell cat ../my_github_token.txt) \ + NO_COLOR=1 \ + CI=1 \ + ./bin/terramate script run --tags golang --parallel=10 preview + ./bin/helper rm $(tempdir) + ## test/interop .PHONY: test/interop test/interop: org?=test diff --git a/mapexpr/_test_mock.tf b/mapexpr/_test_mock.tf new file mode 100644 index 0000000000..8d7861f90e --- /dev/null +++ b/mapexpr/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "mapexpr" { + content = "package mapexpr // import \"github.com/terramate-io/terramate/mapexpr\"" + filename = "${path.module}/mock-mapexpr.ignore" +} diff --git a/mapexpr/stack.tm.hcl b/mapexpr/stack.tm.hcl new file mode 100644 index 0000000000..8aa4e4aac6 --- /dev/null +++ b/mapexpr/stack.tm.hcl @@ -0,0 +1,6 @@ +stack { + name = "package mapexpr // import \"github.com/terramate-io/terramate/mapexpr\"" + description = "package mapexpr // import \"github.com/terramate-io/terramate/mapexpr\"" + tags = ["golang", "mapexpr"] + id = "78f93050-6865-4ea6-9ac2-c7107887fd88" +} diff --git a/mapexpr/test/_test_mock.tf b/mapexpr/test/_test_mock.tf new file mode 100644 index 0000000000..1b3999c5bc --- /dev/null +++ b/mapexpr/test/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "test" { + content = "package test // import \"github.com/terramate-io/terramate/mapexpr/test\"" + filename = "${path.module}/mock-test.ignore" +} diff --git a/mapexpr/test/stack.tm.hcl b/mapexpr/test/stack.tm.hcl new file mode 100644 index 0000000000..a72c848460 --- /dev/null +++ b/mapexpr/test/stack.tm.hcl @@ -0,0 +1,6 @@ +stack { + name = "package test // import \"github.com/terramate-io/terramate/mapexpr/test\"" + description = "package test // import \"github.com/terramate-io/terramate/mapexpr/test\"" + tags = ["golang", "mapexpr", "test"] + id = "1f4ae8d7-dfbd-4191-81ce-5ff50d459c40" +} diff --git a/modvendor/_test_mock.tf b/modvendor/_test_mock.tf new file mode 100644 index 0000000000..657e1c7f80 --- /dev/null +++ b/modvendor/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "modvendor" { + content = "package modvendor // import \"github.com/terramate-io/terramate/modvendor\"" + filename = "${path.module}/mock-modvendor.ignore" +} diff --git a/modvendor/download/_test_mock.tf b/modvendor/download/_test_mock.tf new file mode 100644 index 0000000000..483de037d6 --- /dev/null +++ b/modvendor/download/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "download" { + content = "package download // import \"github.com/terramate-io/terramate/modvendor/download\"" + filename = "${path.module}/mock-download.ignore" +} diff --git a/modvendor/download/stack.tm.hcl b/modvendor/download/stack.tm.hcl new file mode 100644 index 0000000000..08ffbb6aa5 --- /dev/null +++ b/modvendor/download/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package download // import \"github.com/terramate-io/terramate/modvendor/download\"" + description = "package download // import \"github.com/terramate-io/terramate/modvendor/download\"" + tags = ["download", "golang", "modvendor"] + id = "6adbc361-8f01-4c17-9d52-6927f8598a85" +} diff --git a/modvendor/manifest/_test_mock.tf b/modvendor/manifest/_test_mock.tf new file mode 100644 index 0000000000..dc51ab3582 --- /dev/null +++ b/modvendor/manifest/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "manifest" { + content = "package manifest // import \"github.com/terramate-io/terramate/modvendor/manifest\"" + filename = "${path.module}/mock-manifest.ignore" +} diff --git a/modvendor/manifest/stack.tm.hcl b/modvendor/manifest/stack.tm.hcl new file mode 100644 index 0000000000..041215a2cc --- /dev/null +++ b/modvendor/manifest/stack.tm.hcl @@ -0,0 +1,6 @@ +stack { + name = "package manifest // import \"github.com/terramate-io/terramate/modvendor/manifest\"" + description = "package manifest // import \"github.com/terramate-io/terramate/modvendor/manifest\"" + tags = ["golang", "manifest", "modvendor"] + id = "4fce3cca-e520-41a1-b68a-892982084b56" +} diff --git a/modvendor/stack.tm.hcl b/modvendor/stack.tm.hcl new file mode 100644 index 0000000000..e5134fb63e --- /dev/null +++ b/modvendor/stack.tm.hcl @@ -0,0 +1,6 @@ +stack { + name = "package modvendor // import \"github.com/terramate-io/terramate/modvendor\"" + description = "package modvendor // import \"github.com/terramate-io/terramate/modvendor\"" + tags = ["golang", "modvendor"] + id = "f5a2460b-d55c-45cb-9d3c-507d90de2c0d" +} diff --git a/printer/_test_mock.tf b/printer/_test_mock.tf new file mode 100644 index 0000000000..b7371fbe32 --- /dev/null +++ b/printer/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "printer" { + content = "package printer // import \"github.com/terramate-io/terramate/printer\"" + filename = "${path.module}/mock-printer.ignore" +} diff --git a/printer/stack.tm.hcl b/printer/stack.tm.hcl new file mode 100644 index 0000000000..c344e83f44 --- /dev/null +++ b/printer/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package printer // import \"github.com/terramate-io/terramate/printer\"" + description = "package printer // import \"github.com/terramate-io/terramate/printer\"" + tags = ["golang", "printer"] + id = "f9b0dbd9-866b-4e52-a90e-7c514e448830" +} diff --git a/project/_test_mock.tf b/project/_test_mock.tf new file mode 100644 index 0000000000..384cf32c2a --- /dev/null +++ b/project/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "project" { + content = "package project // import \"github.com/terramate-io/terramate/project\"" + filename = "${path.module}/mock-project.ignore" +} diff --git a/project/stack.tm.hcl b/project/stack.tm.hcl new file mode 100644 index 0000000000..6c98276dce --- /dev/null +++ b/project/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package project // import \"github.com/terramate-io/terramate/project\"" + description = "package project // import \"github.com/terramate-io/terramate/project\"" + tags = ["golang", "project"] + id = "b4e7c08f-1435-4f70-bd68-368133752191" +} diff --git a/run/_test_mock.tf b/run/_test_mock.tf new file mode 100644 index 0000000000..2bbb0bd995 --- /dev/null +++ b/run/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "run" { + content = "package run // import \"github.com/terramate-io/terramate/run\"" + filename = "${path.module}/mock-run.ignore" +} diff --git a/run/dag/_test_mock.tf b/run/dag/_test_mock.tf new file mode 100644 index 0000000000..0aa9dac085 --- /dev/null +++ b/run/dag/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "dag" { + content = "package dag // import \"github.com/terramate-io/terramate/run/dag\"" + filename = "${path.module}/mock-dag.ignore" +} diff --git a/run/dag/stack.tm.hcl b/run/dag/stack.tm.hcl new file mode 100644 index 0000000000..5ec4b925ea --- /dev/null +++ b/run/dag/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package dag // import \"github.com/terramate-io/terramate/run/dag\"" + description = "package dag // import \"github.com/terramate-io/terramate/run/dag\"" + tags = ["dag", "golang", "run"] + id = "6502948b-daec-430a-802c-8ed41d72f3c2" +} diff --git a/run/stack.tm.hcl b/run/stack.tm.hcl new file mode 100644 index 0000000000..fb33326b70 --- /dev/null +++ b/run/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package run // import \"github.com/terramate-io/terramate/run\"" + description = "package run // import \"github.com/terramate-io/terramate/run\"" + tags = ["golang", "run"] + id = "669b4e1e-6770-4575-9745-0d802a1459e8" +} diff --git a/safeguard/_test_mock.tf b/safeguard/_test_mock.tf new file mode 100644 index 0000000000..0055c0cb04 --- /dev/null +++ b/safeguard/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "safeguard" { + content = "package safeguard // import \"github.com/terramate-io/terramate/safeguard\"" + filename = "${path.module}/mock-safeguard.ignore" +} diff --git a/safeguard/stack.tm.hcl b/safeguard/stack.tm.hcl new file mode 100644 index 0000000000..500d3ad8c6 --- /dev/null +++ b/safeguard/stack.tm.hcl @@ -0,0 +1,6 @@ +stack { + name = "package safeguard // import \"github.com/terramate-io/terramate/safeguard\"" + description = "package safeguard // import \"github.com/terramate-io/terramate/safeguard\"" + tags = ["golang", "safeguard"] + id = "df1bc7db-6ccf-4ac0-b5bf-44a6ed4bffba" +} diff --git a/scheduler/_test_mock.tf b/scheduler/_test_mock.tf new file mode 100644 index 0000000000..4a8808a5df --- /dev/null +++ b/scheduler/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "scheduler" { + content = "package scheduler // import \"github.com/terramate-io/terramate/scheduler\"" + filename = "${path.module}/mock-scheduler.ignore" +} diff --git a/scheduler/resource/_test_mock.tf b/scheduler/resource/_test_mock.tf new file mode 100644 index 0000000000..266c7838e2 --- /dev/null +++ b/scheduler/resource/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "resource" { + content = "package resource // import \"github.com/terramate-io/terramate/scheduler/resource\"" + filename = "${path.module}/mock-resource.ignore" +} diff --git a/scheduler/resource/stack.tm.hcl b/scheduler/resource/stack.tm.hcl new file mode 100644 index 0000000000..5cd59c5ed8 --- /dev/null +++ b/scheduler/resource/stack.tm.hcl @@ -0,0 +1,6 @@ +stack { + name = "package resource // import \"github.com/terramate-io/terramate/scheduler/resource\"" + description = "package resource // import \"github.com/terramate-io/terramate/scheduler/resource\"" + tags = ["golang", "resource", "scheduler"] + id = "72f2d42b-1b64-44b5-8758-a5fecb7fc964" +} diff --git a/scheduler/stack.tm.hcl b/scheduler/stack.tm.hcl new file mode 100644 index 0000000000..7a53cfe402 --- /dev/null +++ b/scheduler/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package scheduler // import \"github.com/terramate-io/terramate/scheduler\"" + description = "package scheduler // import \"github.com/terramate-io/terramate/scheduler\"" + tags = ["golang", "scheduler"] + id = "8c46cc73-50cf-4e90-b64f-f9a3987133df" +} diff --git a/scripts.tm b/scripts.tm new file mode 100644 index 0000000000..a53ac1fb89 --- /dev/null +++ b/scripts.tm @@ -0,0 +1,62 @@ +// Copyright 2023 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +globals { + planfile = "out.tfplan" +} + +script "test" { + name = "Terramate tests" + + job { + commands = [ + ["bash", "-c", "terraform init -lock=false >/dev/null"], + ["bash", "-c", "terraform plan -out=${global.planfile} >/dev/null"] + ] + } + + job { + command = [ + "go", "test", "-race", "-count=1", "-timeout", "30m"] + } +} + +script "preview" { + name = "Preview Terramate tests" + + job { + commands = [ + ["bash", "-c", "terraform init -lock=false >/dev/null"], + ["bash", "-c", "terraform plan -out=${global.planfile} >/dev/null"] + ] + } + + job { + command = [ + "go", "test", "-race", "-count=1", "-timeout", "30m", { + sync_preview = true, + terraform_plan_file = global.planfile, + } + ] + } +} + +script "deploy" { + name = "Deploy Terramate tests" + + job { + commands = [ + ["bash", "-c", "terraform init -lock=false >/dev/null"], + ["bash", "-c", "terraform plan -out=${global.planfile} >/dev/null"] + ] + } + + job { + command = [ + "go", "test", "-race", "-count=1", "-timeout", "30m", { + sync_deployment = true, + terraform_plan_file = global.planfile, + } + ] + } +} diff --git a/stack/_test_mock.tf b/stack/_test_mock.tf new file mode 100644 index 0000000000..14fb6dbb66 --- /dev/null +++ b/stack/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "stack" { + content = "package stack // import \"github.com/terramate-io/terramate/stack\"" + filename = "${path.module}/mock-stack.ignore" +} diff --git a/stack/stack.tm.hcl b/stack/stack.tm.hcl new file mode 100644 index 0000000000..b0288ad8a8 --- /dev/null +++ b/stack/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package stack // import \"github.com/terramate-io/terramate/stack\"" + description = "package stack // import \"github.com/terramate-io/terramate/stack\"" + tags = ["golang", "stack"] + id = "6acb76e1-670a-4161-b7ce-163fff861699" +} diff --git a/stack/trigger/_test_mock.tf b/stack/trigger/_test_mock.tf new file mode 100644 index 0000000000..625e147a96 --- /dev/null +++ b/stack/trigger/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "trigger" { + content = "package trigger // import \"github.com/terramate-io/terramate/stack/trigger\"" + filename = "${path.module}/mock-trigger.ignore" +} diff --git a/stack/trigger/stack.tm.hcl b/stack/trigger/stack.tm.hcl new file mode 100644 index 0000000000..d27c7a2759 --- /dev/null +++ b/stack/trigger/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package trigger // import \"github.com/terramate-io/terramate/stack/trigger\"" + description = "package trigger // import \"github.com/terramate-io/terramate/stack/trigger\"" + tags = ["golang", "stack", "trigger"] + id = "ce7cc771-6a83-4098-9ba4-61d336e75b0e" +} diff --git a/stdlib/_test_mock.tf b/stdlib/_test_mock.tf new file mode 100644 index 0000000000..d2e5eb63f8 --- /dev/null +++ b/stdlib/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "stdlib" { + content = "package stdlib // import \"github.com/terramate-io/terramate/stdlib\"" + filename = "${path.module}/mock-stdlib.ignore" +} diff --git a/stdlib/stack.tm.hcl b/stdlib/stack.tm.hcl new file mode 100644 index 0000000000..3f19a9b54f --- /dev/null +++ b/stdlib/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package stdlib // import \"github.com/terramate-io/terramate/stdlib\"" + description = "package stdlib // import \"github.com/terramate-io/terramate/stdlib\"" + tags = ["golang", "stdlib"] + id = "247fd494-a2b5-4a35-9d73-a0a011f41cee" +} diff --git a/strconv/_test_mock.tf b/strconv/_test_mock.tf new file mode 100644 index 0000000000..27e434bd67 --- /dev/null +++ b/strconv/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "strconv" { + content = "package strconv // import \"github.com/terramate-io/terramate/strconv\"" + filename = "${path.module}/mock-strconv.ignore" +} diff --git a/strconv/stack.tm.hcl b/strconv/stack.tm.hcl new file mode 100644 index 0000000000..7103ec0b7b --- /dev/null +++ b/strconv/stack.tm.hcl @@ -0,0 +1,6 @@ +stack { + name = "package strconv // import \"github.com/terramate-io/terramate/strconv\"" + description = "package strconv // import \"github.com/terramate-io/terramate/strconv\"" + tags = ["golang", "strconv"] + id = "7cd84dfd-8fa9-479a-a968-991e54c67dab" +} diff --git a/terramate.tm b/terramate.tm index 822623c752..f7f060f041 100644 --- a/terramate.tm +++ b/terramate.tm @@ -1,15 +1,9 @@ // Copyright 2023 Terramate GmbH // SPDX-License-Identifier: MPL-2.0 -# This file is here just to e2etest on Windows if the `terramate run` respects -# the `terramate.config.run.env.PATH` environment variable. -# This behavior is not tested in Go because it requires a lot of "unsafe" -# non-portable code. -# It's used by the `make test` implemented for Windows at ./makefiles/windows.mk - terramate { config { - experiments = ["toml-functions"] + experiments = ["toml-functions", "scripts", "targets"] run { env { PATH = "${terramate.root.path.fs.absolute}/bin${global.PS}${env.PATH}" @@ -21,6 +15,14 @@ terramate { check_uncommitted = false check_remote = false } + + cloud { + organization = "terramate-tests" + + targets { + enabled = true + } + } } } @@ -28,3 +30,4 @@ globals { # TODO(i4k): very brittle but works for now. PS = tm_fileexists("/etc/hosts") ? ":" : ";" } + diff --git a/test/_test_mock.tf b/test/_test_mock.tf new file mode 100644 index 0000000000..451d17c95d --- /dev/null +++ b/test/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "test" { + content = "package test // import \"github.com/terramate-io/terramate/test\"" + filename = "${path.module}/mock-test.ignore" +} diff --git a/test/cloud/_test_mock.tf b/test/cloud/_test_mock.tf new file mode 100644 index 0000000000..6846c7d05a --- /dev/null +++ b/test/cloud/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "cloud" { + content = "package cloud // import \"github.com/terramate-io/terramate/test/cloud\"" + filename = "${path.module}/mock-cloud.ignore" +} diff --git a/test/cloud/stack.tm.hcl b/test/cloud/stack.tm.hcl new file mode 100644 index 0000000000..3e3f950e45 --- /dev/null +++ b/test/cloud/stack.tm.hcl @@ -0,0 +1,6 @@ +stack { + name = "package cloud // import \"github.com/terramate-io/terramate/test/cloud\"" + description = "package cloud // import \"github.com/terramate-io/terramate/test/cloud\"" + tags = ["cloud", "golang", "test"] + id = "8baadd7a-019b-41b4-a1e6-d9cf1580cbb7" +} diff --git a/test/errors/_test_mock.tf b/test/errors/_test_mock.tf new file mode 100644 index 0000000000..ff248d4bd7 --- /dev/null +++ b/test/errors/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "errors" { + content = "package errors // import \"github.com/terramate-io/terramate/test/errors\"" + filename = "${path.module}/mock-errors.ignore" +} diff --git a/test/errors/stack.tm.hcl b/test/errors/stack.tm.hcl new file mode 100644 index 0000000000..df98132ee6 --- /dev/null +++ b/test/errors/stack.tm.hcl @@ -0,0 +1,6 @@ +stack { + name = "package errors // import \"github.com/terramate-io/terramate/test/errors\"" + description = "package errors // import \"github.com/terramate-io/terramate/test/errors\"" + tags = ["errors", "golang", "test"] + id = "028b0b3b-88fb-4c8f-be5e-84b9b8e0ace7" +} diff --git a/test/hclutils/_test_mock.tf b/test/hclutils/_test_mock.tf new file mode 100644 index 0000000000..c92b3bf415 --- /dev/null +++ b/test/hclutils/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "hclutils" { + content = "package hclutils // import \"github.com/terramate-io/terramate/test/hclutils\"" + filename = "${path.module}/mock-hclutils.ignore" +} diff --git a/test/hclutils/info/_test_mock.tf b/test/hclutils/info/_test_mock.tf new file mode 100644 index 0000000000..09a1c9a7fb --- /dev/null +++ b/test/hclutils/info/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "info" { + content = "package info // import \"github.com/terramate-io/terramate/test/hclutils/info\"" + filename = "${path.module}/mock-info.ignore" +} diff --git a/test/hclutils/info/stack.tm.hcl b/test/hclutils/info/stack.tm.hcl new file mode 100644 index 0000000000..eb27ec759c --- /dev/null +++ b/test/hclutils/info/stack.tm.hcl @@ -0,0 +1,6 @@ +stack { + name = "package info // import \"github.com/terramate-io/terramate/test/hclutils/info\"" + description = "package info // import \"github.com/terramate-io/terramate/test/hclutils/info\"" + tags = ["golang", "hclutils", "info", "test"] + id = "4c77f5a3-c63d-4a21-8ae5-a73e094ad4b1" +} diff --git a/test/hclutils/stack.tm.hcl b/test/hclutils/stack.tm.hcl new file mode 100644 index 0000000000..b0f8966599 --- /dev/null +++ b/test/hclutils/stack.tm.hcl @@ -0,0 +1,6 @@ +stack { + name = "package hclutils // import \"github.com/terramate-io/terramate/test/hclutils\"" + description = "package hclutils // import \"github.com/terramate-io/terramate/test/hclutils\"" + tags = ["golang", "hclutils", "test"] + id = "c0c75546-9ce6-4829-af02-e26e3e95c559" +} diff --git a/test/hclwrite/_test_mock.tf b/test/hclwrite/_test_mock.tf new file mode 100644 index 0000000000..c6a35fa560 --- /dev/null +++ b/test/hclwrite/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "hclwrite" { + content = "package hclwrite // import \"github.com/terramate-io/terramate/test/hclwrite\"" + filename = "${path.module}/mock-hclwrite.ignore" +} diff --git a/test/hclwrite/hclutils/_test_mock.tf b/test/hclwrite/hclutils/_test_mock.tf new file mode 100644 index 0000000000..2d0b0f2587 --- /dev/null +++ b/test/hclwrite/hclutils/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "hclutils" { + content = "package hclutils // import \"github.com/terramate-io/terramate/test/hclwrite/hclutils\"" + filename = "${path.module}/mock-hclutils.ignore" +} diff --git a/test/hclwrite/hclutils/stack.tm.hcl b/test/hclwrite/hclutils/stack.tm.hcl new file mode 100644 index 0000000000..8666e49a8a --- /dev/null +++ b/test/hclwrite/hclutils/stack.tm.hcl @@ -0,0 +1,6 @@ +stack { + name = "package hclutils // import \"github.com/terramate-io/terramate/test/hclwrite/hclutils\"" + description = "package hclutils // import \"github.com/terramate-io/terramate/test/hclwrite/hclutils\"" + tags = ["golang", "hclutils", "hclwrite", "test"] + id = "1e135d74-81ca-4b9c-87ed-361a121f50c6" +} diff --git a/test/hclwrite/stack.tm.hcl b/test/hclwrite/stack.tm.hcl new file mode 100644 index 0000000000..fceaeccb8f --- /dev/null +++ b/test/hclwrite/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package hclwrite // import \"github.com/terramate-io/terramate/test/hclwrite\"" + description = "package hclwrite // import \"github.com/terramate-io/terramate/test/hclwrite\"" + tags = ["golang", "hclwrite", "test"] + id = "a64ecd0b-87b3-4141-bae0-c842a82b8bff" +} diff --git a/test/ls/_test_mock.tf b/test/ls/_test_mock.tf new file mode 100644 index 0000000000..257a6eee49 --- /dev/null +++ b/test/ls/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "ls" { + content = "package ls // import \"github.com/terramate-io/terramate/test/ls\"" + filename = "${path.module}/mock-ls.ignore" +} diff --git a/test/ls/stack.tm.hcl b/test/ls/stack.tm.hcl new file mode 100644 index 0000000000..807ab9fefc --- /dev/null +++ b/test/ls/stack.tm.hcl @@ -0,0 +1,6 @@ +stack { + name = "package ls // import \"github.com/terramate-io/terramate/test/ls\"" + description = "package ls // import \"github.com/terramate-io/terramate/test/ls\"" + tags = ["golang", "ls", "test"] + id = "ed40436f-ce57-407e-ad62-77431dfea640" +} diff --git a/test/sandbox/_test_mock.tf b/test/sandbox/_test_mock.tf new file mode 100644 index 0000000000..2608204c00 --- /dev/null +++ b/test/sandbox/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "sandbox" { + content = "package sandbox // import \"github.com/terramate-io/terramate/test/sandbox\"" + filename = "${path.module}/mock-sandbox.ignore" +} diff --git a/test/sandbox/stack.tm.hcl b/test/sandbox/stack.tm.hcl new file mode 100644 index 0000000000..ce2a3c2125 --- /dev/null +++ b/test/sandbox/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package sandbox // import \"github.com/terramate-io/terramate/test/sandbox\"" + description = "package sandbox // import \"github.com/terramate-io/terramate/test/sandbox\"" + tags = ["golang", "sandbox", "test"] + id = "6825af18-653a-4f02-a054-bf1af14a7ccd" +} diff --git a/test/stack.tm.hcl b/test/stack.tm.hcl new file mode 100644 index 0000000000..d2acf7dd49 --- /dev/null +++ b/test/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package test // import \"github.com/terramate-io/terramate/test\"" + description = "package test // import \"github.com/terramate-io/terramate/test\"" + tags = ["golang", "test"] + id = "a8e3f50d-efdb-4ae6-808b-83b5a935621f" +} diff --git a/tf/_test_mock.tf b/tf/_test_mock.tf new file mode 100644 index 0000000000..74840745d5 --- /dev/null +++ b/tf/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "tf" { + content = "package tf // import \"github.com/terramate-io/terramate/tf\"" + filename = "${path.module}/mock-tf.ignore" +} diff --git a/tf/stack.tm.hcl b/tf/stack.tm.hcl new file mode 100644 index 0000000000..03b9531792 --- /dev/null +++ b/tf/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package tf // import \"github.com/terramate-io/terramate/tf\"" + description = "package tf // import \"github.com/terramate-io/terramate/tf\"" + tags = ["golang", "tf"] + id = "ddbc17e4-9222-4cb6-8232-44330b0256f2" +} diff --git a/tg/_test_mock.tf b/tg/_test_mock.tf new file mode 100644 index 0000000000..e1b7dc4ed4 --- /dev/null +++ b/tg/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "tg" { + content = "package tg // import \"github.com/terramate-io/terramate/tg\"" + filename = "${path.module}/mock-tg.ignore" +} diff --git a/tg/stack.tm.hcl b/tg/stack.tm.hcl new file mode 100644 index 0000000000..80adb5fcb8 --- /dev/null +++ b/tg/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package tg // import \"github.com/terramate-io/terramate/tg\"" + description = "package tg // import \"github.com/terramate-io/terramate/tg\"" + tags = ["golang", "tg"] + id = "99a9adef-11eb-47da-abae-68ff24d933fb" +} diff --git a/versions/_test_mock.tf b/versions/_test_mock.tf new file mode 100644 index 0000000000..0e1809c9ce --- /dev/null +++ b/versions/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +local_file "local_file" "versions" { + content = "package versions // import \"github.com/terramate-io/terramate/versions\"" + filename = "${path.module}/mock-versions.ignore" +} diff --git a/versions/stack.tm.hcl b/versions/stack.tm.hcl new file mode 100644 index 0000000000..8b1b9a5e0d --- /dev/null +++ b/versions/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package versions // import \"github.com/terramate-io/terramate/versions\"" + description = "package versions // import \"github.com/terramate-io/terramate/versions\"" + tags = ["golang", "versions"] + id = "fe9d75c0-35fa-4ac8-9200-30e6f4de7ea3" +}