You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This example module schedules a job to clean up GCP projects older than a specified length of time, that match a particular key-value pair. This job runs every 5 minutes via Google Cloud Scheduled Functions. Please see the [utility's readme](./function_source/README.md) for more information as to its operation and configuration.
4
+
5
+
Running this module requires an App Engine app in the specified project/region, which is not handled by this example. More information is in the [root readme](../../README.md#app-engine).
6
+
7
+
[^]: (autogen_docs_start)
8
+
9
+
10
+
## Inputs
11
+
12
+
| Name | Description | Type | Default | Required |
13
+
|------|-------------|:----:|:-----:|:-----:|
14
+
| organization_id | The organization ID whose projects to clean up | string | - | yes |
15
+
| project_id | The project ID to host the scheduled function in | string | - | yes |
16
+
| region | The region the project is in (App Engine specific) | string |`us-central1`| no |
This is a simple utility that scans a GCP organization for projects matching certain criteria, and enqueues such projects for deletion. Currently supported criteria are the combination of:
4
+
5
+
-**Age:** Only projects older than the configured age, in hours, will be marked for deletion.
6
+
-**Key-Value Pair:** Only projects whose labels contain the provided key-value pair will be marked for deletion.
7
+
8
+
## Environment Configuration
9
+
10
+
The following environment variables may be specified to configure the cleanup utility:
11
+
12
+
| Name | Description | Type | Default | Required |
13
+
|------|-------------|:----:|:-----:|:-----:|
14
+
|`TARGET_TAG_NAME`| The tag name to match on for identifying projects to delete | string | n/a | yes |
15
+
|`TARGET_TAG_VALUE`| The tag value to match on for identifying projects to delete | string | n/a | yes |
16
+
|`MAX_PROJECT_AGE_HOURS`| The project age, in hours, at which point deletion should be considered | integer | n/a | yes |
17
+
18
+
## Required Permissions
19
+
20
+
This Cloud Function must be run as a Service Account with the `owner` role at an organization level.
0 commit comments