Skip to content

googleProject

Allows creation and management of a Google Cloud Platform project.

Projects created with this resource must be associated with an Organization. See the Organization documentation for more details.

The user or service account that is running Terraform when creating a googleProject resource must have roles/resourcemanagerProjectCreator on the specified organization. See the Access Control for Organizations Using IAM doc for more information.

\~> This resource reads the specified billing account on every terraform apply and plan operation so you must have permissions on the specified billing account.

\~> It is recommended to use the constraints/computeSkipDefaultNetworkCreation constraint to remove the default network instead of setting autoCreateNetwork to false, when possible.

To get more information about projects, see:

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.project.Project(this, "my_project", {
  name: "My Project",
  org_id: "1234567",
  project_id: "your-project-id",
});

To create a project under a specific folder

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const googleFolderDepartment1 = new google.folder.Folder(this, "department1", {
  display_name: "Department 1",
  parent: "organizations/1234567",
});
new google.project.Project(this, "my_project-in-a-folder", {
  folder_id: googleFolderDepartment1.name,
  name: "My Project",
  project_id: "your-project-id",
});

Argument Reference

The following arguments are supported:

  • name - (Required) The display name of the project.

  • projectId - (Required) The project ID. Changing this forces a new project to be created.

  • orgId - (Optional) The numeric ID of the organization this project belongs to. Changing this forces a new project to be created. Only one of orgId or folderId may be specified. If the orgId is specified then the project is created at the top level. Changing this forces the project to be migrated to the newly specified organization.

  • folderId - (Optional) The numeric ID of the folder this project should be created under. Only one of orgId or folderId may be specified. If the folderId is specified, then the project is created under the specified folder. Changing this forces the project to be migrated to the newly specified folder.

  • billingAccount - (Optional) The alphanumeric ID of the billing account this project belongs to. The user or service account performing this operation with Terraform must have at minimum Billing Account User privileges (roles/billingUser) on the billing account. See Google Cloud Billing API Access Control for more details.

  • skipDelete - (Optional) If true, the Terraform resource can be deleted without deleting the Project via the Google API.

  • labels - (Optional) A set of key/value label pairs to assign to the project.

  • autoCreateNetwork - (Optional) Controls whether the 'default' network exists on the project. Defaults to true, where it is created. If set to false, the default network will still be created by GCP but will be deleted immediately by Terraform. Therefore, for quota purposes, you will still need to have 1 network slot available to create the project successfully, even if you set autoCreateNetwork to false. Note that when false, Terraform enables computeGoogleapisCom on the project to interact with the GCE API and currently leaves it enabled.

Attributes Reference

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

  • id - an identifier for the resource with format projects/{{project}}

  • number - The numeric identifier of the project.

Timeouts

This resource provides the following Timeouts configuration options: configuration options:

  • create - Default is 10 minutes.
  • update - Default is 10 minutes.
  • delete - Default is 10 minutes.

Import

Projects can be imported using the projectId, e.g.

$ terraform import google_project.my_project your-project-id