-
Notifications
You must be signed in to change notification settings - Fork 15
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: env0_environment does not redeploy when revision is changed in w… #907
Conversation
…ithout_template_settings
@@ -732,6 +732,12 @@ func shouldUpdateTemplate(d *schema.ResourceData) bool { | |||
} | |||
|
|||
func shouldDeploy(d *schema.ResourceData) bool { | |||
if _, ok := d.GetOk("without_template_settings.0"); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added the required use-case.
@@ -1126,8 +1132,7 @@ func getDeployPayload(d *schema.ResourceData, apiClient client.ApiClientInterfac | |||
var err error | |||
|
|||
if isTemplateless(d) { | |||
templateId, ok := d.GetOk("without_template_settings.0.id") | |||
if ok { | |||
if templateId, ok := d.GetOk("without_template_settings.0.id"); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no change... just one less line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this syntax is super strange ... do we use it a lot in this codebase / is it common in Go?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
This is common go.
@@ -1139,6 +1144,10 @@ func getDeployPayload(d *schema.ResourceData, apiClient client.ApiClientInterfac | |||
} | |||
|
|||
if isRedeploy { | |||
if revision, ok := d.GetOk("without_template_settings.0.revision"); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set the revision in the deploy request only if it's a redeploy.
@@ -2541,6 +2541,13 @@ func TestUnitEnvironmentWithoutTemplateResource(t *testing.T) { | |||
|
|||
// Update | |||
mock.EXPECT().TemplateUpdate(template.Id, templateUpdatePayload).Times(1).Return(updatedTemplate, nil), | |||
mock.EXPECT().ConfigurationSetsAssignments("ENVIRONMENT", environment.Id).Times(1).Return(nil, nil), | |||
mock.EXPECT().EnvironmentDeploy(environment.Id, client.DeployRequest{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now deploy is called as part of the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
…ithout_template_settings
Issue & Steps to Reproduce / Feature Request
fixes #906
Solution