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

Strings that change to empty fail to be updated #18

Closed
peters95 opened this issue Nov 11, 2020 · 1 comment
Closed

Strings that change to empty fail to be updated #18

peters95 opened this issue Nov 11, 2020 · 1 comment
Assignees
Labels
bug Something isn't working duplicate This issue or pull request already exists migrated migrated from atlassian/terraform-provider-artifactory

Comments

@peters95
Copy link

Community Note
Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
If you are interested in working on this issue or have submitted a pull request, please leave a comment
Terraform Version
terraform 0.13.2

Affected Resource(s)
artifactory_remote_repository
Probably all resources that have string fields that it is valid to be the empty string.

Terraform Configuration Files
Using gocenter.io as a remote for the purposes of this example

Initial state

resource "artifactory_remote_repository" "someremote" {
url = "https://gocenter.io"
key = "gocenter"
package_type = "go"
repo_layout_ref = "go-default"
proxy = "someproxy"
}
Second apply

resource "artifactory_remote_repository" "someremote" {
url = "https://gocenter.io"
key = "gocenter"
package_type = "go"
repo_layout_ref = "go-default"
proxy = ""
}
Expected Behavior
Proxy should have been removed with a change of

proxy "someproxy" -> ""

Actual Behavior
Proxy field not passed to the API, as it got reduced to null

proxy "someproxy" => null

This retains the value "someproxy" in the remote.

Steps to Reproduce
This affects any string field in which changing the field to "" in the API would be a valid change.

terraform apply with initial state
terraform apply after changing a string field to ""
Possible fix
At https://github.com/atlassian/terraform-provider-artifactory/blob/master/pkg/artifactory/util.go#L15
d.GetOk(key) should perhaps be d.GetOkExists(key) so that empty strings are not treated as null

@peters95 peters95 added bug Something isn't working migrated migrated from atlassian/terraform-provider-artifactory labels Nov 11, 2020
@chb0github chb0github self-assigned this Feb 19, 2021
@chb0github chb0github added the duplicate This issue or pull request already exists label Feb 19, 2021
@chb0github
Copy link
Contributor

copy of #2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists migrated migrated from atlassian/terraform-provider-artifactory
Projects
None yet
Development

No branches or pull requests

3 participants