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

Consider InternalValidate equivalent #113

Closed
kmoe opened this issue Aug 20, 2021 · 3 comments
Closed

Consider InternalValidate equivalent #113

kmoe opened this issue Aug 20, 2021 · 3 comments
Labels
enhancement New feature or request sdkv2-parity Issues tracking feature parity with terraform-plugin-sdk v2 and PRs working towards it.
Milestone

Comments

@kmoe
Copy link
Member

kmoe commented Aug 20, 2021

The Provider.InternalValidate() and Resource.InternalValidate() (which calls schemaMap.InternalValidate(), Importer.InternalValidate()) exported functions in terraform-plugin-sdk provide a way for callers to validate that, for example:

  • Optional and Required cannot both be set on the same attribute
  • If a resource has no Update, all Computed attributes must be ForceNew
  • State upgraders must cover all appropriate schema versions
  • Context-aware CRUD functions and their non-context-aware equivalents cannot both be set

While many of these do not apply to terraform-plugin-framework, we should consider whether an equivalent function is appropriate.

The InternalValidate equivalent(s) could validate that:

Alternatively, we can declare a user-run internal validation function an anti-pattern, in which case this issue should be closed and the above validation done through other means.

@kmoe kmoe added the enhancement New feature or request label Aug 20, 2021
@paddycarver paddycarver added sdkv2-parity Issues tracking feature parity with terraform-plugin-sdk v2 and PRs working towards it. breaking-change This PR introduces a breaking change or the resolution of this issue may require a breaking change. labels Sep 9, 2021
@bflad
Copy link
Contributor

bflad commented Oct 1, 2021

#157 has an example use case that this theoretical functionality could also check that configuration validation fields are not defined on schemas with no configurable attributes.

@bflad bflad added this to the v1.0.0 milestone Mar 16, 2022
@bflad bflad removed the breaking-change This PR introduces a breaking change or the resolution of this issue may require a breaking change. label Nov 9, 2022
@bflad
Copy link
Contributor

bflad commented Nov 9, 2022

At this juncture, I'm inclined to recommend that we implement any remaining validations to get returned as error diagnostics as part of the GetProviderSchema response. This will ensure that the provider will not work appropriately in acceptance testing and production, should there be correctness issues. For stylistic issues or coding recommendations, external tooling can be created.

@bflad bflad closed this as completed Nov 9, 2022
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request sdkv2-parity Issues tracking feature parity with terraform-plugin-sdk v2 and PRs working towards it.
Projects
None yet
Development

No branches or pull requests

3 participants