Skip to content

Commit 33eade7

Browse files
author
Aaron Lane
authored
Merge pull request #23 from terraform-google-modules/aaron-lane-patch-1
Expose function_timeout_s on project_cleanup
2 parents bef5ef8 + 54ad802 commit 33eade7

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning][semver-site].
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- The `function_timeout_s` variable is exposed on the `project_cleanup` submodule.
13+
1014
## [1.1.1] - 2019-11-13
1115

1216
### Fixed

modules/project_cleanup/function_source/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,9 @@ func invoke(ctx context.Context) {
219219
requestFilter := fmt.Sprintf("parent.type:folder parent.id:%s", localFolderId)
220220
req := cloudResourceManagerService.Projects.List().Filter(requestFilter)
221221
if err := req.Pages(ctx, processProjectsResponsePage(removeProjectWithLiens)); err != nil {
222-
logger.Printf("Fail to get projects for the forlder with id [%s], error [%s]", localFolderId, err.Error())
222+
logger.Printf("Fail to get projects for the folder with id [%s], error [%s]", localFolderId, err.Error())
223223
} else {
224-
logger.Printf("Got and processed all projects for the forlder with id [%s]", localFolderId)
224+
logger.Printf("Got and processed all projects for the folder with id [%s]", localFolderId)
225225
}
226226
}
227227

@@ -234,7 +234,7 @@ func invoke(ctx context.Context) {
234234
removeProjectsInFolder(folderId)
235235
return nil
236236
}); err != nil {
237-
logger.Fatalf("Fail to get subfolders for the forlder with id [%s], error [%s]", folderId, err.Error())
237+
logger.Fatalf("Fail to get subfolders for the folder with id [%s], error [%s]", folderId, err.Error())
238238
}
239239
}
240240

modules/project_cleanup/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ module "scheduled_project_cleaner" {
4646
function_description = "Clean up GCP projects older than ${var.max_project_age_in_hours} hours matching particular tags"
4747
function_runtime = "go111"
4848
function_service_account_email = google_service_account.project_cleaner_function.email
49+
function_timeout_s = var.function_timeout_s
4950

5051
function_environment_variables = {
5152
TARGET_EXCLUDED_LABELS = jsonencode(var.target_excluded_labels)

modules/project_cleanup/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
* limitations under the License.
1515
*/
1616

17+
variable "function_timeout_s" {
18+
type = number
19+
default = 60
20+
description = "The amount of time in seconds allotted for the execution of the function."
21+
}
22+
1723
variable "organization_id" {
1824
type = string
1925
description = "The organization ID whose projects to clean up"

0 commit comments

Comments
 (0)