This commit is contained in:
2023-05-19 17:14:55 +03:00
parent 8ca233dd32
commit 523d96189f
10 changed files with 77 additions and 69 deletions

View File

@@ -373,7 +373,7 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf
req := compute.PFWAddRequest{
ComputeID: computeId,
PublicPortStart: uint64(pfwItem["public_port_start"].(int)),
PublicPortEnd: uint64(pfwItem["public_port_end"].(int)),
PublicPortEnd: int64(pfwItem["public_port_end"].(int)),
LocalBasePort: uint64(pfwItem["local_port"].(int)),
Proto: pfwItem["proto"].(string),
}
@@ -630,6 +630,8 @@ func resourceComputeUpdate(ctx context.Context, d *schema.ResourceData, m interf
Force: true,
}
warnings := dc.Warnings{}
oldCpu, newCpu := d.GetChange("cpu")
if oldCpu.(int) != newCpu.(int) {
resizeReq.CPU = uint64(newCpu.(int))
@@ -1059,7 +1061,7 @@ func resourceComputeUpdate(ctx context.Context, d *schema.ResourceData, m interf
_, err := c.CloudAPI().Compute().PFWDel(ctx, req)
if err != nil {
return diag.FromErr(err)
warnings.Add(err)
}
}
}
@@ -1071,7 +1073,7 @@ func resourceComputeUpdate(ctx context.Context, d *schema.ResourceData, m interf
req := compute.PFWAddRequest{
ComputeID: computeRec.ID,
PublicPortStart: uint64(pfwItem["public_port_start"].(int)),
PublicPortEnd: uint64(pfwItem["public_port_end"].(int)),
PublicPortEnd: int64(pfwItem["public_port_end"].(int)),
LocalBasePort: uint64(pfwItem["local_port"].(int)),
Proto: pfwItem["proto"].(string),
}
@@ -1311,7 +1313,8 @@ func resourceComputeUpdate(ctx context.Context, d *schema.ResourceData, m interf
// we may reuse dataSourceComputeRead here as we maintain similarity
// between Compute resource and Compute data source schemas
return resourceComputeRead(ctx, d, m)
defer resourceComputeRead(ctx, d, m)
return warnings.Get()
}
func isChangeDisk(els []interface{}, el interface{}) bool {
@@ -1696,6 +1699,7 @@ func ResourceComputeSchemaMake() map[string]*schema.Schema {
"network": {
Type: schema.TypeSet,
Computed: true,
Optional: true,
MinItems: 1,
MaxItems: constants.MaxNetworksPerCompute,