Skip to content

Commit

Permalink
added 'latest' as a possible version
Browse files Browse the repository at this point in the history
  • Loading branch information
TomerHeber committed Aug 11, 2024
1 parent 8ecd0cc commit c212ba4
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion client/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func (payload *TemplateCreatePayload) Invalidate() error {
}
}

if payload.Type == "ansible" {
if payload.Type == "ansible" && payload.AnsibleVersion != "latest" {
if payload.AnsibleVersion == "" {
return errors.New("'ansible_version' is required")
}
Expand Down
2 changes: 1 addition & 1 deletion env0/resource_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func getTemplateSchema(prefix string) map[string]*schema.Schema {
Type: schema.TypeString,
Description: "the ansible version to use (required when the template type is 'ansible'). Supported versions are 3.0.0 and above",
Optional: true,
ValidateDiagFunc: NewRegexValidator(`^(?:[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2})|$`),
ValidateDiagFunc: NewRegexValidator(`^(?:[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2})|latest|$`),
Default: "",
},
}
Expand Down
2 changes: 1 addition & 1 deletion env0/resource_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ func TestUnitTemplateResource(t *testing.T) {
Description: "new-description",
Repository: "env0/repo-new",
Type: "ansible",
AnsibleVersion: "11.5.6",
AnsibleVersion: "latest",
Retry: client.TemplateRetry{
OnDeploy: &client.TemplateRetryOn{
Times: 2,
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/004_template/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ resource "env0_template" "template_ansible" {
retries_on_deploy = 3
retry_on_deploy_only_when_matches_regex = "abc"
retries_on_destroy = 1
ansible_version = var.second_run ? "3.6.0" : "9.5.0"
ansible_version = var.second_run ? "3.6.0" : "latest"
}

resource "env0_configuration_variable" "in_a_template" {
Expand Down

0 comments on commit c212ba4

Please sign in to comment.