-
Notifications
You must be signed in to change notification settings - Fork 2
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 initial support for reference tables #196
base: master
Are you sure you want to change the base?
Conversation
client/rest/referencetables.go
Outdated
"github.com/observeinc/terraform-provider-observe/client/oid" | ||
) | ||
|
||
// TODO: generate types from OpenAPI spec |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect most of this file can be auto-generated from the spec once we settle on the mechanics
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, got something working for generation and this file can be removed entirely. But requires some OpenAPI spec changes that are currently still in progress, so will add in a separate PR once those are in
observe/resource_reference_table.go
Outdated
diags = append(diags, diag.FromErr(err)...) | ||
} | ||
|
||
// TODO: add "primary_key" and "label_field" once supported |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if you meant to add it in this PR as we do support it? Or do we need support on the api front for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need API support. Currently it doesn't return primary_key
or label_field
in the response, but they will be added soon. So currently, we're unable to detect changes to those fields made outside of terraform, but it should work fine as long as all changes are made through terraform. Don't think this is a blocker since there isn't UI support for editing reference tables, so the only way to change those fields outside of terraform is through the API (which is unlikely to happen for a terraform-managed resource).
client/internal/customer
toclient/rest
resourceReferenceTableRead
to determine whether the reference table exists (code 404)observe_reference_table
plan/refresh/apply
to check for changes, we use achecksum
field to detect changes instead. Thischecksum
should always be set tofilemd5("<path_to_source_file>")
. The API returns the current remote checksum, which is compared against the local one.observe/testdata
In future PRs, will:
schema
field. This isn't returned by the API, but can be retrieved from the underlying dataset through a GraphQL request.