2016-08-23 20:34:54 +00:00
|
|
|
---
|
|
|
|
layout: "google"
|
|
|
|
page_title: "Google: google_project"
|
2017-08-07 17:13:55 +00:00
|
|
|
sidebar_current: "docs-google-project-x"
|
2016-08-23 20:34:54 +00:00
|
|
|
description: |-
|
2017-02-18 22:48:50 +00:00
|
|
|
Allows management of a Google Cloud Platform project.
|
2016-08-23 20:34:54 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
# google\_project
|
|
|
|
|
2017-05-18 06:24:42 +00:00
|
|
|
Allows creation and management of a Google Cloud Platform project.
|
2016-08-23 20:34:54 +00:00
|
|
|
|
2016-11-23 06:55:40 +00:00
|
|
|
Projects created with this resource must be associated with an Organization.
|
2017-03-27 20:28:26 +00:00
|
|
|
See the [Organization documentation](https://cloud.google.com/resource-manager/docs/quickstarts) for more details.
|
2016-11-23 06:55:40 +00:00
|
|
|
|
|
|
|
The service account used to run Terraform when creating a `google_project`
|
|
|
|
resource must have `roles/resourcemanager.projectCreator`. See the
|
|
|
|
[Access Control for Organizations Using IAM](https://cloud.google.com/resource-manager/docs/access-control-org)
|
|
|
|
doc for more information.
|
2016-08-23 20:34:54 +00:00
|
|
|
|
2017-02-24 08:48:03 +00:00
|
|
|
Note that prior to 0.8.5, `google_project` functioned like a data source,
|
|
|
|
meaning any project referenced by it had to be created and managed outside
|
|
|
|
Terraform. As of 0.8.5, `google_project` functions like any other Terraform
|
|
|
|
resource, with Terraform creating and managing the project. To replicate the old
|
|
|
|
behavior, either:
|
|
|
|
|
|
|
|
* Use the project ID directly in whatever is referencing the project, using the
|
|
|
|
[google_project_iam_policy](/docs/providers/google/r/google_project_iam_policy.html)
|
|
|
|
to replace the old `policy_data` property.
|
|
|
|
* Use the [import](/docs/import/usage.html) functionality
|
|
|
|
to import your pre-existing project into Terraform, where it can be referenced and
|
|
|
|
used just like always, keeping in mind that Terraform will attempt to undo any changes
|
|
|
|
made outside Terraform.
|
|
|
|
|
|
|
|
~> It's important to note that any project resources that were added to your Terraform config
|
|
|
|
prior to 0.8.5 will continue to function as they always have, and will not be managed by
|
|
|
|
Terraform. Only newly added projects are affected.
|
|
|
|
|
2016-08-23 20:34:54 +00:00
|
|
|
## Example Usage
|
|
|
|
|
2017-04-17 10:17:54 +00:00
|
|
|
```hcl
|
2016-11-08 07:27:32 +00:00
|
|
|
resource "google_project" "my_project" {
|
2017-09-22 19:42:36 +00:00
|
|
|
name = "My Project"
|
2017-02-18 22:48:50 +00:00
|
|
|
project_id = "your-project-id"
|
|
|
|
org_id = "1234567"
|
2016-08-23 20:34:54 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2017-09-22 18:03:08 +00:00
|
|
|
To create a project under a specific folder
|
|
|
|
|
|
|
|
```hcl
|
|
|
|
resource "google_project" "my_project-in-a-folder" {
|
2017-09-22 19:42:36 +00:00
|
|
|
name = "My Project"
|
2017-09-22 18:03:08 +00:00
|
|
|
project_id = "your-project-id"
|
|
|
|
folder_id = "${google_folder.department1.name}"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "google_folder" "department1" {
|
|
|
|
display_name = "Department 1"
|
|
|
|
parent = "organizations/1234567"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2016-08-23 20:34:54 +00:00
|
|
|
## Argument Reference
|
|
|
|
|
|
|
|
The following arguments are supported:
|
|
|
|
|
2017-09-22 19:42:36 +00:00
|
|
|
* `name` - (Required) The display name of the project.
|
|
|
|
|
2017-10-04 23:19:43 +00:00
|
|
|
* `project_id` - (Required) The project ID. Changing this forces a new project to be created.
|
2016-08-23 20:34:54 +00:00
|
|
|
|
2016-11-23 06:55:40 +00:00
|
|
|
* `org_id` - (Optional) The numeric ID of the organization this project belongs to.
|
2017-09-22 18:03:08 +00:00
|
|
|
Changing this forces a new project to be created. Only one of
|
|
|
|
`org_id` or `folder_id` may be specified. If the `org_id` is
|
|
|
|
specified then the project is created at the top level. Changing
|
|
|
|
this forces the project to be migrated to the newly specified
|
|
|
|
organization.
|
|
|
|
|
|
|
|
* `folder_id` - (Optional) The numeric ID of the folder this project should be
|
|
|
|
created under. Only one of `org_id` or `folder_id` may be
|
|
|
|
specified. If the `folder_id` is specified, then the project is
|
|
|
|
created under the specified folder. Changing this forces the
|
|
|
|
project to be migrated to the newly specified folder.
|
2016-08-23 20:34:54 +00:00
|
|
|
|
2017-04-16 16:53:19 +00:00
|
|
|
* `billing_account` - (Optional) The alphanumeric ID of the billing account this project
|
2017-02-20 17:32:24 +00:00
|
|
|
belongs to. The user or service account performing this operation with Terraform
|
|
|
|
must have Billing Account Administrator privileges (`roles/billing.admin`) in
|
|
|
|
the organization. See [Google Cloud Billing API Access Control](https://cloud.google.com/billing/v1/how-tos/access-control)
|
|
|
|
for more details.
|
|
|
|
|
2016-11-23 06:55:40 +00:00
|
|
|
* `skip_delete` - (Optional) If true, the Terraform resource can be deleted
|
|
|
|
without deleting the Project via the Google API.
|
|
|
|
|
|
|
|
* `policy_data` - (Deprecated) The IAM policy associated with the project.
|
|
|
|
This argument is no longer supported, and will be removed in a future version
|
|
|
|
of Terraform. It should be replaced with a `google_project_iam_policy` resource.
|
2016-08-23 20:34:54 +00:00
|
|
|
|
2017-09-14 17:39:21 +00:00
|
|
|
* `labels` - (Optional) A set of key/value label pairs to assign to the project.
|
|
|
|
|
2016-08-23 20:34:54 +00:00
|
|
|
## Attributes Reference
|
|
|
|
|
|
|
|
In addition to the arguments listed above, the following computed attributes are
|
|
|
|
exported:
|
|
|
|
|
|
|
|
* `number` - The numeric identifier of the project.
|
2017-10-04 23:19:43 +00:00
|
|
|
|
2016-11-23 06:55:40 +00:00
|
|
|
* `policy_etag` - (Deprecated) The etag of the project's IAM policy, used to
|
|
|
|
determine if the IAM policy has changed. Please use `google_project_iam_policy`'s
|
|
|
|
`etag` property instead; future versions of Terraform will remove the `policy_etag`
|
|
|
|
attribute
|
|
|
|
|
2017-06-27 14:07:47 +00:00
|
|
|
## Import
|
|
|
|
|
|
|
|
Projects can be imported using the `project_id`, e.g.
|
|
|
|
|
|
|
|
```
|
|
|
|
$ terraform import google_project.my_project your-project-id
|
|
|
|
```
|