-
Notifications
You must be signed in to change notification settings - Fork 94
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
Bugfix SLO API: Update type for group_by
to accept either string or array-of-strings
#701
Conversation
- Starting with 8.14.0, the API can now return a list of strings instead of just a string. - To be able to handle both old and new APIs, the spec has been updated to accept either a string or a list of strings. - This change only ensures that the provider doesn't crash with the new API, there is no support yet for multiple group-by arguments.
group_by
to accept either string or array-of-strings
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.
Have we tested importing this resource from an SLO defined in the 8.14 UI?
The acceptance tests are passing against 8.14 currently so I expect that if groupBy
is specified as a string during creation then it's returned as a string. I'm not sure we're properly exercising this code with the current tests.
We are not actually using the group-by when reading. It is only passed through when creating/updating.
This sounds like a bug, and looking at the code isn't one that's that hard to fix. I wonder if it's worth updating the schema for group_by to be a []string
and fully fixing this attribute whilst we're here?
At least from the manual tests I did, the API always returns a list.
I agree that it is another bug. The main effect is that TF doesn't see a diff in the groupBy if it is changed on the server side. But wouldn't this break the config for all current users of the provider? Meaning they have to change the config after updating. Though at some point we have to switch over to a list anyway. |
Can we double check that, at least one of the acceptance tests sets group by and I'd expect it to fail if this were the case right?
There's been a couple of breaking changes in the past, and this would be relatively simple to adjust to (just wrapping the current value in Another part of the problem is that the schema suggests group by could be a list, but for 8.13 or lower the provider will have to take only the first item and explicitly set it as a plain string. |
Yeah, I think I will make the change. I have to check what the error is if a list is sent when it isn't supported. Otherwise I guess we need to have a validation for <8.14 to only allow one item in the list. When serializing I could probably make it work for every case by just always using the string if the list has exactly one element (as the new API supports both string and list-of-string)
Yeah it should be failing on main 🤔 I have to check why that isn't the case. |
Seems like it isn't enough to just update the config. There also needs to be a state migration. It looks like this is possible in the sdk as well, although it is necessary to copy the whole schema definition. |
Yea, of course. I'm happy if you want to get this one merged/released and we can fix the rest fixed up in a follow up. |
Yeah makes sense to split it into two parts. Then we can release a patch fix and maybe put the breaking change into a new minor version. |
* origin/main: Add support for the `alert_delay` param in the Create Rule API (#715) chore: prepare release v0.11.6 (#716) Validate that mappings are a JSON object, not just valid json (#719) fix: move all resources in one namespace for tcp monitor acc tests (#717) Bump github.com/golangci/golangci-lint from 1.59.1 to 1.60.1 in /tools (#714) Bump github.com/docker/docker in /tools (#718) Bump github.com/goreleaser/goreleaser from 1.26.1 to 1.26.2 in /tools (#642) Bump github.com/hashicorp/terraform-plugin-framework (#705) Add kibana synthetics http and tcp monitor resources (#699) Kibana spaces data source (#682) Use ephemeral github token for build. (#712) chore: 8.15.0 is here - lets try it out (#708) Update changelog for 0.11.5 Bump version for 0.11.5 (#706) Bugfix SLO API: Update type for `group_by` to accept either string or array-of-strings (#701) Support `restriction` in `elasticstack_elasticsearch_security_api_key` (#577) chore: follow-up CR changes for synthetics private location resource (#697)
Starting with 8.14.0, the API can now return a list of strings instead of just a string. This causes a crash in the provider when reading from the cluster:
To be able to handle both old and new APIs, the spec has been updated to accept either a string or a list of strings.
This update was done manually, as the official Kibana API has not yet been updated to reflect this change.
This change only ensures that the provider doesn't crash with the new API, there is no support yet to configure multiple group-by arguments in the schema.
This is also the reason why the change didn't really cause many code changes: We are not actually using the group-by when reading. It is only passed through when creating/updating.