FlexibleEngineCloud / provider-flexibleengine

Crossplane provider that exposes XRM-conformant managed resources for the FlexibleEngine API.
Apache License 2.0
10 stars 2 forks source link

[DLI] Failed to GET resource flexibleengine_dli_table #26

Closed azrod closed 1 year ago

azrod commented 1 year ago

Problem

In the resource flexibleengine_dli_table GET request return HTTP 400 (FlexibleEngine API ref.) error when the resource does not exist. For crossplane an error must not be returned if the resource does not exist

https://github.com/FrangipaneTeam/provider-flexibleengine/blob/326fac4cea96a0ccd5fa42e5cdc5906993a7cc7c/examples/dli/table.yaml#L1-L2

Error message in provider

Status:
  At Provider:
  Conditions:
    Last Transition Time:  2022-12-28T08:26:40Z
    Message:               observe failed: cannot run refresh: refresh failed: Error query DLI Table "exampledlidatabase/exampledlitable":Bad request with: [GET https://dli.eu-west-0.prod-cloud-ocb.orange-business.com/v1.0/REDACTED/databases/exampledlidatabase/tables/exampledlitable], error message: {"error_code":"DLI.0002","error_msg":"There is no table named exampledlitable"}: 

This error is returned by HuaweiCloud Terraform Provider huaweicloud/services/dli/resource_huaweicloud_dli_table.go#L194-L197

    detail, dErr := tables.Get(client, databaseName, tableName)
    if dErr != nil {
        return fmtp.DiagErrorf("Error query DLI Table %q:%s", d.Id(), dErr)
    }

Reproduce

  1. Clone repo
  2. Use branch feature-dli
  3. kubectl apply -f examples/dli/table.yaml -f examples/dli/database.yaml -f examples/dli/table.yaml.extra
azrod commented 1 year ago

After release DLI table working

 NAME                                                    READY   SYNCED   EXTERNAL-NAME                        AGE                                                    
  table.dli.flexibleengine.upbound.io/example-dli-table   True    True     REDACTED/REDACTED   12m                                                    

  NAME                                                                        READY   SYNCED   EXTERNAL-NAME                       AGE                                 
  obsbucket.oss.flexibleengine.upbound.io/example-dlipackageextra-obsbucket   True    True     REDACTED   12m                                 

  NAME                                                                                  READY   SYNCED   EXTERNAL-NAME        AGE                                      
  obsbucketobject.oss.flexibleengine.upbound.io/example-dlitableextra-obsbucketobject   True    True     user/data/user.csv   12m                                      

  NAME                                                          READY   SYNCED   EXTERNAL-NAME        AGE                                                              
  database.dli.flexibleengine.upbound.io/example-dli-database   True    True    REDACTED   12m