Skip to content

Commit

Permalink
GCLOUD2-16030 ipfamily support
Browse files Browse the repository at this point in the history
  • Loading branch information
alexk53 committed Sep 11, 2024
1 parent 570c987 commit b9fe639
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/resources/instancev2.md
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ Optional:

- `existing_fip_id` (String)
- `ip_address` (String)
- `ip_family` (String) IP family for the interface, available values are 'dual', 'ipv4' and 'ipv6'
- `network_id` (String) required if type is 'subnet' or 'any_subnet'
- `order` (Number) Order of attaching interface
- `port_id` (String) required if type is 'reserved_fixed_ip'
Expand Down
10 changes: 8 additions & 2 deletions gcore/resource_gcore_instancev2.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ inside an instance resource.`,
Optional: true,
Description: "Order of attaching interface",
},
"ip_family": {
Type: schema.TypeString,
Optional: true,
Description: "IP family for the interface, available values are 'dual', 'ipv4' and 'ipv6'",
},
"network_id": {
Type: schema.TypeString,
Description: "required if type is 'subnet' or 'any_subnet'",
Expand Down Expand Up @@ -771,8 +776,9 @@ func resourceInstanceV2Update(ctx context.Context, d *schema.ResourceData, m int
ifaceName := iface["name"].(string)
opts := instances.InterfaceInstanceCreateOpts{
InterfaceOpts: instances.InterfaceOpts{
Name: &ifaceName,
Type: iType,
Name: &ifaceName,
Type: iType,
IPFamily: types.IPFamilyType(iface["ip_family"].(string)),
},
}

Expand Down
1 change: 1 addition & 0 deletions gcore/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ func extractInstanceInterfacesMapV2(interfaces []interface{}) ([]instances.Inter

name := inter["name"].(string)
I.Name = &name
I.IPFamily = types.IPFamilyType(inter["ip_family"].(string))

Interfaces[i] = instances.InterfaceInstanceCreateOpts{
InterfaceOpts: I,
Expand Down

0 comments on commit b9fe639

Please sign in to comment.