dnsimple / terraform-provider-dnsimple

Terraform DNSimple provider.
https://www.terraform.io/docs/providers/dnsimple/
Mozilla Public License 2.0
22 stars 20 forks source link

Surface all API errors #61

Closed DXTimer closed 1 year ago

DXTimer commented 1 year ago

When errors are returned by the DNSimple API we use attributeErrorsToDiagnostics to unpack the errors and surface them. However, the implementation only handles dnsimple.ErrorResponse.AttributeErrors so when an error is not a Validation failed response nothing will be reported and the user will see the following:

        Error: Provider produced inconsistent result after apply

        When applying changes to dnsimple_zone_record.foobar, provider
        "provider[\"registry.terraform.io/hashicorp/dnsimple\"]" produced an
        unexpected new value: Root resource was present, but now absent.

        This is a bug in the provider, which should be reported in the provider's own
        issue tracker.

How we now report errors:

        Error: API returned an error: Validation failed

          with dnsimple_zone_record.foobar,
          on terraform_plugin_test.tf line 2, in resource "dnsimple_zone_record" "foobar":
           2: resource "dnsimple_zone_record" "foobar" {

        Error: API returned a Validation Error for: base

          with dnsimple_zone_record.foobar,
          on terraform_plugin_test.tf line 2, in resource "dnsimple_zone_record" "foobar":
           2: resource "dnsimple_zone_record" "foobar" {