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
When configuring an xray_watch with a description set to an empty string, for example
resource "xray_watch "WatchName" {
name = "name"
active = true
description = ""
}
it appears that the actual value being set to the description is null because after applying this configuration then immediately checking terraform plan the output still shows that changes will be made ~ though it does not show any fields that will be changed.
Additionally, if you add an actual non-empty string to the description then configure the description as the empty string and check terraform plan you will see that it plans to set the description to null.
Requirements for and issue
A fully functioning terraform snippet that can be copy&pasted (no outside files or ENV vars unless that's part of the issue)
Your version of Artifactory and Xray (you can curl Artifactory version at $host/artifactory/api/system/version and Xray version at $host/xray/api/v1/system/version
Your version of terraform
Expected behavior
The expected behavior is that the description, weather null or empty string, should not display changes in terraform plan for a configuration with a null or empty string description. Otherwise this step incorrectly reports that our configuration is misaligned with the ground truth.
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
EitanJoseph
changed the title
xray_watch "description" field incorrectly set as emtpy string
xray_watch "description" field incorrectly set as null when value is emtpy string
Dec 24, 2024
@EitanJoseph The cause of this state drift is because Xray REST API for getting watch doesn't distinguish between empty string or null value. Whereas Terraform has separate concept of null and "".
When you update the watch using API with empty description, e.g. "description": "", the API accepts the empty string and update its value. Then on getting the watch, the API responses body will not contain the description field at all (there's no difference between empty value and not set value in Xray API). This leads to the provider unable to know whether the value is not defined in TF config, or it has an empty string.
Unfortunately there's no workaround for this (short of changing how the API works, which I've made the Xray team aware already).
After you've set the description attribute to empty and apply it, you will need to remove that attribute from your TF config in order to avoid state drift.
Describe the bug
Terraform: 1.9.8
Artifactory: 7.59.9
Xray: 3.74.8
Providers:
jfrog/xray version: 3.0.3
jfrog/artifactory version: 12.3.2
When configuring an xray_watch with a description set to an empty string, for example
it appears that the actual value being set to the description is
null
because after applying this configuration then immediately checkingterraform plan
the output still shows that changes will be made~
though it does not show any fields that will be changed.Additionally, if you add an actual non-empty string to the description then configure the description as the empty string and check
terraform plan
you will see that it plans to set the description to null.Requirements for and issue
curl
Artifactory version at$host/artifactory/api/system/version
and Xray version at$host/xray/api/v1/system/version
Expected behavior
The expected behavior is that the description, weather null or empty string, should not display changes in
terraform plan
for a configuration with a null or empty string description. Otherwise this step incorrectly reports that our configuration is misaligned with the ground truth.Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: