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

feat: add schema support for reference tables #197

Merged
merged 2 commits into from
Feb 12, 2025

Conversation

obs-gh-abhinavpappu
Copy link
Collaborator

Needed to use data.GetRawConfig() to work around a terraform limitation, see comment for details.

func referenceTableToResourceData(d *rest.ReferenceTable, data *schema.ResourceData) (diags diag.Diagnostics) {
if err := data.Set("oid", d.Oid().String()); err != nil {
func newReferenceTableSchemaConfig(data *schema.ResourceData) (input []rest.ReferenceTableSchemaInput, diags diag.Diagnostics) {
// We're using GetRawConfig() here instead of Get() or GetOk() because we only want to include
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we could leverage PlanModifiers instead: https://developer.hashicorp.com/terraform/plugin/framework/resources/plan-modification#attribute-plan-modification

This would be configured on the schema definition for the field, and allows us to modify the plan as relevant.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Looks like PlanModifiers are only supported for the Framework and not the SDK. But yes, it does give us what we need to implement this behavior (and in fact from what I can tell based on the docs, I think this behavior is default in the Framework)

@obs-gh-abhinavpappu obs-gh-abhinavpappu merged commit a2b9d28 into master Feb 12, 2025
5 checks passed
@obs-gh-abhinavpappu obs-gh-abhinavpappu deleted the abhi/reference-tables-schema branch February 12, 2025 00:08
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