Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: remove default terraform_version #828

Merged
merged 7 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading