i have a eks cluster that is in the state but not ...
# kubernetes
d
i have a eks cluster that is in the state but not on AWS, im trying to delete it in my pulumi state, but when i delete try to delete the cluster with the urn, it gives me an error saying there are dependent resources. when i try to delete the dependent resources it says the urn’s dont exist. the error message look like this
Copy code
pulumi state delete urn:pulumi:main::infra::eks:index:Cluster::cluster --force  
error: This resource can't be safely deleted because the following resources depend on it:
 * "cluster-eksClusterSecurityGroup" (urn:pulumi:main::infra::eks:index:Cluster$aws:ec2/securityGroup:SecurityGroup::cluster-eksClusterSecurityGroup)
 * "cluster-eksRole" (urn:pulumi:main::infra::eks:index:Cluster$eks:index:ServiceRole::cluster-eksRole)
 * "cluster-instanceRole" (urn:pulumi:main::infra::eks:index:Cluster$eks:index:ServiceRole::cluster-instanceRole)
is the string in brackets the urn? this error message also looks weird to me, the urn is different in the error message?
Copy code
➜  infra git:(main) ✗ pulumi state delete --force  urn:pulumi:main::infra::eks:index:Cluster$kubernetes:<http://storage.k8s.io/v1:StorageClass::cluster-gp2|storage.k8s.io/v1:StorageClass::cluster-gp2>
 warning: This command will edit your stack's state directly. Confirm? Yes
error: No such resource "urn:pulumi:main::infra::eks:index:Clusterer-gp2" exists in the current state
s
Hey Peter. Have you tried doing a
pulumi up --refresh
first ?
d
i’ve ran
pulumi refresh
but i get errors saying
Preview failed: failed to read resource state due to unreachable cluster. If the cluster has been deleted, you can edit the pulumi state to remove this resource
saying the cluster is unreachable. i dont know how this happened but pulumi up ran with no errors. but no cluster was actually created.
b
@dry-teacher-74595 you need to escape the URN because it has a
$
sign in it;
Copy code
pulumi state delete --force  'urn:pulumi:main::infra::eks:index:Cluster$kubernetes:<http://storage.k8s.io/v1:StorageClass::cluster-gp2|storage.k8s.io/v1:StorageClass::cluster-gp2>'
d
ah gotcha thanks
b
as for deleting the cluster, the EKS cluster is a component consisting of many resources, so it's going to be a little tedious I'm afraid, but
pulumi stack --show-urn
will help
d
yep, escaping the $ sign did the trick, thanks.
🎉 1