diff --git a/env0/resource_template.go b/env0/resource_template.go index 6b21048a..8b23f76c 100644 --- a/env0/resource_template.go +++ b/env0/resource_template.go @@ -426,14 +426,17 @@ func templateCreatePayloadFromParameters(prefix string, d *schema.ResourceData) func templateRead(prefix string, template client.Template, d *schema.ResourceData) error { pathPrefix := "path" terragruntTfBinaryPrefix := "terragrunt_tf_binary" + terraformVersionPrefix := "terraform_version" if prefix != "" { pathPrefix = prefix + ".0." + pathPrefix terragruntTfBinaryPrefix = prefix + ".0." + terragruntTfBinaryPrefix + terraformVersionPrefix = prefix + ".0." + terraformVersionPrefix } path, pathOk := d.GetOk(pathPrefix) terragruntTfBinary := d.Get(terragruntTfBinaryPrefix).(string) + terraformVersion := d.Get(terraformVersionPrefix).(string) // If this value isn't set, ignore whatever is returned from the response. // This helps avoid drifts when defaulting to 'opentofu' for new 'terragrunt' templates, and 'terraform' for existing 'terragrunt' templates. @@ -441,6 +444,10 @@ func templateRead(prefix string, template client.Template, d *schema.ResourceDat if terragruntTfBinary == "" { template.TerragruntTfBinary = "" } + // Same explanation as above. + if terraformVersion == "" { + template.TerraformVersion = "" + } if err := writeResourceDataEx(prefix, &template, d); err != nil { return fmt.Errorf("schema resource data serialization failed: %v", err) diff --git a/tests/harness.go b/tests/harness.go index 59b4f2ef..677077df 100644 --- a/tests/harness.go +++ b/tests/harness.go @@ -39,7 +39,7 @@ func main() { } else { success, err := runTest(testName, destroyMode != "NO_DESTROY") if !success { - log.Fatalln("Halting due to test failure:", err) + log.Fatalf("Halting due to test '%s' failure: %s\n", testName, err.Error()) } }