Skip to content
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

update tfsdk helpers to use *diags #855

Merged
merged 7 commits into from
Oct 21, 2024
Merged

update tfsdk helpers to use *diags #855

merged 7 commits into from
Oct 21, 2024

Conversation

daemitus
Copy link
Contributor

As mentioned here, the idea behind the utils/tfsdk.go meta parameters is to pass around response.Diagnostics, the key/index, path, etc. Anything added to meta.diags doesn't actually get returned because it is passed by value and not pointer. This never cropped up in the other tests, mostly because the tests pass, but secondly all the usage is inline, so they reference the outer diags, and not meta.diags.

@daemitus daemitus marked this pull request as draft October 17, 2024 19:49
@daemitus
Copy link
Contributor Author

This is actually causing TestAccResourceIntegrationPolicySecretsFromSDK to fail now, due to input.vars_json="" in 0.11.7 when the actual value was null.

An empty string isn't valid JSON and is causing the jsontypes.Normalized vars_json to add an error diagnostic.

(basetypes.ListValue) [{"enabled":true,"input_id":"aws_logs-aws-cloudwatch","streams_json":"...","vars_json":""}, ...}]

@daemitus daemitus marked this pull request as ready for review October 18, 2024 16:34
@daemitus
Copy link
Contributor Author

Implemented an upgrade for fleet_integration_policy, Any streams_json or vars_json as empty strings get reassigned as nulls, so the jsontypes.Normalized wont complain anymore.

Copy link
Member

@tobio tobio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thanks!

@tobio tobio merged commit f05509d into elastic:main Oct 21, 2024
20 checks passed
kjwardy pushed a commit to kjwardy/terraform-provider-elasticstack that referenced this pull request Oct 21, 2024
* update tfsdk helpers to use *diags

* cl

* all diags params get pointers

* all diags params get pointers

* amend changelog

* impl upgradeV0 for integration policy

* cl
@daemitus daemitus deleted the helpers branch October 24, 2024 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants