[datadog_reference_table] Require schema attrs #3511
+28
−34
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

PR by Bits
View Dev Agent Session
You can ask for changes by mentioning @DataDog in a comment.
Feedback (especially what can be better) welcome in #code-gen-aka-bits-dev-feedback!
What does this PR do?
Marks
primary_keys,fields.name, andfields.typeasRequiredon thedatadog_reference_tableresource schema. Previously these wereOptional, which allowed Terraform plans to succeed without them, only to fail at apply time with a400 Bad Requestfrom the API:Details
primary_keys: Changed fromOptionaltoRequired. TheSizeAtLeast(1)validator was already present but was skipped for null (omitted) values sinceOptionalattributes are null when not set. Making itRequiredensures the validator always runs.fieldsblock: Already enforced bylistvalidator.SizeAtLeast(1)on theListNestedBlock(blocks produce empty lists, not null, so the validator always fires).fields.nameandfields.type: Changed fromOptionaltoRequiredto match API requirements.Computed: truefor API read population.Motivation
Reported via Slack — users hit 400 errors at
terraform applytime because the provider accepted configs missing required schema attributes. This change surfaces the error atterraform validate/plantime instead.Additional Notes
All existing tests and examples already specify these attributes, so no test changes are needed.