Skip to content

Commit

Permalink
Fix: unable to unset auto_deploy_by_custom_glob property of environme… (
Browse files Browse the repository at this point in the history
#720)

* Fix: unable to unset auto_deploy_by_custom_glob property of environment resource back to empty string or null

* added an integration test

* added an integration test

* added an integration test

* added an integration test

* added an integration test
  • Loading branch information
TomerHeber committed Oct 5, 2023
1 parent 04bfe29 commit fb62b8d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion client/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ type EnvironmentCreate struct {
ContinuousDeployment *bool `json:"continuousDeployment,omitempty" tfschema:"-"`
PullRequestPlanDeployments *bool `json:"pullRequestPlanDeployments,omitempty" tfschema:"-"`
AutoDeployOnPathChangesOnly *bool `json:"autoDeployOnPathChangesOnly,omitempty" tfchema:"-"`
AutoDeployByCustomGlob string `json:"autoDeployByCustomGlob,omitempty"`
AutoDeployByCustomGlob string `json:"autoDeployByCustomGlob"`
ConfigurationChanges *ConfigurationChanges `json:"configurationChanges,omitempty" tfschema:"-"`
TTL *TTL `json:"ttl,omitempty" tfschema:"-"`
TerragruntWorkingDirectory string `json:"terragruntWorkingDirectory,omitempty"`
Expand Down
27 changes: 22 additions & 5 deletions tests/integration/012_environment/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,36 @@ resource "env0_project" "test_project" {
force_destroy = true
}

data "env0_template" "github_template_for_environment" {
name = "Github Integrated Template"
}

resource "env0_template" "template" {
name = "Template for environment resource-${random_string.random.result}"
type = "terraform"
repository = "https://github.com/env0/templates"
path = "misc/null-resource"
terraform_version = "0.15.1"
repository = data.env0_template.github_template_for_environment.repository
github_installation_id = data.env0_template.github_template_for_environment.github_installation_id
name = "Template for environment resource-${random_string.random.result}"
type = "terraform"
path = "misc/null-resource"
terraform_version = "0.15.1"
}

resource "env0_template_project_assignment" "assignment" {
template_id = env0_template.template.id
project_id = env0_project.test_project.id
}

resource "env0_environment" "auto_glob_envrironment" {
depends_on = [env0_template_project_assignment.assignment]
name = "environment-auto-glob-${random_string.random.result}"
project_id = env0_project.test_project.id
template_id = env0_template.template.id
auto_deploy_by_custom_glob = var.second_run ? "" : "//*"
auto_deploy_on_path_changes_only = true
approve_plan_automatically = true
deploy_on_push = true
force_destroy = true
}

resource "env0_environment" "example" {
depends_on = [env0_template_project_assignment.assignment]
force_destroy = true
Expand Down

0 comments on commit fb62b8d

Please sign in to comment.