@@ -69,13 +69,13 @@ func ResourceDeployment() *schema.Resource {
6969 "min_size" : {
7070 Type : schema .TypeInt ,
7171 Optional : true ,
72- Computed : true ,
72+ Default : 1 ,
7373 Description : "The minimum size of the pool" ,
7474 },
7575 "max_size" : {
7676 Type : schema .TypeInt ,
7777 Optional : true ,
78- Computed : true ,
78+ Default : 1 ,
7979 Description : "The maximum size of the pool" ,
8080 },
8181 "size" : {
@@ -112,7 +112,7 @@ func ResourceDeployment() *schema.Resource {
112112 Description : "The id of the private endpoint" ,
113113 Computed : true ,
114114 },
115- "private_endpoint_id " : {
115+ "private_network_id " : {
116116 Type : schema .TypeString ,
117117 Description : "The id of the private network" ,
118118 Optional : true ,
@@ -188,6 +188,14 @@ func ResourceDeploymentCreate(ctx context.Context, d *schema.ResourceData, m int
188188 req .AcceptEula = scw .BoolPtr (isAcceptingEula .(bool ))
189189 }
190190
191+ if minSize , ok := d .GetOk ("min_size" ); ok {
192+ req .MinSize = scw .Uint32Ptr (uint32 (minSize .(int )))
193+ }
194+
195+ if maxSize , ok := d .GetOk ("max_size" ); ok {
196+ req .MaxSize = scw .Uint32Ptr (uint32 (maxSize .(int )))
197+ }
198+
191199 deployment , err := api .CreateDeployment (req , scw .WithContext (ctx ))
192200 if err != nil {
193201 return diag .FromErr (err )
@@ -219,7 +227,7 @@ func buildEndpoints(d *schema.ResourceData) []*inference.EndpointSpec {
219227
220228 if privateEndpoint , ok := d .GetOk ("private_endpoint" ); ok {
221229 privateEndpointMap := privateEndpoint .([]interface {})[0 ].(map [string ]interface {})
222- if privateID , exists := privateEndpointMap ["private_endpoint_id " ]; exists {
230+ if privateID , exists := privateEndpointMap ["private_network_id " ]; exists {
223231 privateEp := inference.EndpointSpec {
224232 PrivateNetwork : & inference.EndpointSpecPrivateNetwork {
225233 PrivateNetworkID : regional .ExpandID (privateID .(string )).ID ,
@@ -258,6 +266,7 @@ func ResourceDeploymentRead(ctx context.Context, d *schema.ResourceData, m inter
258266 _ = d .Set ("size" , int (deployment .Size ))
259267 _ = d .Set ("status" , deployment .Status )
260268 _ = d .Set ("model_id" , deployment .ModelID )
269+ _ = d .Set ("tags" , types .ExpandUpdatedStringsPtr (deployment .Tags ))
261270 _ = d .Set ("created_at" , types .FlattenTime (deployment .CreatedAt ))
262271 _ = d .Set ("updated_at" , types .FlattenTime (deployment .UpdatedAt ))
263272 var privateEndpoints []map [string ]interface {}
@@ -266,10 +275,10 @@ func ResourceDeploymentRead(ctx context.Context, d *schema.ResourceData, m inter
266275 for _ , endpoint := range deployment .Endpoints {
267276 if endpoint .PrivateNetwork != nil {
268277 privateEndpointSpec := map [string ]interface {}{
269- "id" : endpoint .ID ,
270- "private_endpoint_id " : regional .NewID (deployment .Region , endpoint .PrivateNetwork .PrivateNetworkID ).String (),
271- "disable_auth" : endpoint .DisableAuth ,
272- "url" : endpoint .URL ,
278+ "id" : endpoint .ID ,
279+ "private_network_id " : regional .NewID (deployment .Region , endpoint .PrivateNetwork .PrivateNetworkID ).String (),
280+ "disable_auth" : endpoint .DisableAuth ,
281+ "url" : endpoint .URL ,
273282 }
274283 privateEndpoints = append (privateEndpoints , privateEndpointSpec )
275284 }
@@ -284,10 +293,10 @@ func ResourceDeploymentRead(ctx context.Context, d *schema.ResourceData, m inter
284293 }
285294 }
286295
287- if len ( privateEndpoints ) > 0 {
296+ if privateEndpoints != nil {
288297 _ = d .Set ("private_endpoint" , privateEndpoints )
289298 }
290- if len ( publicEndpoints ) > 0 {
299+ if publicEndpoints != nil {
291300 _ = d .Set ("public_endpoint" , publicEndpoints )
292301 }
293302 return nil
@@ -307,6 +316,7 @@ func ResourceDeploymentUpdate(ctx context.Context, d *schema.ResourceData, m int
307316 }
308317 return diag .FromErr (err )
309318 }
319+
310320 req := & inference.UpdateDeploymentRequest {
311321 Region : region ,
312322 DeploymentID : deployment .ID ,
@@ -316,6 +326,18 @@ func ResourceDeploymentUpdate(ctx context.Context, d *schema.ResourceData, m int
316326 req .Name = types .ExpandUpdatedStringPtr (d .Get ("name" ))
317327 }
318328
329+ if d .HasChange ("tags" ) {
330+ req .Tags = types .ExpandUpdatedStringsPtr (d .Get ("tags" ))
331+ }
332+
333+ if d .HasChange ("min_size" ) {
334+ req .MinSize = types .ExpandUint32Ptr (d .Get ("min_size" ))
335+ }
336+
337+ if d .HasChange ("max_size" ) {
338+ req .MaxSize = types .ExpandUint32Ptr (d .Get ("max_size" ))
339+ }
340+
319341 if _ , err := api .UpdateDeployment (req , scw .WithContext (ctx )); err != nil {
320342 return diag .FromErr (err )
321343 }
0 commit comments