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

Make reflect_resource and customizable_schema work for data source #3880

Open
wants to merge 5 commits into
base: terraform-plugin-framework
Choose a base branch
from

Conversation

edwardfeng-db
Copy link
Contributor

Changes

  • Currently these util functions only work for provider resources not data sources, this one adds support for both

Tests

  • make test run locally
  • relevant change in docs/ folder
  • covered with integration tests in internal/acceptance
  • relevant acceptance tests are passing
  • using Go SDK

@edwardfeng-db edwardfeng-db requested review from a team as code owners August 9, 2024 15:06
@edwardfeng-db edwardfeng-db requested review from tanmay-db and removed request for a team August 9, 2024 15:06
@edwardfeng-db edwardfeng-db changed the base branch from main to terraform-plugin-framework August 9, 2024 15:06
@edwardfeng-db edwardfeng-db requested a review from mgyucht August 12, 2024 11:32
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
)

Copy link
Contributor

Choose a reason for hiding this comment

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

type Validator interface {
  Whatever()
}

type ResourceValidator struct{
  validator schema.Validator
}
func (ResourceValidator) Whatever() {}
type DataSourceValidator struct {
    validator dataschema.Validator
}

AddValidators(Validator) Attribute

common/databricks_schema_attribute.go Show resolved Hide resolved
field.Set(newSlice)

return val.Interface().(schema.Attribute)
cb := func(attr Attribute) Attribute {
Copy link
Contributor

Choose a reason for hiding this comment

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

Idea: expose type-specific methods here instead of any?

common/databricks_schema_attribute.go Show resolved Hide resolved
common/databricks_schema_attribute.go Show resolved Hide resolved
common/databricks_schema_attribute.go Show resolved Hide resolved
common/databricks_schema_attribute.go Show resolved Hide resolved
return a
}

type MapAttribute struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

For this type and the ones below, doccomments

github-merge-queue bot pushed a commit that referenced this pull request Aug 21, 2024
## Changes
<!-- Summary of your changes that are easy to understand -->
- Addressing comments from
#3880
- Adding AttributeBuilder - the common interface for building data
source schema and resource schema
- Adding customisation functions for each type of attribute

## Tests
<!-- 
How is this tested? Please see the checklist below and also describe any
other relevant tests
-->

- [x] `make test` run locally
- [x] relevant change in `docs/` folder
- [x] covered with integration tests in `internal/acceptance`
- [x] relevant acceptance tests are passing
- [x] using Go SDK
github-merge-queue bot pushed a commit that referenced this pull request Aug 21, 2024
## Changes
<!-- Summary of your changes that are easy to understand -->
- Addressed comments in
#3880
- Add CustomizableSchema for PluginFramework

## Tests
<!-- 
How is this tested? Please see the checklist below and also describe any
other relevant tests
-->

- [x] `make test` run locally
- [x] relevant change in `docs/` folder
- [x] covered with integration tests in `internal/acceptance`
- [x] relevant acceptance tests are passing
- [x] using Go SDK
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