Skip to content

Commit f1a9656

Browse files
committed
Extract filter parameters to variables
1 parent bbf3295 commit f1a9656

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

submodules/project_cleanup/main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ module "scheduled_project_cleaner" {
6868
region = "${var.region}"
6969
topic_name = "pubsub_scheduled_project_cleaner"
7070
function_available_memory_mb = "128"
71-
function_description = "Clean up GCP projects older than 6 hours matching particular tags"
71+
function_description = "Clean up GCP projects older than ${var.max_project_age_in_hours} hours matching particular tags"
7272
function_runtime = "go111"
7373
function_service_account_email = "${google_service_account.project_cleaner_function.email}"
7474

7575
function_environment_variables = {
76-
TARGET_TAG_NAME = "cft-ephemeral"
77-
TARGET_TAG_VALUE = "true"
78-
MAX_PROJECT_AGE_HOURS = "6"
76+
TARGET_TAG_NAME = "${var.target_tag_name}"
77+
TARGET_TAG_VALUE = "${var.target_tag_value}"
78+
MAX_PROJECT_AGE_HOURS = "${var.max_project_age_in_hours}"
7979
}
8080
}

submodules/project_cleanup/variables.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,18 @@ variable "project_id" {
2525
variable "region" {
2626
description = "The region the project is in (App Engine specific)"
2727
}
28+
29+
variable "target_tag_name" {
30+
description = "The name of a tag to filter GCP projects on for consideration by the cleanup utility"
31+
default = "cft-ephemeral"
32+
}
33+
34+
variable "target_tag_value" {
35+
description = "The value of a tag to filter GCP projects on for consideration by the cleanup utility"
36+
default = "true"
37+
}
38+
39+
variable "max_project_age_in_hours" {
40+
description = "The maximum number of hours that a GCP project, selected by `target_tag_name` and `target_tag_value`, can exist"
41+
default = "6"
42+
}

0 commit comments

Comments
 (0)