From e2ac75e70afae57e63e65baba86e372cc896dbbc Mon Sep 17 00:00:00 2001 From: Tomer Heber Date: Tue, 16 Apr 2024 14:50:10 -0500 Subject: [PATCH 1/6] Feat: remove default terraform_version --- env0/resource_template.go | 1 - 1 file changed, 1 deletion(-) diff --git a/env0/resource_template.go b/env0/resource_template.go index 8b23f76c..6b3bdd04 100644 --- a/env0/resource_template.go +++ b/env0/resource_template.go @@ -165,7 +165,6 @@ func getTemplateSchema(prefix string) map[string]*schema.Schema { Description: "the Terraform version to use (example: 0.15.1). Setting to `RESOLVE_FROM_TERRAFORM_CODE` defaults to the version of `terraform.required_version` during run-time (resolve from terraform code). Setting to `latest`, the version used will be the most recent one available for Terraform.", Optional: true, ValidateDiagFunc: NewRegexValidator(`^(?:[0-9]\.[0-9]{1,2}\.[0-9]{1,2})|RESOLVE_FROM_TERRAFORM_CODE|latest$`), - Default: "0.15.1", }, "terragrunt_version": { Type: schema.TypeString, From a331d9a43247dca1edccdd22b735bdb0a6a65f6c Mon Sep 17 00:00:00 2001 From: Tomer Heber Date: Tue, 16 Apr 2024 14:54:03 -0500 Subject: [PATCH 2/6] Fix test --- tests/integration/007_template_project_assignment/main.tf | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/integration/007_template_project_assignment/main.tf b/tests/integration/007_template_project_assignment/main.tf index 7bbc90ce..ebc0cef4 100644 --- a/tests/integration/007_template_project_assignment/main.tf +++ b/tests/integration/007_template_project_assignment/main.tf @@ -14,6 +14,7 @@ resource "env0_template" "test_template" { description = "test template" type = "terraform" repository = "https://github.com/env0/templates" + terraform_verison = "1.7.1" } resource "env0_project" "test_project" { From af4778977f3bc0cb702ebe3f347e2bec3a26cd63 Mon Sep 17 00:00:00 2001 From: Tomer Heber Date: Tue, 16 Apr 2024 14:58:07 -0500 Subject: [PATCH 3/6] Fix tests --- env0/resource_template_test.go | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/env0/resource_template_test.go b/env0/resource_template_test.go index 57fb4d25..384377de 100644 --- a/env0/resource_template_test.go +++ b/env0/resource_template_test.go @@ -734,8 +734,9 @@ func TestUnitTemplateResource(t *testing.T) { basicTemplateResourceConfig := func(resourceType string, resourceName string, template client.Template) string { return resourceConfigCreate(resourceType, resourceName, map[string]interface{}{ - "name": template.Name, - "repository": template.Repository, + "name": template.Name, + "repository": template.Repository, + "terraform_version": defaultVersion, }) } @@ -1014,8 +1015,9 @@ func TestUnitTemplateResource(t *testing.T) { basicTemplateResourceConfig := func(resourceType string, resourceName string, template client.Template) string { return resourceConfigCreate(resourceType, resourceName, map[string]interface{}{ - "name": template.Name, - "repository": template.Repository, + "name": template.Name, + "repository": template.Repository, + "terraform_version": defaultVersion, }) } @@ -1093,9 +1095,10 @@ func TestUnitTemplateResource(t *testing.T) { Steps: []resource.TestStep{ { Config: resourceConfigCreate(resourceType, resourceName, map[string]interface{}{ - "name": pathTemplate.Name, - "path": "/" + pathTemplate.Path, - "repository": pathTemplate.Repository, + "name": pathTemplate.Name, + "path": "/" + pathTemplate.Path, + "repository": pathTemplate.Repository, + "terraform_version": pathTemplate.TerraformVersion, }), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceFullName, "id", pathTemplate.Id), @@ -1108,9 +1111,10 @@ func TestUnitTemplateResource(t *testing.T) { }, { Config: resourceConfigCreate(resourceType, resourceName, map[string]interface{}{ - "name": updatedPathTemplate.Name, - "path": "/" + updatedPathTemplate.Path, - "repository": updatedPathTemplate.Repository, + "name": updatedPathTemplate.Name, + "path": "/" + updatedPathTemplate.Path, + "repository": updatedPathTemplate.Repository, + "terraform_version": updatedPathTemplate.TerraformVersion, }), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceFullName, "id", updatedPathTemplate.Id), From be69ca1bcc4010d67f449d44bcb13522415da068 Mon Sep 17 00:00:00 2001 From: Tomer Heber Date: Tue, 16 Apr 2024 15:00:04 -0500 Subject: [PATCH 4/6] Fix tests --- tests/integration/007_template_project_assignment/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/007_template_project_assignment/main.tf b/tests/integration/007_template_project_assignment/main.tf index ebc0cef4..435afa39 100644 --- a/tests/integration/007_template_project_assignment/main.tf +++ b/tests/integration/007_template_project_assignment/main.tf @@ -14,7 +14,7 @@ resource "env0_template" "test_template" { description = "test template" type = "terraform" repository = "https://github.com/env0/templates" - terraform_verison = "1.7.1" + terraform_version = "1.7.1" } resource "env0_project" "test_project" { From c237c13ef0cebcebf831bc1afd0b6b006e73e782 Mon Sep 17 00:00:00 2001 From: Tomer Heber Date: Tue, 16 Apr 2024 15:03:10 -0500 Subject: [PATCH 5/6] Fix tests --- tests/integration/007_template_project_assignment/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/007_template_project_assignment/main.tf b/tests/integration/007_template_project_assignment/main.tf index 435afa39..bb3beb73 100644 --- a/tests/integration/007_template_project_assignment/main.tf +++ b/tests/integration/007_template_project_assignment/main.tf @@ -14,7 +14,7 @@ resource "env0_template" "test_template" { description = "test template" type = "terraform" repository = "https://github.com/env0/templates" - terraform_version = "1.7.1" + terraform_version = "1.5.1" } resource "env0_project" "test_project" { From c99700b202268f5d023a8b405274801cd56dcbc5 Mon Sep 17 00:00:00 2001 From: Tomer Heber Date: Tue, 16 Apr 2024 15:06:46 -0500 Subject: [PATCH 6/6] Fix tests --- tests/integration/005_ssh_key/main.tf | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/integration/005_ssh_key/main.tf b/tests/integration/005_ssh_key/main.tf index d60049a9..1f640e00 100644 --- a/tests/integration/005_ssh_key/main.tf +++ b/tests/integration/005_ssh_key/main.tf @@ -35,4 +35,5 @@ resource "env0_template" "usage" { type = "terraform" repository = "https://github.com/env0/templates" ssh_keys = [env0_ssh_key.tested] + terraform_version = "1.3.1" }