Skip to content

Commit 3800d9f

Browse files
committed
Revert "refactor(tag): renames scheduler tag"
This reverts commit dfe757a.
1 parent 72b5334 commit 3800d9f

File tree

7 files changed

+16
-29
lines changed

7 files changed

+16
-29
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ module "start_ec2_instance" {
7070
| kms_key_arn | The ARN for the KMS encryption key. If this configuration is not provided when environment variables are in use, AWS Lambda uses a default service key | string | null | no |
7171
| aws_regions | A list of one or more aws regions where the lambda will be apply, default use the current region | list | null | no |
7272
| cloudwatch_schedule_expression | The scheduling expression | string | `"cron(0 22 ? * MON-FRI *)"` | yes |
73+
| schedule_action | Define schedule action to apply on resources | string | `"stop"` | yes |
74+
| resources_tag | Set the tag use for identify resources to stop or start | map | { tostop = "true" } | yes |
7375
| autoscaling_schedule | Enable scheduling on autoscaling resources | string | `"false"` | no |
7476
| ec2_schedule | Enable scheduling on ec2 instance resources | string | `"false"` | no |
7577
| rds_schedule | Enable scheduling on rds resources | string | `"false"` | no |
7678
| cloudwatch_alarm_schedule | Enable scheduleding on cloudwatch alarm resources | string | `"false"` | no |
77-
| schedule_action | Define schedule action to apply on resources | string | `"stop"` | yes |
78-
| scheduler_tag | Set the tag to use for identify aws resources to stop or start | map | {"key" = "tostop", "value" = "true"} | yes |
7979

8080
## Outputs
8181

examples/autoscaling-scheduler/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ module "autoscaling-stop-friday" {
9898
autoscaling_schedule = "true"
9999
cloudwatch_alarm_schedule = "true"
100100

101-
scheduler_tag = {
101+
resources_tag = {
102102
key = "tostop"
103103
value = "true"
104104
}
@@ -114,7 +114,7 @@ module "autoscaling-start-monday" {
114114
autoscaling_schedule = "true"
115115
cloudwatch_alarm_schedule = "true"
116116

117-
scheduler_tag = {
117+
resources_tag = {
118118
key = "tostop"
119119
value = "true"
120120
}

examples/instance-scheduler/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ module "ec2-stop-friday" {
4747
autoscaling_schedule = "false"
4848
cloudwatch_alarm_schedule = "true"
4949

50-
scheduler_tag = {
50+
resources_tag = {
5151
key = "tostop"
5252
value = "true"
5353
}
@@ -63,7 +63,7 @@ module "ec2-start-monday" {
6363
autoscaling_schedule = "false"
6464
cloudwatch_alarm_schedule = "true"
6565

66-
scheduler_tag = {
66+
resources_tag = {
6767
key = "tostop"
6868
value = "true"
6969
}

examples/rds-scheduler/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ module "rds-stop-friday" {
104104
autoscaling_schedule = "false"
105105
cloudwatch_alarm_schedule = "true"
106106

107-
scheduler_tag = {
107+
resources_tag = {
108108
key = "tostop"
109109
value = "true"
110110
}
@@ -120,7 +120,7 @@ module "rds-start-monday" {
120120
autoscaling_schedule = "false"
121121
cloudwatch_alarm_schedule = "true"
122122

123-
scheduler_tag = {
123+
resources_tag = {
124124
key = "tostop"
125125
value = "true"
126126
}

examples/test_fixture/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module "aws-stop-friday" {
1515
ec2_schedule = "true"
1616
rds_schedule = "true"
1717

18-
scheduler_tag = {
18+
resources_tag = {
1919
key = "tostop"
2020
value = "true"
2121
}
@@ -30,7 +30,7 @@ module "aws-start-monday" {
3030
ec2_schedule = "true"
3131
rds_schedule = "true"
3232

33-
scheduler_tag = {
33+
resources_tag = {
3434
key = "tostop"
3535
value = "true"
3636
}

main.tf

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,6 @@ locals {
210210
}
211211
]
212212
}
213-
# Backwared compatibility with the former terraform variable name.
214-
scheduler_tag = var.scheduler_tag == { "key" = "tostop", "value" = "true" } ? var.resources_tag : var.scheduler_tag
215213
}
216214

217215
################################################
@@ -224,7 +222,7 @@ locals {
224222
data "archive_file" "this" {
225223
type = "zip"
226224
source_dir = "${path.module}/package/"
227-
output_path = "${path.module}/aws-stop-start-resources-3.1.1.zip" # The version should match with the latest git tag
225+
output_path = "${path.module}/aws-stop-start-resources-3.1.2.zip" # The version should match with the latest git tag
228226
}
229227

230228
# Create Lambda function for stop or start aws resources
@@ -241,8 +239,8 @@ resource "aws_lambda_function" "this" {
241239
variables = {
242240
AWS_REGIONS = var.aws_regions == null ? data.aws_region.current.name : join(", ", var.aws_regions)
243241
SCHEDULE_ACTION = var.schedule_action
244-
TAG_KEY = local.scheduler_tag["key"]
245-
TAG_VALUE = local.scheduler_tag["value"]
242+
TAG_KEY = var.resources_tag["key"]
243+
TAG_VALUE = var.resources_tag["value"]
246244
EC2_SCHEDULE = tostring(var.ec2_schedule)
247245
RDS_SCHEDULE = tostring(var.rds_schedule)
248246
AUTOSCALING_SCHEDULE = tostring(var.autoscaling_schedule)

variables.tf

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,12 @@ variable "schedule_action" {
3939
}
4040

4141
variable "resources_tag" {
42-
# This variable has been renamed to "scheduler_tag"
43-
description = "DEPRECATED, use scheduler_tag variable instead"
42+
description = "Set the tag use for identify resources to stop or start"
4443
type = map(string)
4544

4645
default = {
47-
"key" = "tostop"
48-
"value" = "true"
49-
}
50-
}
51-
52-
variable "scheduler_tag" {
53-
description = "Set the tag to use for identify aws resources to stop or start"
54-
type = map(string)
55-
56-
default = {
57-
"key" = "tostop"
58-
"value" = "true"
46+
key = "tostop"
47+
value = "true"
5948
}
6049
}
6150

0 commit comments

Comments
 (0)