google_folder

Allows management of a Google Cloud Platform folder. For more information see the official documentation and API.

A folder can contain projects, other folders, or a combination of both. You can use folders to group projects under an organization in a hierarchy. For example, your organization might contain multiple departments, each with its own set of Cloud Platform resources. Folders allows you to group these resources on a per-department basis. Folders are used to group resources that share common IAM policies.

Folders created live inside an Organization. See the Organization documentation for more details.

The service account used to run Terraform when creating a google_folder resource must have roles/resourcemanager.folderCreator. See the Access Control for Folders Using IAM doc for more information.

Example Usage

# Top-level folder under an organization.
resource "google_folder" "department1" {
  display_name = "Department 1"
  parent       = "organizations/1234567"
}

# Folder nested under another folder.
resource "google_folder" "team-abc" {
  display_name = "Team ABC"
  parent       = google_folder.department1.name
}

Argument Reference

The following arguments are supported:

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

Import

Folders can be imported using the folder's id, e.g.

In Terraform v1.5.0 and later, use an import block to import Folders using one of the formats above. For example:

import {
  id = "folders/{{folder_id}}"
  to = google_folder.default
}

When using the terraform import command, Folders can be imported using one of the formats above. For example:

$ terraform import google_folder.default {{folder_id}}
$ terraform import google_folder.default folders/{{folder_id}}