diff --git a/buildkite/resource_organization.go b/buildkite/resource_organization.go index d76a03b4..7fc92c2a 100644 --- a/buildkite/resource_organization.go +++ b/buildkite/resource_organization.go @@ -160,7 +160,7 @@ func (o *organizationResource) Read(ctx context.Context, req resource.ReadReques } org, err := o.client.GetOrganizationID() - if err == nil { + if err != nil { resp.Diagnostics.AddError( "Unable to find organization", fmt.Sprintf("Unable to find Organization: %s", err.Error()), @@ -198,7 +198,7 @@ func (o *organizationResource) Update(ctx context.Context, req resource.UpdateRe cidrs := createCidrSliceFromList(plan.AllowedApiIpAddresses) org, err := o.client.GetOrganizationID() - if err == nil { + if err != nil { resp.Diagnostics.AddError( "Unable to find organization", fmt.Sprintf("Unable to find Organization: %s", err.Error()), @@ -223,7 +223,7 @@ func (o *organizationResource) Update(ctx context.Context, req resource.UpdateRe if !plan.Enforce2FA.IsNull() && !plan.Enforce2FA.IsUnknown() { org, err := o.client.GetOrganizationID() - if err == nil { + if err != nil { resp.Diagnostics.AddError( "Unable to find organization", fmt.Sprintf("Unable to find Organization: %s", err.Error()), @@ -253,7 +253,7 @@ func (o *organizationResource) Update(ctx context.Context, req resource.UpdateRe func (o *organizationResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { org, err := o.client.GetOrganizationID() - if err == nil { + if err != nil { resp.Diagnostics.AddError( "Unable to find organization", fmt.Sprintf("Unable to find Organization: %s", err.Error()), diff --git a/buildkite/util_test.go b/buildkite/util_test.go index 0a722892..bfc88435 100644 --- a/buildkite/util_test.go +++ b/buildkite/util_test.go @@ -19,7 +19,7 @@ func TestGetOrganizationIDMissing(t *testing.T) { // NewClient calls GetOrganizationId so we can test the output client := NewClient(config) org, err := client.GetOrganizationID() - if err == nil { + if err != nil { t.Fatalf("err: %s", err) } if org != nil {