diff --git a/.circleci/config.yml b/.circleci/config.yml index 462ea1f51..9d879a4f7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -8,7 +8,10 @@ env: &env environment: GRUNTWORK_INSTALLER_VERSION: v0.0.39 MODULE_CI_VERSION: v0.57.0 - TOFU_ENGINE_VERSION: "v0.0.9" + OPENTOFU_VERSION: "1.8.8" + TERRAFORM_VERSION: "1.9.7" + TFLINT_VERSION: "0.47.0" + TOFU_ENGINE_VERSION: "v0.0.11" defaults: &defaults docker: @@ -20,7 +23,6 @@ install_terraform_latest: &install_terraform_latest command: | pushd . cd /tmp - export TERRAFORM_VERSION=1.9.7 curl -L "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip" -o terraform.zip unzip -o terraform.zip sudo install -m 0755 terraform /usr/local/bin/terraform @@ -34,7 +36,7 @@ install_tofu: &install_tofu command: | pushd . cd /tmp - curl -L "https://github.com/opentofu/opentofu/releases/download/v1.8.3/tofu_1.8.3_linux_amd64.zip" -o tofu.zip + curl -L "https://github.com/opentofu/opentofu/releases/download/v${OPENTOFU_VERSION}/tofu_${OPENTOFU_VERSION}_linux_amd64.zip" -o tofu.zip unzip -o tofu.zip sudo install -m 0755 tofu /usr/local/bin/tofu rm -rf tofu @@ -49,7 +51,7 @@ install_tflint: &install_tflint command: | pushd . cd /tmp - curl -L "https://github.com/terraform-linters/tflint/releases/download/v0.47.0/tflint_linux_amd64.zip" -o tflint.zip + curl -L "https://github.com/terraform-linters/tflint/releases/download/v${TFLINT_VERSION}/tflint_linux_amd64.zip" -o tflint.zip unzip -o tflint.zip sudo install -m 0755 tflint /usr/local/bin/tflint rm -rf tflint @@ -151,6 +153,7 @@ jobs: executor: name: win/default size: "large" + <<: *env steps: - checkout - run: @@ -172,6 +175,7 @@ jobs: executor: name: win/default size: "large" + <<: *env steps: - checkout - run: @@ -197,6 +201,7 @@ jobs: # performance penalty. unit_test: <<: *defaults + <<: *env steps: - checkout # Run pre-commit hooks and fail the build if any hook finds required changes. @@ -237,6 +242,7 @@ jobs: integration_test_terraform_1_5: resource_class: xlarge <<: *defaults + <<: *env steps: - checkout - run: @@ -255,6 +261,7 @@ jobs: integration_test_terraform_with_provider_cache: resource_class: xlarge <<: *defaults + <<: *env steps: - checkout - run: @@ -275,6 +282,7 @@ jobs: integration_test_terraform_latest: resource_class: xlarge <<: *defaults + <<: *env steps: - checkout - run: @@ -295,6 +303,7 @@ jobs: integration_test_tofu: resource_class: xlarge <<: *defaults + <<: *env steps: - checkout - run: @@ -317,6 +326,7 @@ jobs: integration_test_tofu_with_provider_cache: resource_class: xlarge <<: *defaults + <<: *env steps: - checkout - run: @@ -494,6 +504,7 @@ jobs: strict_lint: resource_class: medium <<: *defaults + <<: *env steps: - checkout # The `run-strict-lint` target requires the `main` ref for comparison. @@ -508,6 +519,7 @@ jobs: integration_test_tflint: resource_class: large <<: *defaults + <<: *env steps: - checkout - run: @@ -528,6 +540,7 @@ jobs: race_test: resource_class: medium <<: *defaults + <<: *env steps: - checkout - run: diff --git a/_ci/install-opentofu.ps1 b/_ci/install-opentofu.ps1 index 2d95bb5fc..4ddce4905 100755 --- a/_ci/install-opentofu.ps1 +++ b/_ci/install-opentofu.ps1 @@ -2,14 +2,15 @@ OpenTofuInstallPath = "C:\Program Files\tofu\tofu.exe" $OpenTofuTmpPath = "C:\OpenTofutmp" $OpenTofuTmpBinaryPath = "C:\OpenTofutmp\tofu.exe" $OpenTofuPath = "C:\Program Files\tofu" +$OpenTofuVersion = $Env:OPENTOFU_VERSION # Remove any old OpenTofu installation, if present if (Test-Path -Path $OpenTofuInstallPath) { Remove-Item $OpenTofuInstallPath -Recurse } # Download OpenTofu and unpack it -$OpenTofuURI = "https://github.com/opentofu/opentofu/releases/download/v1.8.3/tofu_1.8.3_windows_amd64.zip" -$output = "tofu_1.8.3_windows_amd64.zip" +$OpenTofuURI = "https://github.com/opentofu/opentofu/releases/download/v$OpenTofuVersion/tofu_${OpenTofuVersion}_windows_amd64.zip" +$output = "tofu_${OpenTofuVersion}_windows_amd64.zip" $ProgressPreference = "SilentlyContinue" Invoke-WebRequest -Uri $OpenTofuURI -OutFile $output New-Item -ItemType "directory" -Path $OpenTofuTmpPath diff --git a/_ci/install-terraform.ps1 b/_ci/install-terraform.ps1 index 45535a90d..02ad702f0 100755 --- a/_ci/install-terraform.ps1 +++ b/_ci/install-terraform.ps1 @@ -1,5 +1,6 @@ # Install terraform using Chocolatey -choco install terraform --version 1.9.7 -y +$TerraformVersion = $Env:TERRAFORM_VERSION +choco install terraform --version $TerraformVersion -y # Verify installation Get-Command terraform terraform version diff --git a/config/config_partial.go b/config/config_partial.go index 996b135f1..2833e9b3b 100644 --- a/config/config_partial.go +++ b/config/config_partial.go @@ -6,8 +6,7 @@ import ( "path/filepath" "github.com/gruntwork-io/terragrunt/internal/strict" - - clone "github.com/huandu/go-clone" + "github.com/huandu/go-clone" "github.com/gruntwork-io/terragrunt/internal/cache" @@ -290,7 +289,7 @@ func PartialParseConfigFile(ctx *ParsingContext, configPath string, include *Inc func TerragruntConfigFromPartialConfig(ctx *ParsingContext, file *hclparse.File, includeFromChild *IncludeConfig) (*TerragruntConfig, error) { var cacheKey = fmt.Sprintf("%#v-%#v-%#v-%#v", file.ConfigPath, file.Content(), includeFromChild, ctx.PartialParseDecodeList) - terragruntConfigCache := cache.ContextCache[*TerragruntConfig](ctx, RunCmdCacheContextKey) + terragruntConfigCache := cache.ContextCache[*TerragruntConfig](ctx, TerragruntConfigCacheContextKey) if ctx.TerragruntOptions.UsePartialParseConfigCache { if config, found := terragruntConfigCache.Get(ctx, cacheKey); found { ctx.TerragruntOptions.Logger.Debugf("Cache hit for '%s' (partial parsing), decodeList: '%v'.", ctx.TerragruntOptions.TerragruntConfigPath, ctx.PartialParseDecodeList) diff --git a/engine/engine.go b/engine/engine.go index 2c3507219..dc97157ab 100644 --- a/engine/engine.go +++ b/engine/engine.go @@ -40,12 +40,12 @@ const ( engineCookieKey = "engine" engineCookieValue = "terragrunt" - defaultCacheDir = ".cache" - defaultEngineCachePath = "terragrunt/plugins/iac-engine" - prefixTrim = "terragrunt-" - fileNameFormat = "terragrunt-iac-%s_%s_%s_%s_%s" - checksumFileNameFormat = "terragrunt-iac-%s_%s_%s_SHA256SUMS" - + defaultCacheDir = ".cache" + defaultEngineCachePath = "terragrunt/plugins/iac-engine" + prefixTrim = "terragrunt-" + fileNameFormat = "terragrunt-iac-%s_%s_%s_%s_%s" + checksumFileNameFormat = "terragrunt-iac-%s_%s_%s_SHA256SUMS" + engineLogLevelEnv = "TG_ENGINE_LOG_LEVEL" defaultEngineRepoRoot = "github.com/" terraformCommandContextKey engineClientsKey = iota locksContextKey engineLocksKey = iota @@ -517,6 +517,8 @@ func createEngine(terragruntOptions *options.TerragruntOptions) (*proto.EngineCl }) cmd := exec.Command(localEnginePath) + // pass log level to engine + cmd.Env = append(cmd.Env, fmt.Sprintf("%s=%s", engineLogLevelEnv, engineLogLevel)) client := plugin.NewClient(&plugin.ClientConfig{ Logger: logger, HandshakeConfig: plugin.HandshakeConfig{