Skip to content

Commit

Permalink
fix(container_domain): check 404 responses
Browse files Browse the repository at this point in the history
  • Loading branch information
Codelax committed Nov 21, 2022
1 parent cfc8bf5 commit 9784454
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion scaleway/resource_container_domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ func resourceScalewayContainerDomainRead(ctx context.Context, d *schema.Resource

domain, err := waitForContainerDomain(ctx, api, domainID, region, d.Timeout(schema.TimeoutCreate))
if err != nil {
if is404Error(err) {
d.SetId("")
return nil
}
return diag.FromErr(err)
}

Expand All @@ -102,14 +106,18 @@ func resourceScalewayContainerDomainDelete(ctx context.Context, d *schema.Resour

_, err = waitForContainerDomain(ctx, api, domainID, region, d.Timeout(schema.TimeoutUpdate))
if err != nil {
if is404Error(err) {
d.SetId("")
return nil
}
return diag.FromErr(err)
}

_, err = api.DeleteDomain(&container.DeleteDomainRequest{
Region: region,
DomainID: domainID,
}, scw.WithContext(ctx))
if err != nil {
if err != nil && !is404Error(err) {
return diag.FromErr(err)
}

Expand Down

0 comments on commit 9784454

Please sign in to comment.