@@ -3,7 +3,6 @@ package mongodb
33import (
44 "context"
55 "errors"
6- "strings"
76 "time"
87
98 "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
@@ -13,12 +12,10 @@ import (
1312 "github.com/scaleway/scaleway-sdk-go/scw"
1413 "github.com/scaleway/terraform-provider-scaleway/v2/internal/dsf"
1514 "github.com/scaleway/terraform-provider-scaleway/v2/internal/httperrors"
16- "github.com/scaleway/terraform-provider-scaleway/v2/internal/locality"
1715 "github.com/scaleway/terraform-provider-scaleway/v2/internal/locality/regional"
1816 "github.com/scaleway/terraform-provider-scaleway/v2/internal/locality/zonal"
1917 "github.com/scaleway/terraform-provider-scaleway/v2/internal/services/account"
2018 "github.com/scaleway/terraform-provider-scaleway/v2/internal/types"
21- "github.com/scaleway/terraform-provider-scaleway/v2/internal/verify"
2219)
2320
2421func ResourceInstance () * schema.Resource {
@@ -106,58 +103,6 @@ func ResourceInstance() *schema.Resource {
106103 "version" ,
107104 },
108105 },
109- //endpoint
110- "private_network" : {
111- Type : schema .TypeSet ,
112- Optional : true ,
113- Description : "Private network specs details" ,
114- Set : privateNetworkSetHash ,
115- DiffSuppressFunc : func (k , oldValue , newValue string , _ * schema.ResourceData ) bool {
116- // Check if the key is for the 'id' attribute
117- if strings .HasSuffix (k , "id" ) {
118- return locality .ExpandID (oldValue ) == locality .ExpandID (newValue )
119- }
120- // For all other attributes, don't suppress the diff
121- return false
122- },
123- Elem : & schema.Resource {
124- Schema : map [string ]* schema.Schema {
125- "id" : {
126- Type : schema .TypeString ,
127- Required : true ,
128- ValidateDiagFunc : verify .IsUUIDorUUIDWithLocality (),
129- Description : "UUID of the private network to be connected to the cluster" ,
130- },
131- "ips" : {
132- Type : schema .TypeList ,
133- Optional : true ,
134- Computed : true ,
135- Elem : & schema.Schema {
136- Type : schema .TypeString ,
137- ValidateFunc : validation .IsCIDR ,
138- },
139- Description : "List of IPv4 addresses of the private network with a CIDR notation" ,
140- },
141- "port" : {
142- Type : schema .TypeInt ,
143- Computed : true ,
144- Description : "The port of your load balancer service" ,
145- },
146- "dns_records" : {
147- Type : schema .TypeString ,
148- Computed : true ,
149- Description : "The DNS record of your endpoint" ,
150- },
151- // computed
152- "endpoint_id" : {
153- Type : schema .TypeString ,
154- Computed : true ,
155- Description : "UUID of the endpoint to be connected to the cluster" ,
156- },
157- "zone" : zonal .ComputedSchema (),
158- },
159- },
160- },
161106 // Computed
162107 "public_network" : {
163108 Type : schema .TypeList ,
@@ -272,19 +217,6 @@ func ResourceInstanceCreate(ctx context.Context, d *schema.ResourceData, m inter
272217 createReq .Tags = types .ExpandStrings (tags )
273218 }
274219
275- pn , pnExists := d .GetOk ("private_network" )
276- if pnExists {
277- pnSpecs , err := expandPrivateNetwork (pn .(* schema.Set ).List ())
278- if err != nil {
279- return diag .FromErr (err )
280- }
281- createReq .Endpoints = pnSpecs
282- } else {
283- epSpecs := make ([]* mongodb.EndpointSpec , 0 , 1 )
284- spec := & mongodb.EndpointSpecPublicDetails {}
285- createReq .Endpoints = append (epSpecs , & mongodb.EndpointSpec {Public : spec })
286- }
287-
288220 res , err = mongodbAPI .CreateInstance (createReq , scw .WithContext (ctx ))
289221 if err != nil {
290222 return diag .FromErr (err )
@@ -333,10 +265,6 @@ func ResourceInstanceRead(ctx context.Context, d *schema.ResourceData, m interfa
333265 _ = d .Set ("volume_size_in_gb" , int (instance .Volume .Size / scw .GB ))
334266 }
335267
336- privateNetworkEndpoints , privateNetworkExists := flattenPrivateNetwork (instance .Endpoints )
337- if privateNetworkExists {
338- _ = d .Set ("private_network" , privateNetworkEndpoints )
339- }
340268 publicNetworkEndpoint , publicNetworkExists := flattenPublicNetwork (instance .Endpoints )
341269 if publicNetworkExists {
342270 _ = d .Set ("public_network" , publicNetworkEndpoint )
0 commit comments