Google Resource Manager Lien

This page shows how to write Terraform for Resource Manager Lien and write them securely.

google_resource_manager_lien (Terraform)

The Lien in Resource Manager can be configured in Terraform with the resource name google_resource_manager_lien. The following sections describe 3 examples of how to use the resource and its parameters.

Example Usage from GitHub

resource "google_resource_manager_lien" "project_deletion_protection" {
  count        = var.deletion_protection ? 1 : 0
  origin       = "terraform"
  parent       = google_project.project.number
  reason       = "Protecting formal projects from accidental deletion"
  restrictions = ["resourcemanager.projects.delete"]
resource "google_resource_manager_lien" "this" {
  origin       = var.origin
  parent       = var.parent
  reason       = var.reason
  restrictions = var.restrictions

resource "google_resource_manager_lien" "project_deletion" {
  parent       =
  restrictions = ["resourcemanager.projects.delete"]
  origin       = "managed-by-terraform"
  reason       = "This project is managed by terraform"
  depends_on = [


  • create_time requiredcomputed - string
    • Time of creation

  • id optionalcomputed - string
  • name requiredcomputed - string
    • A system-generated unique identifier for this Lien.

  • origin required - string
    • A stable, user-visible/meaningful string identifying the origin of the Lien, intended to be inspected programmatically. Maximum length of 200 characters.

  • parent required - string
    • A reference to the resource this Lien is attached to. The server will validate the parent against those for which Liens are supported. Since a variety of objects can have Liens against them, you must provide the type prefix (e.g. "projects/my-project-name").

  • reason required - string
    • Concise user-visible strings indicating why an action cannot be performed on a resource. Maximum length of 200 characters.

  • restrictions required - list / string
    • The types of operations which should be blocked as a result of this Lien. Each value should correspond to an IAM permission. The server will validate the permissions against those for which Liens are supported. An empty list is meaningless and will be rejected. e.g. ['resourcemanager.projects.delete']

Explanation in Terraform Registry

A Lien represents an encumbrance on the actions that can be performed on a resource.

Frequently asked questions

What is Google Resource Manager Lien?

Google Resource Manager Lien is a resource for Resource Manager of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google Resource Manager Lien?

For Terraform, the ONSdigital/terraform-module-project, niveklabs/google and jonpulsifer/nawl source code examples are useful. See the Terraform Example section for further details.


Scan your IaC problem in 3 minutes for free

You can keep your IaC security for free. No credit card required.