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

Fix: unable to unset auto_deploy_by_custom_glob property of environme… #720

Merged
merged 7 commits into from
Oct 5, 2023
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
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's a TODO in the file. if it's something that won't happen, remove it. if it's something that needs addressing, please open an issue and attach link so we'll know what's that about... let's keep the tests tidy as well

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll open an issue. But the change may first need to be made in org itself. Have an environment with state access.
(I don't think it's simple to set it up... but might be wrong...).

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how did it work until now without installation id? is it required?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Up until now it wasn't a github repo (even if the URL was set to github).
I needed to make it a github repo to support glob. setting 'github_installation_id' makes it a github repo.

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
Loading