Protect from Delete GCP project

gcloud projects delete one-click-tbd
Your project will be deleted.
Do you want to continue (Y/n)? YDeleted [].You can undo this operation for a limited period by running the command below.
$ gcloud projects undelete one-click-tbd
See for information on shutting down projects.
gcloud alpha resource-manager liens create \
--restrictions=resourcemanager.projects.delete \
--reason="Super important production system"
Check that is applied:
gcloud alpha resource-manager liens list
p151505267786-la6de8a11-573d-4724-8219-ed5a8669d2d2 Super important production system
gcloud projects delete one-click-not-tobedeleted 
Your project will be deleted.
Do you want to continue (Y/n)? YERROR: (gcloud.projects.delete) FAILED_PRECONDITION: Precondition check failed.
- '@type':
- description: A lien to prevent deletion was placed on the project by [].
Remove the lien to allow deletion.
subject: liens/p151505267786-la6de8a11-573d-4724-8219-ed5a8669d2d2
type: LIEN
- '@type':
- description: Troubleshooting project deletion
- '@type':




Working as Cloud Architect & Software enthusiastic

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

What Procurement Teams need to know about Agile

Learning to Code: Turning User Stories Into Code

HackTheBox — Bitlab

How to protect API keys with CMake in Android projects?

How to enable logging MongoDB queries for Spring Boot applications

Installing the Geospatial Data Abstraction Library (GDAL) in Python and Anaconda

A Look Back on the 3rd week of May in 2022 (5/16–5/22)

Implement a simple Operating System

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


Working as Cloud Architect & Software enthusiastic

More from Medium

Cloud Build with Docker and Dockerfile using dynamic environment variables

Helm & Kubernetes | Create Helm Charts

Jenkins CI/CD to update GCP MIG Instance using CloudBuild

A Threatmap for Log4Shell attacks on Google Cloud