-
Notifications
You must be signed in to change notification settings - Fork 681
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 Custom Endpoints to Logs Routing Service #5961
Add Custom Endpoints to Logs Routing Service #5961
Conversation
ibm/service/logsrouting/utils.go
Outdated
originalConfigServiceURL := logsRoutingClient.GetServiceURL() | ||
|
||
f := conns.EnvFallBack([]string{"IBMCLOUD_ENDPOINTS_FILE_PATH", "IC_ENDPOINTS_FILE_PATH"}, "") | ||
visibility := conns.EnvFallBack([]string{"IBMCLOUD_VISIBILITY", "IC_VISIBILITY"}, "") |
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.
BNPP will n't set any ENV variable they declare the file as part of provider bloack
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 just check for region in originalClient and replace with resource region if its n't empty and they are different
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 reason I'm retrieving those env variables is in the custom endpoint documentation: https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/guides/custom-service-endpoints#2-define-service-endpoints-by-using-an-endpoints-file
I found clients can provide visibility and the endpoints file in the provider block or as env variables
provider "ibm" {
# ... other provider configuration ...
endpoints_file_path = "<file_path_to_endpoints_file_path>"
visibility = "<private_or_public>"
}
-or-
export IC_ENDPOINTS_FILE_PATH="<endpoint_value>"
export IC_VISIBILITY="<private_or_public>"
Can we just check for region in originalClient and replace with resource region if its n't empty and they are different
Yes, we could do that. However, if a client defines custom endpoints for all the regions, and they try to manage tenants in multiple regions within the same terraform file, how can I retrieve the custom endpoint from the endpoints file to update the URL?
It seems to me that utils.go
must have access to the endpoints file so that it can use the custom URL for any new region it needs to manage
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 just check for region in originalClient and replace with resource region if its n't empty and they are different
This would work if we only had to change the endpoint type (private or public) and the region. The tenant resource d *schema.ResourceData
has the region, and public or private we can get from the current service url. However when a client provides a custom endpoints file, I think we have to check back in the file to retrieve endpoints for different regions.
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.
When user provides a custom endpoint URL also we would have already set the client URL in provider config it self
originalConfigServiceURL := logsRoutingClient.GetServiceURL() this should have the custom url.
The only thing we need to document is they need to have same mapping of region in custom/resource region atribute
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 have simplified the code in utils.go
to just determine the region and substitute it when needed. A client will be able to manage multiple tenants with custom endpoints in the same terraform file by declaring separate provider blocks. If they don't want to use custom endpoints, they don't need to declare separate provider blocks.
Community Note
Relates OR Closes #0000
Output from acceptance testing: