Skip to content

Commit

Permalink
Feat: support resolving terraform version from code for template reso…
Browse files Browse the repository at this point in the history
…urce (#388)
  • Loading branch information
TomerHeber committed May 20, 2022
1 parent 68281e1 commit d178e56
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions env0/resource_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ func resourceTemplate() *schema.Resource {
},
"terraform_version": {
Type: schema.TypeString,
Description: "the Terraform version to use (example: 0.15.1)",
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).",
Optional: true,
ValidateDiagFunc: NewRegexValidator(`^[0-9]\.[0-9]{1,2}\.[0-9]{1,2}$`),
ValidateDiagFunc: NewRegexValidator(`^(?:[0-9]\.[0-9]{1,2}\.[0-9]{1,2})|RESOLVE_FROM_TERRAFORM_CODE$`),
Default: "0.15.1",
},
"terragrunt_version": {
Expand Down
13 changes: 13 additions & 0 deletions tests/integration/004_template/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ resource "env0_template" "github_template" {
terraform_version = "0.15.1"
}

resource "env0_template" "github_template_resolve" {
name = "Github Test Resolve-${random_string.random.result}"
description = "Template description - GitHub"
type = "terraform"
repository = data.env0_template.github_template.repository
github_installation_id = data.env0_template.github_template.github_installation_id
path = "misc/null-resource"
retries_on_deploy = 3
retry_on_deploy_only_when_matches_regex = "abc"
retries_on_destroy = 1
terraform_version = "RESOLVE_FROM_TERRAFORM_CODE"
}

#resource "env0_template" "gitlab_template" {
# name = "gitlab test-${random_string.random.result}"
# description = "template description - gitlab"
Expand Down

0 comments on commit d178e56

Please sign in to comment.