-
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
Add cloud region resource #535
Conversation
@@ -0,0 +1,3 @@ | |||
resource "materialize_region" "example" { | |||
region_id = "aws/eu-west-2" |
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.
Seems weird to have a region that doesn't exist in our example?
|
||
req.Header.Add("Content-Type", "application/json") | ||
|
||
resp, err := c.FronteggClient.HTTPClient.Do(req) |
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.
Why does this use the frontegg client? This is the cloud region api, right?
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.
Hmm, I think that this has been flawed from the initial implementation during the large refactor a few months ago.
As far as I can tell, the main idea seems to have been to reuse the FronteggClient's HTTPClient which already includes the Authorization token.
I'll have to refactor this. I've created an issue to track this and will submit a PR tomorrow! #543
Thanks for pointing it out!
pkg/clients/cloud_client.go
Outdated
@@ -115,6 +116,39 @@ func (c *CloudAPIClient) GetRegionDetails(ctx context.Context, provider CloudPro | |||
return ®ion, nil | |||
} | |||
|
|||
// EnableRegion sends a PATCH request to enable a region and polls until the region is enabled or a timeout is reached. |
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.
It seems like this comment describes the region resource, this function doesn't appear to do any polling?
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.
Ah yes, I initially had it setup that way, but a better approach is to do the polling in the resource itself rather than the client lib, so I moved the waitForRegionToBeEnabled
to the resource itself. Will update that comment accordingly!
Closes #432