-
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: vcs_command_alias should be set to "" when vcs_pr_comments_enabl… #965
Conversation
@@ -1062,6 +1062,11 @@ func getCreatePayload(d *schema.ResourceData, apiClient client.ApiClientInterfac | |||
} | |||
} | |||
|
|||
// Send an empty vcs_commands_alias if vcs_pr_comments_enabled is 'false' or unset - https://github.com/env0/terraform-provider-env0/issues/964 | |||
if payload.VcsPrCommentsEnabled == nil || !*payload.VcsPrCommentsEnabled { |
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.
create use-case.
@@ -1129,6 +1134,11 @@ func getUpdatePayload(d *schema.ResourceData) (client.EnvironmentUpdate, diag.Di | |||
payload.IsArchived = boolPtr(d.Get("is_inactive").(bool)) | |||
} | |||
|
|||
// Send an empty vcs_commands_alias if vcs_pr_comments_enabled is 'false' or unset - https://github.com/env0/terraform-provider-env0/issues/964 | |||
if payload.VcsPrCommentsEnabled == nil || !*payload.VcsPrCommentsEnabled { |
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.
update use-case.
@@ -59,7 +59,7 @@ func TestUnitEnvironmentResource(t *testing.T) { | |||
}, | |||
TerragruntWorkingDirectory: "/terragrunt/directory/", | |||
VcsCommandsAlias: "alias2", | |||
VcsPrCommentsEnabled: false, | |||
VcsPrCommentsEnabled: true, |
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.
in some places this had been set to true, so alias will be passed...
/review |
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.
I see that you had to add the VcsPrCommentsEnabled
field set to true
. Does that mean that users that don't have that prop and depends on having an alias or not having it to enable and disable pr comments will have issues no?
Hi @Yossi-kerner - valid question! To be honest, the fix could have been in the backend and not in the provider. This is an anti-pattern for the provider code. However, I was asked to make the fix in the provider. So that's what I did (: |
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.
Sorry for the late approve. We decided we are ok with that change, just make sure to change the major version when we release because it's a breaking change and make it clear in the change log what should be done 🙏 Thanks
Feel free to edit the description if it's unclear. Thanks! |
…ed is disabled
Issue & Steps to Reproduce / Feature Request
fixes #964
Solution
Forces alias to be empty if vcs_pr_comments_enabled is unset or false.
Updated acceptance tests.