Skip to content

Commit

Permalink
Folder support: Assign/Reassign a google project to a folder. (hashic…
Browse files Browse the repository at this point in the history
…orp#438)

+ Make the org_id optional when creating a project. Closes hashicorp#131
+ Mark org_id as computed to allow for GCP automatically assigning the org.
+ Add an acceptance test for project creation without an organization.
+ Skip TestAccGoogleProject_createWithoutOrg if GOOGLE_ORG is set.
+ Add a folder_id to the google_project resource, optionally
  specifying the ID of the GCP folder in which the GCP project should
  live.
+ Document how one can provision a project into a folder, and added a
  sample configuration to create a project into an existing folder.
* Skip test without org if service account is used
* Support folders/* or id only for the folder id field
  • Loading branch information
srivasta authored and rosbo committed Sep 22, 2017
1 parent e99db1c commit f09973c
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions docs/r/google_project.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@ resource "google_project" "my_project" {
}
```

To create a project under a specific folder

```hcl
resource "google_project" "my_project-in-a-folder" {
project_id = "your-project-id"
folder_id = "${google_folder.department1.name}"
}
resource "google_folder" "department1" {
display_name = "Department 1"
parent = "organizations/1234567"
}
```

## Argument Reference

The following arguments are supported:
Expand All @@ -53,7 +67,7 @@ The following arguments are supported:
Changing this forces a new project to be created. If this attribute is not
set, `id` must be set. As `id` is deprecated, consider this attribute
required. If you are using `project_id` and creating a new project, the
`org_id` and `name` attributes are also required.
`name` attribute is also required.

* `id` - (Deprecated) The project ID.
This attribute has unexpected behaviour and probably does not work
Expand All @@ -62,8 +76,17 @@ The following arguments are supported:
[below](#id-field) for more information about its behaviour.

* `org_id` - (Optional) The numeric ID of the organization this project belongs to.
This is required if you are creating a new project.
Changing this forces a new project to be created.
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.

* `billing_account` - (Optional) The alphanumeric ID of the billing account this project
belongs to. The user or service account performing this operation with Terraform
Expand Down

0 comments on commit f09973c

Please sign in to comment.