-
Notifications
You must be signed in to change notification settings - Fork 408
[resource_datadog_synthetics_global_variable] Fix nested attributes error in synthetics_global_variable resource #3195
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
base: master
Are you sure you want to change the base?
Conversation
Hello @AntoineDona , |
…cs │ │ │ │ - Fix error handling: properly propagate conversion errors instead of ignoring them │ │ - Fix recursive diagnostics appending (diags.Append(diags...)) │ │ - Prevent potential nil pointer panic in convertApiParseTestOptions │ │ - Remove unused struct definitions (dead code) │ │ - Update updateState method to return diagnostics properly │ │ - Fix API method name (NewSyntheticsVariableParserWithDefaults)
- Fix error handling: properly propagate conversion errors instead of ignoring them - Fix recursive diagnostics appending (diags.Append(diags...)) - Remove unused struct definitions (dead code) - Update updateState method to return diagnostics properly - Fix API method name (NewSyntheticsVariableParserWithDefaults)
- Fix error handling: properly propagate conversion errors instead of ignoring them - Fix recursive diagnostics appending (diags.Append(diags...)) - Remove unused struct definitions (dead code) - Update updateState method to return diagnostics properly - Fix API method name (NewSyntheticsVariableParserWithDefaults)
Hey @Matt-Cam , I would have appreciated it if you could have at least dropped a comment on the PR before adding your changes as your additional change might nullify my work on the issue 😀. |
Hi @surajdubey08 I'm experimenting with some other approaches on separate branches. I have not added any changes to your branch! |
…Error - Remove complex helper functions from PR #3195 - Use simple struct building + types.ListValueFrom() pattern - Keep existing logic with ElementsAs() for clean conversions - Add global type definitions matching Datadog codebase patterns
Keep only core resource fix and user's DynamicBlocks test
Keep only core resource fix and user's DynamicBlocks test
Keep only core resource fix and user's DynamicBlocks test
Hi @surajdubey08, I have a #3244 open based on your initial idea. I'm going to have to squash that PR down since your original commits are not signed. In the future, make sure to sign your commits so that your work is included in the commit history. Thanks for raising and working on it 🙇🏼 |
…Error - Remove complex helper functions from PR #3195 - Use simple struct building + types.ListValueFrom() pattern - Keep existing logic with ElementsAs() for clean conversions - Add global type definitions matching Datadog codebase patterns
Keep only core resource fix and user's DynamicBlocks test
This PR resolves #3131 by fixing the value conversion error that occurs when using
parse_test_options
with thedatadog_synthetics_global_variable
resource.Problem
When configuring
parse_test_options
with the synthetics global variable resource, Terraform returns the following error:This occurs because the resource model uses raw Go slices for nested attributes (
[]Model
) instead of the proper Terraform Framework types (types.List
). In the Terraform Framework, nested attributes must use Framework types to correctly handle unknown values and type conversions during planning and state management.Solution
I've implemented the following changes to resolve this issue:
types.List
forParseTestOptions
andOptions
fields instead of Go slicesparse_test_options
functionalityThis implementation follows the patterns established in other recently fixed resources (such as #1765 and #1783) and adheres to Terraform Framework best practices for handling nested attributes.
Testing
I've added a new acceptance test that validates the
parse_test_options
functionality works as expected:The test:
parse_test_options
configurationAdditional context
This fix enables users to properly configure global variables that extract values from synthetic test responses, which is essential for many monitoring workflows. The issue particularly affects users who need to extract authentication tokens or other dynamic values from test responses.
I've reviewed the Terraform Framework documentation on nested attributes and ensured this implementation follows the recommended patterns. If there are any adjustments needed or if I've missed something in my approach, I would appreciate your feedback and am happy to make any necessary changes.
Thank you for your time and consideration of this contribution. I appreciate the work you do maintaining this provider and look forward to your feedback.
Best regards