Skip to content

Commit d2e85d6

Browse files
committed
feat: update example and docs
1 parent 4ac3dae commit d2e85d6

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

terraform/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This module setup Cloud Scheduler jobs to trigger Cloud Functions via pubsub top
44

55
## Usage
66

7-
The following simple example setup scheduler to schedule Compute instance in the project gce-instance-project-id to start at 8AM and stop at 8PM on Monday to Friday. There are example in [`terraform/examples`](./terraform/examples/) directory.
7+
The following simple example setup scheduler to schedule Compute instance in the project resource-project-id to start at 8AM and stop at 8PM on Monday to Friday. More examples in [`terraform/examples`](./terraform/examples/) directory.
88

99
```
1010
module "start_stop_scheduler" {
@@ -20,6 +20,7 @@ module "start_stop_scheduler" {
2020
start_schedule = "0 8 * * 1-5"
2121
stop_schedule = "0 20 * * 1-5"
2222
project = "resource-project-id"
23+
resource_types = ["gce"]
2324
}
2425
]
2526

terraform/examples/full/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Terraform Start Stop Scheduler
22

3-
This example module schedule instances to start at 8AM and stop at 8PM (Bangkok timezone) on Monday to Friday. Cloud functions can start and stop Compute Engine instance, GKE node pools and SQL instances in the project `scheduled_project_id` that specified in start and stop message.
3+
This example schedules Compute Engine instances, Cloud SQL instances and GKE node pools in the project `scheduled_project_id` to start at 8AM and stop at 8PM (Bangkok timezone) on Monday to Friday.
44

55
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
66
## Inputs

terraform/examples/full/main.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,23 @@ module "start_stop_scheduler" {
66

77
schedules = [
88
{
9+
# Start and stop schedules for CloudSQL and Compute Engine instances
910
start_job_name = "start-instances"
1011
stop_job_name = "stop-instances"
1112
start_schedule = "0 8 * * 1-5"
1213
stop_schedule = "0 20 * * 1-5"
1314
project = var.scheduled_project_id
15+
resource_types = ["gce", "sql"]
16+
},
17+
{
18+
# Start and stop schedules for GKE node pools with resource label
19+
start_job_name = "start-node-pools"
20+
stop_job_name = "stop-node-pools"
21+
start_schedule = "0 8 * * 1-5"
22+
stop_schedule = "0 20 * * 1-5"
23+
project = var.scheduled_project_id
24+
resource_types = ["gke"]
25+
resource_labels = { preemptible = "true" }
1426
}
1527
]
1628

terraform/modules/pubsub-function/main.tf

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,6 @@ resource "google_cloudfunctions2_function" "default" {
3838
environment_variables = var.environment_variables
3939
}
4040

41-
# event_trigger {
42-
# event_type = "google.cloud.pubsub.topic.v1.messagePublished"
43-
# trigger_region = var.location
44-
# pubsub_topic = var.pubsub_topic
45-
# service_account_email = var.trigger_service_account_email
46-
# retry_policy = "RETRY_POLICY_DO_NOT_RETRY"
47-
# event_filters {
48-
# attribute = var.pubsub_filter.attribute
49-
# value = var.pubsub_filter.value
50-
# }
51-
# }
52-
5341
labels = var.function_labels
5442

5543
lifecycle {

0 commit comments

Comments
 (0)