From 64a1856f2695fe1c24658fe8fc66090e83c7a530 Mon Sep 17 00:00:00 2001 From: Ryan Russell Date: Mon, 6 May 2024 10:07:23 -0700 Subject: [PATCH] LIB-74: Replace tfenv and tgswitch with mise (#1405) --- .circleci/config.yml | 8 +++++++- modules/files/files.go | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 162c7a90b..3e352f023 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,6 +3,7 @@ env: &env GRUNTWORK_INSTALLER_VERSION: v0.0.36 MODULE_CI_VERSION: v0.46.0 MODULE_GCP_CI_VERSION: v0.1.1 + MODULE_CI_CIRCLECI_HELPER_VERSION: v0.56.0 TERRAFORM_VERSION: 1.5.7 PACKER_VERSION: 1.7.4 TERRAGRUNT_VERSION: v0.52.0 @@ -14,6 +15,10 @@ env: &env HELM_VERSION: v3.13.1 KUBECONFIG: /home/circleci/.kube/config BIN_BUILD_PARALLELISM: 3 + MISE_VERSION: v2024.4.0 + # Mise ASDF defaults to using main.tf to determine the terraform version to use, so we need to + # override this to use the .terraform-version file instead. + ASDF_HASHICORP_TERRAFORM_VERSION_FILE: .terraform-version defaults: &defaults machine: @@ -40,10 +45,11 @@ install_gruntwork_utils: &install_gruntwork_utils name: install gruntwork utils command: | curl -Ls https://raw.githubusercontent.com/gruntwork-io/gruntwork-installer/master/bootstrap-gruntwork-installer.sh | bash /dev/stdin --version "${GRUNTWORK_INSTALLER_VERSION}" - gruntwork-install --module-name "gruntwork-module-circleci-helpers" --repo "https://github.com/gruntwork-io/terraform-aws-ci" --tag "${MODULE_CI_VERSION}" + gruntwork-install --module-name "gruntwork-module-circleci-helpers" --repo "https://github.com/gruntwork-io/terraform-aws-ci" --tag "${MODULE_CI_CIRCLECI_HELPER_VERSION}" gruntwork-install --module-name "kubernetes-circleci-helpers" --repo "https://github.com/gruntwork-io/terraform-aws-ci" --tag "${MODULE_CI_VERSION}" gruntwork-install --module-name "gcp-helpers" --repo "https://github.com/gruntwork-io/terraform-google-ci" --tag "${MODULE_GCP_CI_VERSION}" configure-environment-for-gruntwork-module \ + --mise-version ${MISE_VERSION} \ --terraform-version ${TERRAFORM_VERSION} \ --terragrunt-version ${TERRAGRUNT_VERSION} \ --packer-version ${PACKER_VERSION} \ diff --git a/modules/files/files.go b/modules/files/files.go index c4b58b372..40525e98e 100644 --- a/modules/files/files.go +++ b/modules/files/files.go @@ -42,7 +42,7 @@ func IsExistingDir(path string) bool { // This is useful when running multiple tests in parallel against the same set of Terraform files to ensure the // tests don't overwrite each other's .terraform working directory and terraform.tfstate files. This method returns // the path to the dest folder with the copied contents. Hidden files and folders (with the exception of the `.terraform-version` files used -// by the [tfenv tool](https://github.com/tfutils/tfenv) and `.terraform.lock.hcl` used by Terraform to lock providers versions), Terraform state +// by the [mise tool](https://github.com/jdx/mise) and `.terraform.lock.hcl` used by Terraform to lock providers versions), Terraform state // files, and terraform.tfvars files are not copied to this temp folder, as you typically don't want them interfering with your tests. // This method is useful when running through a build tool so the files are copied to a destination that is cleaned on each run of the pipeline. func CopyTerraformFolderToDest(folderPath string, destRootFolder string, tempFolderPrefix string) (string, error) { @@ -205,7 +205,7 @@ func PathContainsHiddenFileOrFolder(path string) bool { return false } -// PathIsTerraformVersionFile returns true if the given path is the special '.terraform-version' file used by the [tfenv](https://github.com/tfutils/tfenv) tool. +// PathIsTerraformVersionFile returns true if the given path is the special '.terraform-version' file used by the [mise](https://github.com/jdx/mise) tool. func PathIsTerraformVersionFile(path string) bool { return filepath.Base(path) == ".terraform-version" }