Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces support for multiple network interfaces during CloudStack instance creation by adding a new network_ids field that accepts a list of network IDs as an alternative to the existing single network_id field.
- Adds
network_idsfield as a list type to support multiple network interfaces - Implements mutual exclusivity between
network_idandnetwork_idsfields using ConflictsWith - Updates instance creation logic to handle the new list-based network configuration
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| if networks, ok := d.GetOk("network_ids"); ok { | ||
| var networkIds []string | ||
| for _, nw := range networks.([]interface{}) { | ||
| networkIds = append(networkIds, fmt.Sprintf("%v", nw)) |
There was a problem hiding this comment.
Using fmt.Sprintf with %v is unnecessary and potentially unsafe for type conversion. Since the schema defines the element type as TypeString, cast directly to string: networkIds = append(networkIds, nw.(string))
| networkIds = append(networkIds, fmt.Sprintf("%v", nw)) | |
| networkIds = append(networkIds, nw.(string)) |
| for _, nw := range networks.([]interface{}) { | ||
| networkIds = append(networkIds, fmt.Sprintf("%v", nw)) | ||
| } | ||
| p.SetNetworkids(networkIds); |
There was a problem hiding this comment.
Remove the semicolon at the end of the line. Go does not require semicolons at the end of statements.
| p.SetNetworkids(networkIds); | |
| p.SetNetworkids(networkIds) |
|
@JSpon Please check Copilot's comments and also update the documentation. |
|
@JSpon could you please let us know if you want the PR in the upcoming release? Currently, we need the PR to pass the tests and the conflicts must be resolved inorder to merge it |
Allows for multiple network ids on instance creation