-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[Bug Fix - azurerm_api_management_api_operation] - Handling example.value none-string types #14848
[Bug Fix - azurerm_api_management_api_operation] - Handling example.value none-string types #14848
Conversation
4dcc475
to
76595ca
Compare
This pr will also fix #14869 |
Any chance of getting this merged soon? The bug breaks API operations, they are unusable now. |
Hi, this breaks API Management operations and the PR is outstanding for 2 months. What needs to happen to get this merged? @tombuildsstuff @katbyte |
Any change to get this fix live ? |
Looking for the fix. Tried with all existing version of azurerm from 2.55.0 to 2.99.0. Its blocking the API operation creation |
No there arent cause The problem is in Microsoft response schema, that hae breaking change for terraform process |
So, we can't create API operations with terraform now? My code was working before with the azurerm versions 2.82 and 2.88 versions. But now after using the same azurerm versions also getting the same error.we are Using terraform cli 1.0.0. . Please guide me if we can apply any workaround for the time being |
As far as I tested that The ooerations gets created but import to state fails and that fails The process overall. There as far as I know arent any good workaround. But im pretty new with terraform but i guess you cant go around this problem. |
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.
Thanks for this PR @xuzhang3 and apologies for the delayed review. In addition to the comment in-line I have two further suggestions
1 . The current tests did not pick up on this panic so can we add a test that reproduces the error and also confirms that this fix works.
2. We should also conditionally unmarshal value
as a JSON and fallback to string in the expand function or we may get a diff in the plan.
Once those suggestions have been addressed we can take another look.
Thanks!
@xuzhang3 Not trying to pressure but could you find sometime for this, this problem causing problems in our release process. :) |
5314918
to
ef5274a
Compare
Unfortunately we have some test failures @xuzhang3
|
@stephybun AccTests fixed
|
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.
Thanks for addressing the test failure @xuzhang3. I have one minor comment relating to the DiffSuppressFunc. I hope you don't mind I went ahead and committed that so that this can be merged and go into the next release.
func exampleSuppressEquivalentJSONDiffs(k, old, new string, d *pluginsdk.ResourceData) bool { | ||
var ojs interface{} | ||
if json.Unmarshal([]byte(old), &ojs) != nil { | ||
return strings.Compare(old, new) == 0 | ||
} | ||
|
||
var njs interface{} | ||
if json.Unmarshal([]byte(new), &njs) != nil { | ||
return strings.Compare(old, new) == 0 | ||
} | ||
|
||
return reflect.DeepEqual(ojs, njs) | ||
} |
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.
There is an existing diff suppress func for JSONs in the provider.
func exampleSuppressEquivalentJSONDiffs(k, old, new string, d *pluginsdk.ResourceData) bool { | |
var ojs interface{} | |
if json.Unmarshal([]byte(old), &ojs) != nil { | |
return strings.Compare(old, new) == 0 | |
} | |
var njs interface{} | |
if json.Unmarshal([]byte(new), &njs) != nil { | |
return strings.Compare(old, new) == 0 | |
} | |
return reflect.DeepEqual(ojs, njs) | |
} |
Optional: true, | ||
Type: pluginsdk.TypeString, | ||
Optional: true, | ||
DiffSuppressFunc: exampleSuppressEquivalentJSONDiffs, |
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.
DiffSuppressFunc: exampleSuppressEquivalentJSONDiffs, | |
DiffSuppressFunc: pluginsdk.SuppressJsonDiff, |
65d708b
to
c02ca6b
Compare
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Fix issue #14707
example.value
can be any type, may be a primitive value or an object, parse non-string type values to JSON stringModels definition: https://github.com/Azure/azure-sdk-for-go/blob/main/services/apimanagement/mgmt/2021-08-01/apimanagement/models.go#L10236
AccTests: