=============== Clean up region =============== #. Make sure that there are no more resources running in the Kubernetes cluster. The fastest way to check is by either querying ``core.projects`` on the database or by using ``croud projects list --region {region} --sudo``. .. code-block:: sql SELECT * FROM core.projects WHERE region = '{region}' AND is_deleted = FALSE; .. warning:: If there are still projects, make sure they are deleted using ``croud`` first! This will ensure that there are no dangling resources in the database thereafter. #. Remove all available products of the specific region by connecting to Brain and running the ``DELETE`` statement: .. code-block:: sql DELETE FROM core.product_availability WHERE region = '{region}'; #. Remove the region by connecting to Brain and running the ``DELETE`` statement after making sure that there are no more projects in this region: .. code-block:: sql DELETE FROM core.regions WHERE name = '{region}'; #. In case the region (Kubernetes cluster) is part of the Crate.io infrastructure, tear it down. #. Remove related secrets from Vault: .. code-block:: console $ REGION="{region}" $ CUSTOMER_ID="{customer}" $ ENV="ext" $ vault kv get "crate/infra/pillar/application/cloud_app/$ENV/service-principals/$REGION" $ vault kv delete "crate/infra/pillar/application/cloud_app/$ENV/service-principals/$REGION" $ vault kv get "/crate/apps/$ENV/cloud-agent/basicauth/$REGION" $ vault kv delete "/crate/apps/$ENV/cloud-agent/basicauth/$REGION" $ vault kv get "/crate/infra/pillar/application/cratedb/$ENV/external-dns/$REGION" $ vault kv delete "/crate/infra/pillar/application/cratedb/$ENV/external-dns/$REGION" $ vault kv get "/crate/infra/pillar/common/docker/registries/cr8cloud/$REGION" $ vault kv delete "/crate/infra/pillar/common/docker/registries/cr8cloud/$REGION" $ vault kv get "/crate/infra/pillar/customer/$CUSTOMER_ID/$REGION" $ vault kv delete "/crate/infra/pillar/customer/$CUSTOMER_ID/$REGION" $ vault kv get "/crate/infra/pillar/application/cratedb/$ENV/keystore/$REGION" $ vault kv delete "/crate/infra/pillar/application/cratedb/$ENV/keystore/$REGION" #. Remove related keys from Vault: Path: `/crate/infra/pillar/cr8/spn`_ Key: ``docker-cloud-$ENV-${REGION//./-}`` #. Go to AWS Route53 and delete all ``A`` and ``TXT`` records created by K8s services #. Destroy the Terraform state of the region in the `crate/salt`_ repo and remove the module from ``regions.tf`` and ``outputs.tf``. .. code-block:: console $ cd terraform/cratedb-cloud/ $ terraform destroy -target module.{region} $ vim regions.tf # remove region $ vim outputs.tf # remove outputs .. _crate/salt: https://github.com/crate/salt/ .. _/crate/infra/pillar/cr8/spn: https://vault.bregenz.a1.cr8.net:8200/ui/vault/secrets/crate/show/infra/pillar/cr8/spn