diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 6356649771..a6fa97c5bb 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -22,7 +22,7 @@ The contribution guideline will change in the near future, as the management of ## Proposing a Change -In order to be respectful of the time of community contributors, we aim to discuss potential changes in GitHub issues prior to implementation. That will allow us to give design feedback up front and set expectations about the scope of the change, and, for larger changes, how best to approach the work such that the Terraform team can review it and merge it along with other concurrent work. +In order to be respectful of the time of community contributors, we aim to discuss potential changes in GitHub issues prior to implementation. That will allow us to give design feedback up front and set expectations about the scope of the change, and, for larger changes, how best to approach the work such that the OpenTF team can review it and merge it along with other concurrent work. If the bug you wish to fix or enhancement you wish to implement isn't already covered by a GitHub issue, please do start a discussion (either in [a new GitHub issue](https://github.com/placeholderplaceholderplaceholder/opentf/issues/new/choose) or an existing one, as appropriate) before you invest significant development time. diff --git a/.github/actions/equivalence-test/action.yml b/.github/actions/equivalence-test/action.yml deleted file mode 100644 index 83355f4bac..0000000000 --- a/.github/actions/equivalence-test/action.yml +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright (c) HashiCorp, Inc. -# SPDX-License-Identifier: MPL-2.0 - -name: equivalence-test -description: "Execute the suite of Terraform equivalence tests in testing/equivalence-tests" -inputs: - target-terraform-version: - description: "The version of Terraform to use in execution." - required: true - target-terraform-branch: - description: "The branch within this repository to update and compare." - required: true - target-equivalence-test-version: - description: "The version of the Terraform equivalence tests to use." - default: "0.3.0" - target-os: - description: "Current operating system" - default: "linux" - target-arch: - description: "Current architecture" - default: "amd64" -runs: - using: "composite" - steps: - - name: "download equivalence test binary" - shell: bash - run: | - ./.github/scripts/equivalence-test.sh download_equivalence_test_binary \ - ${{ inputs.target-equivalence-test-version }} \ - ./bin/equivalence-tests \ - ${{ inputs.target-os }} \ - ${{ inputs.target-arch }} - - name: "download opentf binary" - shell: bash - run: | - ./.github/scripts/equivalence-test.sh download_terraform_binary \ - ${{ inputs.target-terraform-version }} \ - ./bin/terraform \ - ${{ inputs.target-os }} \ - ${{ inputs.target-arch }} - - name: "run and update equivalence tests" - shell: bash - run: | - ./bin/equivalence-tests update \ - --tests=testing/equivalence-tests/tests \ - --goldens=testing/equivalence-tests/outputs \ - --binary=$(pwd)/bin/terraform - - changed=$(git diff --quiet -- testing/equivalence-tests/outputs || echo true) - if [[ $changed == "true" ]]; then - echo "found changes, and pushing new golden files into branch ${{ inputs.target-terraform-branch }}." - - git config user.email "52939924+teamterraform@users.noreply.github.com" - git config user.name "The OpenTF Team" - - git add ./testing/equivalence-tests/outputs - git commit -m "Automated equivalence test golden file update for release ${{ inputs.target-terraform-version }}." - git push - else - echo "found no changes, so not pushing any updates." - fi diff --git a/.github/scripts/e2e_test_linux_darwin.sh b/.github/scripts/e2e_test_linux_darwin.sh index 7d0cb81ea4..19016b172f 100755 --- a/.github/scripts/e2e_test_linux_darwin.sh +++ b/.github/scripts/e2e_test_linux_darwin.sh @@ -7,12 +7,12 @@ set -uo pipefail if [[ $arch == 'arm' || $arch == 'arm64' ]] then export DIR=$(mktemp -d) - unzip -d $DIR "${e2e_cache_path}/terraform-e2etest_${os}_${arch}.zip" + unzip -d $DIR "${e2e_cache_path}/opentf-e2etest_${os}_${arch}.zip" unzip -d $DIR "./opentf_${version}_${os}_${arch}.zip" sudo chmod +x $DIR/e2etest docker run --platform=linux/arm64 -v $DIR:/src -w /src arm64v8/alpine ./e2etest -test.v else - unzip "${e2e_cache_path}/terraform-e2etest_${os}_${arch}.zip" + unzip "${e2e_cache_path}/opentf-e2etest_${os}_${arch}.zip" unzip "./opentf_${version}_${os}_${arch}.zip" TF_ACC=1 ./e2etest -test.v fi diff --git a/.github/scripts/equivalence-test.sh b/.github/scripts/equivalence-test.sh index e82ce32637..dc95620168 100755 --- a/.github/scripts/equivalence-test.sh +++ b/.github/scripts/equivalence-test.sh @@ -10,27 +10,14 @@ Usage: ./equivalence-test.sh [] [] Description: This script will handle various commands related to the execution of the - Terraform equivalence tests. + opentf equivalence tests. Commands: - get_target_branch - get_target_branch returns the default target branch for a given Terraform - version. - - target_branch=$(./equivalence-test.sh get_target_branch v1.4.3); target_branch=v1.4 - target_branch=$(./equivalence-test.sh get_target_branch 1.4.3); target_branch=v1.4 - download_equivalence_test_binary download_equivalence_test_binary downloads the equivalence testing binary for a given version and places it at the target path. - ./equivalence-test.sh download_equivalence_test_binary 0.3.0 ./bin/terraform-equivalence-testing linux amd64 - - download_terraform_binary - download_terraform_binary downloads the terraform release binary for a given - version and places it at the target path. - - ./equivalence-test.sh download_terraform_binary 1.4.3 ./bin/terraform linux amd64 + ./equivalence-test.sh download_equivalence_test_binary 0.3.0 ./bin/opentf-equivalence-testing linux amd64 EOF } @@ -50,7 +37,7 @@ function download_equivalence_test_binary { -H "Accept: application/vnd.github+json" \ "https://api.github.com/repos/hashicorp/terraform-equivalence-testing/releases" > releases.json - ASSET="terraform-equivalence-testing_v${VERSION}_${OS}_${ARCH}.zip" + ASSET="opentf-equivalence-testing_v${VERSION}_${OS}_${ARCH}.zip" ASSET_ID=$(jq -r --arg VERSION "v$VERSION" --arg ASSET "$ASSET" '.[] | select(.name == $VERSION) | .assets[] | select(.name == $ASSET) | .id' releases.json) mkdir -p zip @@ -65,73 +52,8 @@ function download_equivalence_test_binary { rm releases.json } -function download_terraform_binary { - VERSION="${1:-}" - TARGET="${2:-}" - OS="${3:-}" - ARCH="${4:-}" - - if [[ -z "$VERSION" || -z "$TARGET" || -z "$OS" || -z "$ARCH" ]]; then - echo "missing at least one of [, , , ] arguments" - usage - exit 1 - fi - - mkdir -p zip - curl "https://releases.hashicorp.com/terraform/${VERSION}/terraform_${VERSION}_${OS}_${ARCH}.zip" > "zip/terraform.zip" - - mkdir -p bin - unzip -p "zip/terraform.zip" terraform > "$TARGET" - chmod u+x "$TARGET" - rm -r zip -} - -function get_target_branch { - VERSION="${1:-}" - - if [ -z "$VERSION" ]; then - echo "missing argument" - usage - exit 1 - fi - - - # Split off the build metadata part, if any - # (we won't actually include it in our final version, and handle it only for - # completeness against semver syntax.) - IFS='+' read -ra VERSION BUILD_META <<< "$VERSION" - - # Separate out the prerelease part, if any - IFS='-' read -r BASE_VERSION PRERELEASE <<< "$VERSION" - - # Separate out major, minor and patch versions. - IFS='.' read -r MAJOR_VERSION MINOR_VERSION PATCH_VERSION <<< "$BASE_VERSION" - - if [[ "$PRERELEASE" == *"alpha"* ]]; then - TARGET_BRANCH=main - else - if [[ $MAJOR_VERSION = v* ]]; then - TARGET_BRANCH=${MAJOR_VERSION}.${MINOR_VERSION} - else - TARGET_BRANCH=v${MAJOR_VERSION}.${MINOR_VERSION} - fi - fi - - echo "$TARGET_BRANCH" -} - function main { case "$1" in - get_target_branch) - if [ "${#@}" != 2 ]; then - echo "invalid number of arguments" - usage - exit 1 - fi - - get_target_branch "$2" - - ;; download_equivalence_test_binary) if [ "${#@}" != 5 ]; then echo "invalid number of arguments" @@ -141,16 +63,6 @@ function main { download_equivalence_test_binary "$2" "$3" "$4" "$5" - ;; - download_terraform_binary) - if [ "${#@}" != 5 ]; then - echo "invalid number of arguments" - usage - exit 1 - fi - - download_terraform_binary "$2" "$3" "$4" "$5" - ;; *) echo "unrecognized command $*" diff --git a/.github/scripts/get_product_version.sh b/.github/scripts/get_product_version.sh index a3a5a71add..ff12d3f4df 100755 --- a/.github/scripts/get_product_version.sh +++ b/.github/scripts/get_product_version.sh @@ -30,7 +30,7 @@ LDFLAGS="${LDFLAGS} -X 'main.experimentsAllowed=yes'" fi LDFLAGS="${LDFLAGS} -X 'github.com/placeholderplaceholderplaceholder/opentf/version.dev=no'" -echo "Building Terraform CLI ${VERSION}" +echo "Building OpenTF CLI ${VERSION}" if [[ "$EXPERIMENTS_ENABLED" == 1 ]]; then echo "This build allows use of experimental features" fi diff --git a/.github/workflows/build-Dockerfile b/.github/workflows/build-Dockerfile index e4b4658512..6be0aeeca6 100644 --- a/.github/workflows/build-Dockerfile +++ b/.github/workflows/build-Dockerfile @@ -4,7 +4,7 @@ # # If you want to test this locally you'll need to set the three arguments # to values realistic for what the hashicorp/actions-docker-build GitHub -# action would set, and ensure that there's a suitable "terraform" executable +# action would set, and ensure that there's a suitable "opentf" executable # in the dist/linux/${TARGETARCH} directory. FROM docker.mirror.hashicorp.services/alpine:latest AS default @@ -13,21 +13,21 @@ FROM docker.mirror.hashicorp.services/alpine:latest AS default # action, which sets these appropriately based on context. ARG PRODUCT_VERSION=UNSPECIFIED ARG PRODUCT_REVISION=UNSPECIFIED -ARG BIN_NAME=terraform +ARG BIN_NAME=opentf # This argument is set by the Docker toolchain itself, to the name # of the CPU architecture we're building an image for. -# Our caller should've extracted the corresponding "terraform" executable +# Our caller should've extracted the corresponding "opentf" executable # into dist/linux/${TARGETARCH} for us to use. ARG TARGETARCH -LABEL maintainer="HashiCorp Terraform Team " +LABEL maintainer="OpenTF Team" # New standard version label. LABEL version=$PRODUCT_VERSION -# Historical Terraform-specific label preserved for backward compatibility. -LABEL "com.hashicorp.terraform.version"="${PRODUCT_VERSION}" +# Historical OpenTF-specific label preserved for backward compatibility. +LABEL "com.opentf.version"="${PRODUCT_VERSION}" RUN apk add --no-cache git openssh diff --git a/.github/workflows/build-terraform-oss.yml b/.github/workflows/build-opentf-oss.yml similarity index 84% rename from .github/workflows/build-terraform-oss.yml rename to .github/workflows/build-opentf-oss.yml index 5b485267bd..9f67fb638d 100644 --- a/.github/workflows/build-terraform-oss.yml +++ b/.github/workflows/build-opentf-oss.yml @@ -1,9 +1,9 @@ --- -name: build_terraform +name: build_opentf # This workflow is intended to be called by the build workflow. The crt make # targets that are utilized automatically determine build metadata and -# handle building and packing Terraform. +# handle building and packing OpenTF. on: workflow_call: @@ -22,7 +22,7 @@ on: type: string package-name: type: string - default: terraform + default: opentf product-version: type: string required: true @@ -36,7 +36,7 @@ on: jobs: build: runs-on: ${{ inputs.runson }} - name: Terraform ${{ inputs.goos }} ${{ inputs.goarch }} v${{ inputs.product-version }} + name: OpenTF ${{ inputs.goos }} ${{ inputs.goarch }} v${{ inputs.product-version }} steps: - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 @@ -44,7 +44,7 @@ jobs: go-version: ${{ inputs.go-version }} - name: Determine artifact basename run: echo "ARTIFACT_BASENAME=${{ inputs.package-name }}_${{ inputs.product-version }}_${{ inputs.goos }}_${{ inputs.goarch }}.zip" >> $GITHUB_ENV - - name: Build Terraform + - name: Build OpenTF env: GOOS: ${{ inputs.goos }} GOARCH: ${{ inputs.goarch }} @@ -72,12 +72,12 @@ jobs: - if: ${{ inputs.goos == 'linux' }} uses: hashicorp/actions-packaging-linux@v1 with: - name: "terraform" - description: "Terraform enables you to safely and predictably create, change, and improve infrastructure. It is an open source tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned." + name: "opentf" + description: "OpenTF enables you to safely and predictably create, change, and improve infrastructure. It is an open source tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned." arch: ${{ inputs.goarch }} version: ${{ inputs.product-version }} maintainer: "HashiCorp" - homepage: "https://terraform.io/" + homepage: "https://opentf.org/" license: "MPL-2.0" binary: "dist/opentf" deb_depends: "git" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0dd6422912..5a73783236 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,7 @@ permissions: jobs: get-product-version: - name: "Determine intended Terraform version" + name: "Determine intended OpenTF version" runs-on: ubuntu-latest outputs: product-version: ${{ steps.get-product-version.outputs.product-version }} @@ -53,7 +53,7 @@ jobs: - name: Report chosen version number run: | [ -n "${{steps.get-product-version.outputs.product-version}}" ] - echo "::notice title=Terraform CLI Version::${{ steps.get-product-version.outputs.product-version }}" + echo "::notice title=OpenTF CLI Version::${{ steps.get-product-version.outputs.product-version }}" get-go-version: name: "Determine Go toolchain version" @@ -93,7 +93,7 @@ jobs: needs: - get-product-version - get-go-version - uses: ./.github/workflows/build-terraform-oss.yml + uses: ./.github/workflows/build-opentf-oss.yml with: goarch: ${{ matrix.goarch }} goos: ${{ matrix.goos }} @@ -134,7 +134,7 @@ jobs: arch: ["amd64", "386", "arm", "arm64"] fail-fast: false env: - repo: "terraform" + repo: "opentf" version: ${{needs.get-product-version.outputs.product-version}} steps: - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 @@ -201,7 +201,7 @@ jobs: # NOTE: This script reacts to the GOOS, GOARCH, and GO_LDFLAGS # environment variables defined above. The e2e test harness # needs to know the version we're building for so it can verify - # that "terraform version" is returning that version number. + # that "opentf version" is returning that version number. bash ./internal/command/e2etest/make-archive.sh - name: Save test harness to cache @@ -252,7 +252,7 @@ jobs: key: ${{ needs.e2etest-build.outputs.e2e-cache-key }}_${{ matrix.goos }}_${{ matrix.goarch }} fail-on-cache-miss: true enableCrossOsArchive: true - - name: "Download Terraform CLI package" + - name: "Download OpenTF CLI package" uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 id: clipkg with: @@ -261,7 +261,7 @@ jobs: - name: Extract packages if: ${{ matrix.goos == 'windows' }} run: | - unzip "${{ needs.e2etest-build.outputs.e2e-cache-path }}/terraform-e2etest_${{ env.os }}_${{ env.arch }}.zip" + unzip "${{ needs.e2etest-build.outputs.e2e-cache-path }}/opentf-e2etest_${{ env.os }}_${{ env.arch }}.zip" unzip "./opentf_${{env.version}}_${{ env.os }}_${{ env.arch }}.zip" - name: Set up QEMU uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2.2.0 @@ -284,7 +284,7 @@ jobs: e2e-test-exec: - name: Run terraform-exec test for linux amd64 + name: Run opentf-exec test for linux amd64 runs-on: ubuntu-latest needs: - get-product-version @@ -301,21 +301,21 @@ jobs: uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 with: go-version: ${{ needs.get-go-version.outputs.go-version }} - - name: Download Terraform CLI package + - name: Download OpenTF CLI package uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 id: clipkg with: name: opentf_${{ env.version }}_linux_amd64.zip path: . - - name: Checkout terraform-exec repo + - name: Checkout opentf-exec repo uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: - repository: hashicorp/terraform-exec - path: terraform-exec - - name: Run terraform-exec end-to-end tests + repository: hashicorp/opentf-exec + path: opentf-exec + - name: Run opentf-exec end-to-end tests run: | FULL_RELEASE_VERSION="${{ env.version }}" unzip opentf_${FULL_RELEASE_VERSION}_linux_amd64.zip export TFEXEC_E2ETEST_TERRAFORM_PATH="$(pwd)/opentf" - cd terraform-exec + cd opentf-exec go test -race -timeout=30m -v ./tfexec/internal/e2etest diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 10286a09b8..7087788177 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -100,7 +100,7 @@ jobs: e2e-tests: # This is an intentionally-limited form of our E2E test run which only - # covers Terraform running on Linux. The build.yml workflow runs these + # covers OpenTF running on Linux. The build.yml workflow runs these # tests across various other platforms in order to catch the rare exception # that might leak through this. name: "End-to-end Tests" diff --git a/.github/workflows/crt-hook-equivalence-tests.yml b/.github/workflows/crt-hook-equivalence-tests.yml deleted file mode 100644 index 3bffd2cd13..0000000000 --- a/.github/workflows/crt-hook-equivalence-tests.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: crt-hook-equivalence-tests - -on: - repository_dispatch: - types: - - crt-hook-equivalence-tests::terraform::* - -permissions: - contents: write - -jobs: - parse-metadata: - name: "Parse metadata.json" - runs-on: ubuntu-latest - outputs: - version: ${{ steps.parse.outputs.version }} - target-branch: ${{ steps.parse.outputs.target-branch }} - steps: - - name: parse - id: parse - env: - METADATA_PAYLOAD: ${{ toJSON(github.event.client_payload.payload) }} - run: | - VERSION=$(echo ${METADATA_PAYLOAD} | jq -r '.version') - TARGET_BRANCH=$(./.github/scripts/equivalence-test.sh get-target-branch "$VERSION") - - echo "target-branch=$TARGET_BRANCH" >> "GITHUB_OUTPUT" - echo "version=$VERSION" >> "$GITHUB_OUTPUT" - - run-equivalence-tests: - runs-on: ubuntu-latest - name: "Run equivalence tests" - needs: - - parse-metadata - steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - ref: ${{ needs.parse-metadata.outputs.target-branch }} - - uses: ./.github/actions/equivalence-test - with: - target-terraform-version: ${{ needs.parse-metadata.outputs.version }} - target-terraform-branch: ${{ needs.parse-metadata.outputs.target-branch }} - target-equivalence-test-version: 0.3.0 - target-os: linux - target-arch: amd64 diff --git a/.github/workflows/manual-equivalence-tests.yml b/.github/workflows/manual-equivalence-tests.yml deleted file mode 100644 index 648aac8044..0000000000 --- a/.github/workflows/manual-equivalence-tests.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: manual-equivalence-tests - -on: - workflow_dispatch: - inputs: - target-branch: - type: string - description: "Which branch should be updated?" - required: true - terraform-version: - type: string - description: "Terraform version to run against (no v prefix, eg. 1.4.4)." - required: true - equivalence-test-version: - type: string - description: 'Equivalence testing framework version to use (no v prefix, eg. 0.3.0).' - default: "0.3.0" - required: true - -permissions: - contents: write # We push updates to the equivalence tests back into the repository. - -jobs: - run-equivalence-tests: - name: "Run equivalence tests" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - ref: ${{ inputs.target-branch }} - - uses: ./.github/actions/equivalence-test - with: - target-terraform-version: ${{ inputs.terraform-version }} - target-terraform-branch: ${{ inputs.target-branch }} - target-equivalence-test-version: ${{ inputs.equivalence-test-version }} - target-os: linux - target-arch: amd64 diff --git a/.release/release-metadata.hcl b/.release/release-metadata.hcl index 1f4ee6272f..f052a22386 100644 --- a/.release/release-metadata.hcl +++ b/.release/release-metadata.hcl @@ -1,6 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 +url_docker_registry_dockerhub = "https://hub.docker.com/r/hashicorp/terraform" +url_docker_registry_ecr = "https://gallery.ecr.aws/hashicorp/terraform" url_license = "https://github.com/placeholderplaceholderplaceholder/opentf/blob/main/LICENSE" url_project_website = "https://www.placeholderplaceholderplaceholder.io" url_source_repository = "https://github.com/opentffoundation/opentf" diff --git a/internal/command/e2etest/make-archive.sh b/internal/command/e2etest/make-archive.sh index f737dfd2b9..a9f8be9ed2 100755 --- a/internal/command/e2etest/make-archive.sh +++ b/internal/command/e2etest/make-archive.sh @@ -32,7 +32,7 @@ GOOS="$(go env GOOS)" GOARCH="$(go env GOARCH)" GOEXE="$(go env GOEXE)" OUTDIR="build/${GOOS}_${GOARCH}" -OUTFILE="terraform-e2etest_${GOOS}_${GOARCH}.zip" +OUTFILE="opentf-e2etest_${GOOS}_${GOARCH}.zip" LDFLAGS="-X github.com/placeholderplaceholderplaceholder/opentf/internal/command/e2etest.terraformBin=./opentf$GOEXE" # Caller may pass in the environment variable GO_LDFLAGS with additional