4.3.8
This commit is contained in:
@@ -54,7 +54,7 @@ func resourceAccountCreate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
func resourceAccountRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||
log.Debugf("resourceAccountRead: called for account with ID: %v", d.Id())
|
||||
|
||||
c := m.(*controller.ControllerCfg)
|
||||
// c := m.(*controller.ControllerCfg)
|
||||
|
||||
acc, err := utilityAccountCheckPresence(ctx, d, m)
|
||||
if err != nil {
|
||||
@@ -67,22 +67,23 @@ func resourceAccountRead(ctx context.Context, d *schema.ResourceData, m interfac
|
||||
switch acc.Status {
|
||||
case status.Destroyed:
|
||||
d.SetId("")
|
||||
return resourceAccountCreate(ctx, d, m)
|
||||
return diag.Errorf("The resource cannot be updated because it has been destroyed")
|
||||
// return resourceAccountCreate(ctx, d, m)
|
||||
case status.Destroying:
|
||||
return diag.Errorf("The account is in progress with status: %s", acc.Status)
|
||||
case status.Deleted:
|
||||
id, _ := strconv.ParseUint(d.Id(), 10, 64)
|
||||
// id, _ := strconv.ParseUint(d.Id(), 10, 64)
|
||||
|
||||
req := account.RestoreRequest{
|
||||
AccountID: id,
|
||||
}
|
||||
// req := account.RestoreRequest{
|
||||
// AccountID: id,
|
||||
// }
|
||||
|
||||
_, err := c.CloudAPI().Account().Restore(ctx, req)
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
// _, err := c.CloudAPI().Account().Restore(ctx, req)
|
||||
// if err != nil {
|
||||
// return diag.FromErr(err)
|
||||
// }
|
||||
|
||||
hasChanged = true
|
||||
// hasChanged = true
|
||||
case status.Disabled:
|
||||
log.Debugf("The account is in status: %s, troubles may occur with update. Please, enable account first.", acc.Status)
|
||||
case status.Confirmed:
|
||||
@@ -142,7 +143,8 @@ func resourceAccountUpdate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
switch acc.Status {
|
||||
case status.Destroyed:
|
||||
d.SetId("")
|
||||
return resourceAccountCreate(ctx, d, m)
|
||||
return diag.Errorf("The resource cannot be updated because it has been destroyed")
|
||||
// return resourceAccountCreate(ctx, d, m)
|
||||
case status.Destroying:
|
||||
return diag.Errorf("The account is in progress with status: %s", acc.Status)
|
||||
case status.Deleted:
|
||||
|
||||
Reference in New Issue
Block a user