-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
provider/openstack: Add network_id to Network data source #12615
Conversation
This commit adds the ability to search for a network by its ID. This is useful for doing ID-to-name translations.
@@ -56,6 +60,7 @@ func dataSourceNetworkingNetworkV2Read(d *schema.ResourceData, meta interface{}) | |||
networkingClient, err := config.networkingV2Client(GetRegion(d)) | |||
|
|||
listOpts := networks.ListOpts{ | |||
ID: d.Get("network_id").(string), |
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 it ok to send an empty string to the API? If the optional param isn't given then the ID will be ""
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.
Yep, Gophercloud will ignore zero-value parameters in the GET URL. For example, here's the URL that's built for searching by name
GET http://10.1.12.81:9696/v2.0/networks?name=tf_test_network&status=ACTIVE
and for searching by network_id:
GET http://10.1.12.81:9696/v2.0/networks?id=d1f4958c-dc7b-4726-8b3a-1a748b131e74&status=ACTIVE
tenant_id
is also unset for both, which doesn't get passed through :)
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.
👍 In that case, LGTM!
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.
Thanks, Paul!
This commit adds the ability to search for a network by its ID. This is useful for doing ID-to-name translations.
…12615) This commit adds the ability to search for a network by its ID. This is useful for doing ID-to-name translations.
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
This commit adds the ability to search for a network by its ID. This
is useful for doing ID-to-name translations.
For #9952