dadosfera / Bugsfera

Other
1 stars 0 forks source link

Problemas ao deletar ambiente #97

Open rafaelsantanaep opened 1 year ago

rafaelsantanaep commented 1 year ago

Mandatory informations:

Are there any customers directly impacted by this bug? Which ones?

No

Bug Category

Describe the bug

While trying to delete a customer, the terraform applyfails because it can't delete the roles on postgresql from nimbus and metabase because some objects depends on the role. image

However, when listing the objects that depend on the role using the following query some time after running the terraform:

SELECT
  n.nspname as schema_name,
  c.relname as object_name,
  CASE c.relkind
    WHEN 'r' THEN 'table'
    WHEN 'v' THEN 'view'
    WHEN 'i' THEN 'index'
    WHEN 'S' THEN 'sequence'
    WHEN 's' THEN 'special'
    WHEN 'f' THEN 'foreign table'
  END as object_type
FROM pg_depend d
  JOIN pg_class c ON d.objid = c.oid
  JOIN pg_namespace n ON c.relnamespace = n.oid
WHERE d.refobjid = 'nimbus-cashu'::regrole;

No dependent objects are found. So, I was able to drop the role using the following command:

drop role "nimbus-basealpha";

To fix this permanently, we will probably have to fix our customer module to only delete the role on postgresql to only delete the role when every other dependent object had been deleted.

Workaround:

or

When the bug happened:

rafaelsantanaep commented 1 year ago

@cicerojmm @oliveira-devops @allansene