-
Notifications
You must be signed in to change notification settings - Fork 123
WIP: Add framework provider #234
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
Conversation
683e8e4 to
5b8fd70
Compare
5b8fd70 to
bce48bc
Compare
| return nil, diags | ||
| } | ||
|
|
||
| func NewFWEsApiClient(ctx context.Context, esConn *ElasticSearchConnection, version string, useEnvAsDefault bool) (*ApiClient, fwdiag.Diagnostics) { |
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.
| func NewFWEsApiClient(ctx context.Context, esConn *ElasticSearchConnection, version string, useEnvAsDefault bool) (*ApiClient, fwdiag.Diagnostics) { | |
| func NewFWApiClient(ctx context.Context, esConn *ElasticSearchConnection, version string, useEnvAsDefault bool) (*ApiClient, fwdiag.Diagnostics) { |
We're working on adding Kibana support here too
| config.Addresses = addrs | ||
|
|
||
| envInsecure, _ := strconv.ParseBool(os.Getenv("ELASTICSEARCH_INSECURE")) | ||
| if esConn.Insecure.ValueBool() || envInsecure { |
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.
So this is inconsistent with the other settings, where the environment value is checked even when the value is specified in the provider configuration. I think we should be consistent here.
|
|
||
| const esConnectionKey string = "elasticsearch_connection" | ||
|
|
||
| type ElasticSearchConnection struct { |
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.
IMO it would be cleaner to have all functions which build a new client parse the relevant config into this struct and then call a single function which builds an elasticsearch.Config{} instance from this struct.
It would mean consolidating all the CA, TLS and debugging code. Given the different diagnostic types we'd have to return a plain error but I think that's ok.
WDYT?
|
|
||
| const esConnectionKey string = "elasticsearch_connection" | ||
|
|
||
| type ElasticSearchConnection struct { |
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.
nit:
| type ElasticSearchConnection struct { | |
| type ElasticsearchConnection struct { |
| Optional: true, | ||
| Sensitive: true, | ||
| Validators: []validator.String{ | ||
| stringvalidator.ConflictsWith(path.MatchRoot(usernamePath)), |
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.
Can we instead use a relative path matcher in the new schema?
| stringvalidator.ConflictsWith(path.MatchRoot(usernamePath)), | |
| stringvalidator.ConflictsWith(path.MatchRelative().AtParent().AtName("username")), |
go.mod
Outdated
| google.golang.org/protobuf v1.28.1 // indirect | ||
| ) | ||
|
|
||
| replace github.com/hashicorp/terraform-plugin-mux v0.7.0 => github.com/k-yomo/terraform-plugin-mux v0.0.0-20221218141521-7a01a5a64e24 |
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.
Just flagging it so it doesn't get merged like this. Moving the maxitems validation to code in the short term is ok if getting your PR merged into terraform-plugin-mux turns out to be too slow.
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.
The below update contains the fix!
#235
|
Sorry for no updates here for a while, I'll restart working on this PR🙏 |
#214
This PR adds provider for terraform-plugin-framework.
TODO
Gracefully handle
[Max|Min]Itemdiffs between SDKv2 and plugin framework providers hashicorp/terraform-plugin-mux#117