Closed drdamour closed 1 year ago
Hiya @drdamour,
Thanks for reporting this, I will investigate.
Hello, I have same problem.
I think one of the causes is that function DiffSuppressFunc() in entitlements_createsuborgs
is something wrong.
Since DiffSuppressFunc() calls DiffSuppressFunc4OptionalPrimitives(), I have temporarily added a log to DiffSuppressFunc4OptionalPrimitives().
When, I switched entitlements_createsuborgs
to true and ran a plan, DiffSuppressFunc4OptionalPrimitives() was called and that returns true(true means suppress change), so there were no changes shown.
Here is the log I added.
func DiffSuppressFunc4OptionalPrimitives(k, old, new string, d *schema.ResourceData, initial string) bool {
+ var result bool
if new == initial {
- return true
+ result = true
} else {
- return old == new
+ result = (old == new)
}
+ log.Printf("[INFO] DiffSuppressFunc4OptionalPrimitives result=%v key=%s old=%s new=%s initial=%s", result, k, old, new, initial)
+ return result
}
if entitlements_createsuborgs
is true, then return true
2023-10-16T00:36:15.407+0900 [INFO] provider.terraform-provider-anypoint.exe: DiffSuppressFunc4OptionalPrimitives result=true key=entitlements_createsuborgs old=false new=true initial=true: timestamp="2023-10-16T00:36:15.407+0900"
I see that DiffSuppressFunc was added in another issue, but I have yet to catch up on my understanding of the issue. I am still not sure how to fix this problem as in other cases I have changed the value in the web console but the plan were no changes shown with below WARN log.
2023-10-15T22:39:25.913+0900 [WARN] Provider "registry.terraform.io/mulesoft-anypoint/anypoint" produced an unexpected new value for anypoint_bg.devb during refresh.
- .updated_at: was cty.StringVal("2023-10-15T12:33:30.722Z"), but now cty.StringVal("2023-10-15T13:39:16.266Z")
- .entitlements_createsuborgs: was cty.False, but now cty.True
Hi @drdamour and @shimiz98,
I fixed the issue on the branch fix/issue-16
.
Can you please test on your side to confirm resolution before I release the fix ?
Thank you.
Hello,
New version v1.5.6 published with the fix.
@soufi got soem unexpected defaults now
this bg was created with prior version...so thinking this is the provider changing it's defaults
Hi @drdamour, I had to realign the default values with the platform's default values in order to avoid unnecessary changes after the first creation. This was necessary after the correction of the bug. Sorry for the inconvenience.
have a bg like
i switched entitlements_createsuborgs to true and ran a plan, and there were no changes shown. seems liek fetch of current state doesn't read this right or map it right.
sniffing the request i see in the json response createSubOrgs=True when i enable it in web ux, and false when i disable it, so anypoint services seem to be functioning.
i also noticed on a straight create it doesn't seem to mark the create sub groups flag in the ux when set to true, sniffing the create POST request i see
createSubOrgs=False
so def looks like a mistake in the mapping of hcl to json doc