-
Notifications
You must be signed in to change notification settings - Fork 8
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
Cloud Resources Refactor #351
Conversation
Nice, this makes sense to me! Note that you probably want to support multiple "DB" clients, one per region:
|
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.
This looks great. Exciting to add these
@@ -60,8 +61,16 @@ func Provider() *schema.Provider { | |||
DefaultFunc: schema.EnvDefaultFunc("MZ_SSLMODE", true), | |||
Description: "For testing purposes, disable SSL.", | |||
}, | |||
"endpoint": { |
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.
Is the admin endpoint unique to each organization's Materialize account?
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.
No, but you'll need some way to override it for tests. Production and staging have different admin endpoints, for example.
0411681
to
e619976
Compare
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.
Looking good! Dropped in a few comments.
0d858ad
to
6b303bd
Compare
3a461ce
to
a6560dd
Compare
8f0a202
to
53ff098
Compare
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.
Nice! I only took a very quick skim, but this all seems to be headed in a wonderful direction. 👍🏽
018df2b
to
9323a9a
Compare
pkg/clients/frontegg_client.go
Outdated
// Deep copy the request to ensure it's safe to modify | ||
req2 := cloneRequest(req) | ||
req2.Header.Set("Authorization", "Bearer "+t.Token) |
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 you say more about why we need the deep copy?
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.
This is primarily related to concurrency and the immutability of the original request. As http.Request.Body can only be read once, a new body needs to be copied:
https://stackoverflow.com/questions/62017146/http-request-clone-is-not-deep-clone
Will try to adjust the comment to give a bit more details!
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.
How about you include the stack overflow link in the comment.
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.
Sounds good, just added the link in the func comments.
ccce478
to
8fa2cc7
Compare
Terraform Docs WIP: manage frontegg users [WIP]: Cloud Resources Terraform Docs Add tests for app password Terraform Docs Fix failing tests Add region datasource Add integration tests for user resource Minor changes Terraform Docs Minor changes Add token refresh func
8fa2cc7
to
8b8d441
Compare
I've been thinking with #5 based on the doc here
Each resource within our provider will be able to utilize one of these clients depending on its requirements. For example, a resource that manages database configurations will use the
DBClient
, whereas another that interacts with Frontegg services will useFronteggClient
and etc.This PR is more of a PoC so we could start a further discussion, it implements a
materialize_app_password
resource that utilizes the FrontEgg API:List of things that need to be done to get this PR merged:
materialize_app_password
materialize_user
materialize_regions
Refactor resources to use the new DB client:
Tasks that can be contributed separately in follow-up PRs:
materialize_region
materialize_organization