https://pulumi.com logo
#general
Title
# general
f

full-dress-10026

11/27/2019, 2:40 AM
Why does this command fail when the urn exists in my stack's state file?
Copy code
pulumi state delete urn:pulumi:dev::vm-scaler::kubernetes:<http://helm.sh/v2:Chart$kubernetes:rbac.authorization.k8s.io/v1:ClusterRoleBinding::dd-agent-datadog|helm.sh/v2:Chart$kubernetes:rbac.authorization.k8s.io/v1:ClusterRoleBinding::dd-agent-datadog>
 warning: This command will edit your stack's state directly. Confirm? Yes
error: No such resource "urn:pulumi:dev::vm-scaler::kubernetes:<http://helm.sh/v2:Chart:rbac.authorization.k8s.io/v1:ClusterRoleBinding::dd-agent-datadog|helm.sh/v2:Chart:rbac.authorization.k8s.io/v1:ClusterRoleBinding::dd-agent-datadog>" exists in the current state
If I search for
urn:pulumi:dev::vm-scaler::kubernetes:<http://helm.sh/v2:chart:rbac.authorization.k8s.io/v1:ClusterRoleBinding::dd-agent-datadog|helm.sh/v2:chart:rbac.authorization.k8s.io/v1:ClusterRoleBinding::dd-agent-datadog>
in my stack's json file, I will find it.
Even more confusing is if I try to delete the parent resource:
Copy code
pulumi state delete urn:pulumi:dev::vm-scaler::kubernetes:<http://helm.sh/v2:Chart::dd-agent|helm.sh/v2:Chart::dd-agent>
 warning: This command will edit your stack's state directly. Confirm? Yes
error: This resource can't be safely deleted because the following resources depend on it:
 * "dd-agent-kube-state-metrics" (urn:pulumi:dev::vm-scaler::kubernetes:<http://helm.sh/v2:Chart$kubernetes:core/v1:Service::dd-agent-kube-state-metrics|helm.sh/v2:Chart$kubernetes:core/v1:Service::dd-agent-kube-state-metrics>)
 * "dd-agent-kube-state-metrics" (urn:pulumi:dev::vm-scaler::kubernetes:<http://helm.sh/v2:Chart$kubernetes:core/v1:ServiceAccount::dd-agent-kube-state-metrics|helm.sh/v2:Chart$kubernetes:core/v1:ServiceAccount::dd-agent-kube-state-metrics>)
 * "dd-agent-kube-state-metrics" (urn:pulumi:dev::vm-scaler::kubernetes:<http://helm.sh/v2:Chart$kubernetes:apps/v1:Deployment::dd-agent-kube-state-metrics|helm.sh/v2:Chart$kubernetes:apps/v1:Deployment::dd-agent-kube-state-metrics>)
 * "dd-agent-kube-state-metrics" (urn:pulumi:dev::vm-scaler::kubernetes:<http://helm.sh/v2:Chart$kubernetes:rbac.authorization.k8s.io/v1beta1:ClusterRoleBinding::dd-agent-kube-state-metrics|helm.sh/v2:Chart$kubernetes:rbac.authorization.k8s.io/v1beta1:ClusterRoleBinding::dd-agent-kube-state-metrics>)
 * "dd-agent-datadog" (urn:pulumi:dev::vm-scaler::kubernetes:<http://helm.sh/v2:Chart$kubernetes:core/v1:ServiceAccount::dd-agent-datadog|helm.sh/v2:Chart$kubernetes:core/v1:ServiceAccount::dd-agent-datadog>)
 * "dd-agent-datadog" (urn:pulumi:dev::vm-scaler::kubernetes:<http://helm.sh/v2:Chart$kubernetes:rbac.authorization.k8s.io/v1:ClusterRoleBinding::dd-agent-datadog|helm.sh/v2:Chart$kubernetes:rbac.authorization.k8s.io/v1:ClusterRoleBinding::dd-agent-datadog>)
 * "dd-agent-datadog" (urn:pulumi:dev::vm-scaler::kubernetes:<http://helm.sh/v2:Chart$kubernetes:core/v1:Secret::dd-agent-datadog|helm.sh/v2:Chart$kubernetes:core/v1:Secret::dd-agent-datadog>)
 * "dd-agent-datadog" (urn:pulumi:dev::vm-scaler::kubernetes:<http://helm.sh/v2:Chart$kubernetes:rbac.authorization.k8s.io/v1:ClusterRole::dd-agent-datadog|helm.sh/v2:Chart$kubernetes:rbac.authorization.k8s.io/v1:ClusterRole::dd-agent-datadog>)
 * "dd-agent-kube-state-metrics" (urn:pulumi:dev::vm-scaler::kubernetes:<http://helm.sh/v2:Chart$kubernetes:rbac.authorization.k8s.io/v1beta1:ClusterRole::dd-agent-kube-state-metrics|helm.sh/v2:Chart$kubernetes:rbac.authorization.k8s.io/v1beta1:ClusterRole::dd-agent-kube-state-metrics>)
 * "dd-agent-datadog" (urn:pulumi:dev::vm-scaler::kubernetes:<http://helm.sh/v2:Chart$kubernetes:apps/v1:DaemonSet::dd-agent-datadog|helm.sh/v2:Chart$kubernetes:apps/v1:DaemonSet::dd-agent-datadog>)
 * "dd-agent-datadog" (urn:pulumi:dev::vm-scaler::kubernetes:<http://helm.sh/v2:Chart$kubernetes:core/v1:ServiceAccount::dd-agent-datadog|helm.sh/v2:Chart$kubernetes:core/v1:ServiceAccount::dd-agent-datadog>)
 * "dd-agent-kube-state-metrics" (urn:pulumi:dev::vm-scaler::kubernetes:<http://helm.sh/v2:Chart$kubernetes:core/v1:ServiceAccount::dd-agent-kube-state-metrics|helm.sh/v2:Chart$kubernetes:core/v1:ServiceAccount::dd-agent-kube-state-metrics>)
 * "dd-agent-datadog" (urn:pulumi:dev::vm-scaler::kubernetes:<http://helm.sh/v2:Chart$kubernetes:rbac.authorization.k8s.io/v1:ClusterRoleBinding::dd-agent-datadog|helm.sh/v2:Chart$kubernetes:rbac.authorization.k8s.io/v1:ClusterRoleBinding::dd-agent-datadog>)
 * "dd-agent-datadog" (urn:pulumi:dev::vm-scaler::kubernetes:<http://helm.sh/v2:Chart$kubernetes:rbac.authorization.k8s.io/v1:ClusterRole::dd-agent-datadog|helm.sh/v2:Chart$kubernetes:rbac.authorization.k8s.io/v1:ClusterRole::dd-agent-datadog>)
 * "dd-agent-datadog" (urn:pulumi:dev::vm-scaler::kubernetes:<http://helm.sh/v2:Chart$kubernetes:core/v1:Secret::dd-agent-datadog|helm.sh/v2:Chart$kubernetes:core/v1:Secret::dd-agent-datadog>)
 * "dd-agent-kube-state-metrics" (urn:pulumi:dev::vm-scaler::kubernetes:<http://helm.sh/v2:Chart$kubernetes:rbac.authorization.k8s.io/v1beta1:ClusterRoleBinding::dd-agent-kube-state-metrics|helm.sh/v2:Chart$kubernetes:rbac.authorization.k8s.io/v1beta1:ClusterRoleBinding::dd-agent-kube-state-metrics>)
 * "dd-agent-kube-state-metrics" (urn:pulumi:dev::vm-scaler::kubernetes:<http://helm.sh/v2:Chart$kubernetes:rbac.authorization.k8s.io/v1beta1:ClusterRole::dd-agent-kube-state-metrics|helm.sh/v2:Chart$kubernetes:rbac.authorization.k8s.io/v1beta1:ClusterRole::dd-agent-kube-state-metrics>)

Delete those resources first before deleting this one.
Clearly it is finding that child resource urn.
Ah, needed to single quote the urn.
w

white-balloon-205

11/27/2019, 3:15 AM
Very subtle - but these resources include
$
in there name which is likely evaluated by your shell. Make sure to quote the urns.