Hey, I am trying to remove `deletionProtection` (o...
# general
b
Hey, I am trying to remove
deletionProtection
(or set to
false
a resource in a stack), aka unprotect. When I run:
Copy code
pulumi state unprotect [resource_urn]
...in the stack the resource belongs to, it does nothing. I have even tried:
Copy code
pulumi state unprotect --all
...and I still see:
Copy code
deletionProtection: true
Any ideas or help?
w
Is your intent to run pulumi destroy or pulumi up after removing the resource from the program?
b
For some reason (not in the code, the flag was never set, but it was set in the state in pulumi console), there were 3 GCP Cloud Run jobs that should have been deleted on a
pulumi up
in CI/CD, but the job failed because of
deletionProtection
. I tried to unprotect them using the methods above, but that did not work. I ended up just manually deleting them in the GCP console and running
pulumi refresh
.
w
Oh. Were you referring to the GCP resource property,
deleteProtection
and not the Pulumi resource option
protect
?
b
So, this is the error we got:
Copy code
error:   sdk-v2/provider2.go:572: sdk.helper_schema: cannot destroy job without setting deletion_protection=false and running `terraform apply`: provider=google-beta@8.41.1
error: deleting urn:pulumi:prod-sleepmelons::bestow-martech-uni::gcp:artifactregistry/repository:Repository$docker:index/image:Image$gcp:cloudrunv2/job:Job::prod-sleepmelons-dbt-job: 1 error occurred:
	* cannot destroy job without setting deletion_protection=false and running `terraform apply`
deletionProtection
(from the docs) seems like a state thing (coming in from Terraform). It is not a property for an actual Cloud Run job.
Copy code
deletionProtection: boolean
Whether Terraform will be prevented from destroying the job. Defaults to true. When a terraform destroy or pulumi up would delete the job, the command will fail if this field is not set to false in Terraform state. When the field is set to true or unset in Terraform state, a pulumi up or terraform destroy that would delete the job will fail. When the field is set to false, deleting the job is allowed.
I am now guessing that this is different from
protect
in the pulumi state. IMHO, this is weird and confusing. I thought maybe
deletionProtection
was a synonym/alias for
protect
. They do the same thing and are not properties of the underlying resource.
e
It's an oddity of the terraform resources. They don't have 'protect' so some resources have a field that does the same thing. Argubly we should just not map those fields into the pulumi model at all.
b
Ahhhh!!! It is an option on CloudRun jobs, but it only protects from Terraform deletion. Weird.
Copy code
Cloud Run Deletion Protection:	Prevents Terraform from destroying or recreating Cloud Run jobs and services.
from https://docs.cloud.google.com/application-design-center/docs/configure-cloud-run-job
TIL. huh.
erp, that is a terraform article on google, nm.
w
FYI, I opened this issue to track this: https://github.com/pulumi/pulumi-gcp/issues/3818