Fix serviceendpoint_generic_v2 to let the api throw the failure and properly update the authentication parameters. - #1544
Conversation
|
This PR is ready for review. |
|
I think this is more proper to be moved to CustomizeDiff so that this can happen during plan time instead of apply time, WDYT? |
|
It runs both at plan time and apply time. The problem with plan time run is that the input parameters can be undeterministic in which case terraform provides a null object. This breaks plan time validation. |
|
These attributes are less likely to be unknown during plan time. You shall skip the validation if there is any unknown value. Whilst the CustomizeDiff also runs at apply time, where all the attributes will be known. |
|
It is part of costumizediff But the main problem is not that the values are unkown but that the api retruns a validation logic for each data field and we would need to implement the same logic parser as it is already implemented in the azure devops. So for example for azure service connection you would not be able to create it in the current state because both service principal and other login method inputs are present in the data field but the conditional logic is not parsed or processed so the diff just dies because it expects all the auth data which are conflicting. |
… only overwrite changed attributes
|
Could you pass the acctests and paste the run result here then I'm happy to merge this PR? Thx! |
|
Hi magodo (@magodo), I finally had time to run the acc tests. Sadly they are not passing and seemingly the azure devops client is causing the error. Here is the output: I tracked down the failure to the following line in the code: Can you check if the ADO go client dev team knows about this? |
|
Any news here? |
|
Sorry, I've no idea why the ADO service fails. |
Technical Investigation: JSON Unmarshalling IssueI've done some digging into the JSON unmarshalling error we've been seeing in the test runs, and I wanted to share what I found: What's Actually HappeningThe issue is in the Azure DevOps Go SDK ( type InputValidation struct {
MinValue *big.Float `json:"minValue,omitempty"`
MaxValue *big.Float `json:"maxValue,omitempty"`
}The problem is that Go's standard So when we call Why This PR Solves ItBy adding the I think this is actually a better design than trying to replicate all of Azure DevOps' validation logic on the client side. The API will always have the most up-to-date rules, and users get clear error messages directly from Azure DevOps if their config is invalid. Next StepsIf we wanted to fully enable client-side validation in the future, someone would need to file an issue with the Azure DevOps Go SDK to add proper JSON unmarshalling support for |

All Submissions:
Description
The apply time input validation was causing a lot of issues as the code did not reimplement the conditional logic from the service endpoint validation. I have added a toggle that defaults to turn this feature off. This validation is still useful for small service connections but it is unusable for azure service connections for example.
Also there was a bug that skipped the authentication parameters from the update. Fixed that too.
PR 2/2 from #1505
Does this introduce a breaking change?
Test Result
Related Issue(s)
Fix #0000
Other information