You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*Bug Report: GetSet Should Return an Empty List Instead of nil
Currently, the GetSet() function in the Terraform Artifactory provider returns nil when no values are present for a given key. This causes Terraform to detect unwanted state drift for attributes like project_environments, which is expected to be an empty list ([]) rather than null. This behavior results in unnecessary updates, where Terraform continuously detects changes and tries to apply them.
Terraform will perform the following actions:
# artifactory_local_rpm_repository.repository[0] will be updated in-place~ resource "artifactory_local_rpm_repository""repository" {
+ project_environments = (known after apply)
}
If project_environments is not set, GetSet() should return [], ensuring consistency in Terraform state.
Expected Behavior
When an attribute like project_environments is not explicitly set, GetSet() should return [] instead of nil. This prevents unnecessary state drift and ensures compatibility with Terraform's expected behavior. Affected Versions
Artifactory Version: "7.106.3"
Terraform Version: "v1.9.8"
Terraform Provider Version: "v12.8.4"
Suggested Fix
Modify the GetSet() function in the provider code to return an empty list instead of nil:
func (d*ResourceData) GetSet(keystring) []string {
ifv, ok:=d.GetOkExists(key); ok {
arr:=CastToStringArr(v.(*schema.Set).List())
returnarr
}
return []string{} // Return an empty list instead of nil
}
But since GetSet is been used by other resources and behaviour might be expected for those, then maybe add an a fix here
@Osazz The code you referenced is not being used by local repository since 12.8.0, and by remote repository since 12.8.3 (technically 12.8.2 but I forgot to release it).
@Osazz The code you referenced is not being used by local repository since 12.8.0, and by remote repository since 12.8.3 (technically 12.8.2 but I forgot to release it).
*Bug Report: GetSet Should Return an Empty List Instead of nil
Currently, the GetSet() function in the Terraform Artifactory provider returns nil when no values are present for a given key. This causes Terraform to detect unwanted state drift for attributes like project_environments, which is expected to be an empty list ([]) rather than null. This behavior results in unnecessary updates, where Terraform continuously detects changes and tries to apply them.
Requirements for and issue
Terraform snippet
Observed Terraform Plan Output
After apply statefile value
Expected Output
If project_environments is not set, GetSet() should return [], ensuring consistency in Terraform state.
Expected Behavior
When an attribute like project_environments is not explicitly set, GetSet() should return [] instead of nil. This prevents unnecessary state drift and ensures compatibility with Terraform's expected behavior.
Affected Versions
Suggested Fix
Modify the GetSet() function in the provider code to return an empty list instead of nil:
But since GetSet is been used by other resources and behaviour might be expected for those, then maybe add an a fix here
change line 306 to
The text was updated successfully, but these errors were encountered: