diff --git a/docs/resources/instancev2.md b/docs/resources/instancev2.md index e98e9a9..06aa9a3 100644 --- a/docs/resources/instancev2.md +++ b/docs/resources/instancev2.md @@ -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' diff --git a/gcore/resource_gcore_instancev2.go b/gcore/resource_gcore_instancev2.go index ef5af04..d8e9b6d 100644 --- a/gcore/resource_gcore_instancev2.go +++ b/gcore/resource_gcore_instancev2.go @@ -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'", @@ -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)), }, } diff --git a/gcore/utils.go b/gcore/utils.go index c7f484b..c6d4c35 100644 --- a/gcore/utils.go +++ b/gcore/utils.go @@ -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, diff --git a/go.mod b/go.mod index 82e4f27..5f15099 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 574c4f6..0120820 100644 --- a/go.sum +++ b/go.sum @@ -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= @@ -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=