Can't delete an unhealty cluster?

Can’t seem to delete an unhealthy cluster. I get the following error:

Command failed: /opt/pf9/qbert/bin/terraform destroy -refresh=true -force -state=/mnt/mysqlfs/qbert/cloud/aws/3ebaaee8-2aae-4e38-88be-390ea692d18e.tfstate -var-file=/mnt/mysqlfs/qbert/cloud/aws/3ebaaee8-2aae-4e38-88be-390ea692d18e.tfvars.json -no-color -input=false

Error: Error in function call

on …/…/modules/network/private/private-network.tf line 86, in resource “aws_route_table” “nat_route_table”:

86: nat_gateway_id = element(aws_nat_gateway.nat_gateway.*.id, count.index)

|----------------

| aws_nat_gateway.nat_gateway is empty tuple

| count.index is 2

Call to function “element” failed: cannot use element function with an empty

list.

Error: Error in function call

on …/…/modules/network/private/private-network.tf line 86, in resource “aws_route_table” “nat_route_table”:

86: nat_gateway_id = element(aws_nat_gateway.nat_gateway.*.id, count.index)

|----------------

| aws_nat_gateway.nat_gateway is empty tuple

| count.index is 0

Call to function “element” failed: cannot use element function with an empty

list.

Error: Error in function call

on …/…/modules/network/private/private-network.tf line 86, in resource “aws_route_table” “nat_route_table”:

86: nat_gateway_id = element(aws_nat_gateway.nat_gateway.*.id, count.index)

|----------------

| aws_nat_gateway.nat_gateway is empty tuple

| count.index is 1

Call to function “element” failed: cannot use element function with an empty

list.

Hi @roberto , I’ll take a look at this shortly

Thanks @chaitanya let me know if you need any more info.

Hey @roberto sorry for the delay. Can you attempt to delete the cluster using the API?

Here is the API call ref. You can get a token using this snippet.

$ TOKEN=(curl -D - -sH "Content-Type: application/json" https://__DDU__/keystone/v3/auth/tokens -d '{"auth": {"identity": {"methods": ["password"], "password": {"user": {"name": "<__signup_email__>", "domain": {"id": "default"}, "password": "__PASSWORD__"}}}}}' | grep -Fi 'X-Subject-Token' | awk '{print $2}')

Many thanks @chaitanya I will give that a try.

@chaitanya I’m getting the following error when trying to get a token:

HTTP/2 401 
server: nginx/1.15.3
date: Tue, 21 Sep 2021 21:12:33 GMT
content-type: application/json
content-length: 109
vary: X-Auth-Token
x-openstack-request-id: req-e9d702c8-87c3-4418-a3b8-491f1986ad1f
www-authenticate: Keystone uri="https://pmkft-XXXXXXXXXX.platform9.io/keystone/v3"
access-control-allow-origin: https://platform9.com
access-control-allow-credentials: true
access-control-allow-methods: GET, PUT, POST, DELETE, PATCH, OPTIONS
access-control-allow-headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,If-Modified-Since,Cache-Control,Content-Type,Authorization,X-Auth-Token
strict-transport-security: max-age=15724800; includeSubDomains

{"error":{"code":401,"message":"The request you have made requires authentication.","title":"Unauthorized"}}

I can’t seem to find any API docs for that endpoint?

Ok figured it out, that curl command needs to be a POST.