Skip to content

Commit

Permalink
GCLOUD2-16030 ipfamily support (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexk53 authored Sep 11, 2024
1 parent 0f6cf43 commit 8118135
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 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
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ require (
golang.org/x/text v0.15.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230629202037-9506855d4529 // indirect
google.golang.org/grpc v1.56.1 // indirect
google.golang.org/protobuf v1.31.0 // indirect
google.golang.org/grpc v1.56.3 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

require (
github.com/go-openapi/runtime v0.26.0 // indirect
github.com/hashicorp/terraform v1.5.2
github.com/hashicorp/terraform v1.5.7
github.com/hashicorp/terraform-exec v0.21.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
go.mongodb.org/mongo-driver v1.12.0 // indirect
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
github.com/hashicorp/terraform v1.5.2 h1:dr8Pw6lQWTNLezOMVVdeCfqnxJVqfcCjnGKA5odW8y0=
github.com/hashicorp/terraform v1.5.2/go.mod h1:8eJbBB3U6I85MGsJp5v9ed20vgA0fgzqnO1PF0zIuh8=
github.com/hashicorp/terraform v1.5.7 h1:HL+iEBdp6mC/tqQM1F5jA5y32CbxXPwyiNQyYSXVzw0=
github.com/hashicorp/terraform v1.5.7/go.mod h1:EFvkS9Pfzgu/8pjDxDhXmKWTONrJRKt38O/bAu/JB9c=
github.com/hashicorp/terraform-exec v0.21.0 h1:uNkLAe95ey5Uux6KJdua6+cv8asgILFVWkd/RG0D2XQ=
github.com/hashicorp/terraform-exec v0.21.0/go.mod h1:1PPeMYou+KDUSSeRE9szMZ/oHf4fYUmB923Wzbq1ICg=
github.com/hashicorp/terraform-json v0.22.1 h1:xft84GZR0QzjPVWs4lRUwvTcPnegqlyS7orfb5Ltvec=
Expand Down Expand Up @@ -488,10 +490,14 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20230629202037-9506855d4529 h1:
google.golang.org/genproto/googleapis/rpc v0.0.0-20230629202037-9506855d4529/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA=
google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ=
google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s=
google.golang.org/grpc v1.56.3 h1:8I4C0Yq1EjstUzUJzpcRVbuYA2mODtEmpWiQoN/b2nc=
google.golang.org/grpc v1.56.3/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down

0 comments on commit 8118135

Please sign in to comment.