Skip to content

Commit

Permalink
Feat: remove default terraform_version (#828)
Browse files Browse the repository at this point in the history
* Feat: remove default terraform_version

* Fix test

* Fix tests

* Fix tests

* Fix tests

* Fix tests
  • Loading branch information
TomerHeber committed Apr 17, 2024
1 parent 403ffa5 commit 6df42e0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
1 change: 0 additions & 1 deletion env0/resource_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
24 changes: 14 additions & 10 deletions env0/resource_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
}

Expand Down Expand Up @@ -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,
})
}

Expand Down Expand Up @@ -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),
Expand All @@ -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),
Expand Down
1 change: 1 addition & 0 deletions tests/integration/005_ssh_key/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
1 change: 1 addition & 0 deletions tests/integration/007_template_project_assignment/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ resource "env0_template" "test_template" {
description = "test template"
type = "terraform"
repository = "https://github.com/env0/templates"
terraform_version = "1.5.1"
}

resource "env0_project" "test_project" {
Expand Down

0 comments on commit 6df42e0

Please sign in to comment.