This is an automated email from the ASF dual-hosted git repository. pearl11594 pushed a commit to branch add-addParams-addNicToVM in repository https://gitbox.apache.org/repos/asf/cloudstack-terraform-provider.git
commit 9d54061183b50c70e68214fe8d61e0cf249d3e31 Author: Pearl Dsilva <pearl1...@gmail.com> AuthorDate: Tue Aug 26 11:04:41 2025 -0400 Support additional parameters for cloudstack_nic resource --- cloudstack/resource_cloudstack_nic.go | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/cloudstack/resource_cloudstack_nic.go b/cloudstack/resource_cloudstack_nic.go index 82f455e..11f2917 100644 --- a/cloudstack/resource_cloudstack_nic.go +++ b/cloudstack/resource_cloudstack_nic.go @@ -53,6 +53,15 @@ func resourceCloudStackNIC() *schema.Resource { Required: true, ForceNew: true, }, + "mac_address": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "dhcp_options": { + Type: schema.TypeMap, + Optional: true, + }, }, } } @@ -66,11 +75,25 @@ func resourceCloudStackNICCreate(d *schema.ResourceData, meta interface{}) error d.Get("virtual_machine_id").(string), ) - // If there is a ipaddres supplied, add it to the parameter struct + // If there is an ipaddress supplied, add it to the parameter struct if ipaddress, ok := d.GetOk("ip_address"); ok { p.SetIpaddress(ipaddress.(string)) } + // If there is a macaddress supplied, add it to the parameter struct + if macaddress, ok := d.GetOk("mac_address"); ok { + p.SetMacaddress(macaddress.(string)) + } + + // If there are dhcp options supplied, add them to the parameter struct + if dhcpOptions, ok := d.GetOk("dhcp_options"); ok { + dhcpOpts := make(map[string]string) + for k, v := range dhcpOptions.(map[string]interface{}) { + dhcpOpts[k] = v.(string) + } + p.SetDhcpoptions(dhcpOpts) + } + // Create and attach the new NIC r, err := Retry(10, retryableAddNicFunc(cs, p)) if err != nil {