File tree 7 files changed +25
-16
lines changed
7 files changed +25
-16
lines changed Original file line number Diff line number Diff line change @@ -70,12 +70,12 @@ module "start_ec2_instance" {
70
70
| 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 |
71
71
| aws_regions | A list of one or more aws regions where the lambda will be apply, default use the current region | list | null | no |
72
72
| 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 |
75
73
| autoscaling_schedule | Enable scheduling on autoscaling resources | string | ` "false" ` | no |
76
74
| ec2_schedule | Enable scheduling on ec2 instance resources | string | ` "false" ` | no |
77
75
| rds_schedule | Enable scheduling on rds resources | string | ` "false" ` | no |
78
76
| 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 |
79
79
80
80
## Outputs
81
81
Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ module "autoscaling-stop-friday" {
98
98
autoscaling_schedule = " true"
99
99
cloudwatch_alarm_schedule = " true"
100
100
101
- resources_tag = {
101
+ scheduler_tag = {
102
102
key = " tostop"
103
103
value = " true"
104
104
}
@@ -114,7 +114,7 @@ module "autoscaling-start-monday" {
114
114
autoscaling_schedule = " true"
115
115
cloudwatch_alarm_schedule = " true"
116
116
117
- resources_tag = {
117
+ scheduler_tag = {
118
118
key = " tostop"
119
119
value = " true"
120
120
}
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ module "ec2-stop-friday" {
47
47
autoscaling_schedule = " false"
48
48
cloudwatch_alarm_schedule = " true"
49
49
50
- resources_tag = {
50
+ scheduler_tag = {
51
51
key = " tostop"
52
52
value = " true"
53
53
}
@@ -63,7 +63,7 @@ module "ec2-start-monday" {
63
63
autoscaling_schedule = " false"
64
64
cloudwatch_alarm_schedule = " true"
65
65
66
- resources_tag = {
66
+ scheduler_tag = {
67
67
key = " tostop"
68
68
value = " true"
69
69
}
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ module "rds-stop-friday" {
104
104
autoscaling_schedule = " false"
105
105
cloudwatch_alarm_schedule = " true"
106
106
107
- resources_tag = {
107
+ scheduler_tag = {
108
108
key = " tostop"
109
109
value = " true"
110
110
}
@@ -120,7 +120,7 @@ module "rds-start-monday" {
120
120
autoscaling_schedule = " false"
121
121
cloudwatch_alarm_schedule = " true"
122
122
123
- resources_tag = {
123
+ scheduler_tag = {
124
124
key = " tostop"
125
125
value = " true"
126
126
}
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ module "aws-stop-friday" {
15
15
ec2_schedule = " true"
16
16
rds_schedule = " true"
17
17
18
- resources_tag = {
18
+ scheduler_tag = {
19
19
key = " tostop"
20
20
value = " true"
21
21
}
@@ -30,7 +30,7 @@ module "aws-start-monday" {
30
30
ec2_schedule = " true"
31
31
rds_schedule = " true"
32
32
33
- resources_tag = {
33
+ scheduler_tag = {
34
34
key = " tostop"
35
35
value = " true"
36
36
}
Original file line number Diff line number Diff line change @@ -210,6 +210,8 @@ locals {
210
210
}
211
211
]
212
212
}
213
+ # Backward compatibility with the former scheduler variable name.
214
+ scheduler_tag = var. resources_tag == null ? var. scheduler_tag : var. resources_tag
213
215
}
214
216
215
217
# ###############################################
@@ -222,7 +224,7 @@ locals {
222
224
data "archive_file" "this" {
223
225
type = " zip"
224
226
source_dir = " ${ path . module } /package/"
225
- output_path = " ${ path . module } /aws-stop-start-resources-3.1.2 .zip" # The version should match with the latest git tag
227
+ output_path = " ${ path . module } /aws-stop-start-resources-3.1.3 .zip" # The version should match with the latest git tag
226
228
}
227
229
228
230
# Create Lambda function for stop or start aws resources
@@ -239,8 +241,8 @@ resource "aws_lambda_function" "this" {
239
241
variables = {
240
242
AWS_REGIONS = var.aws_regions == null ? data.aws_region.current.name : join (" , " , var. aws_regions )
241
243
SCHEDULE_ACTION = var.schedule_action
242
- TAG_KEY = var.resources_tag [" key" ]
243
- TAG_VALUE = var.resources_tag [" value" ]
244
+ TAG_KEY = local.scheduler_tag [" key" ]
245
+ TAG_VALUE = local.scheduler_tag [" value" ]
244
246
EC2_SCHEDULE = tostring (var. ec2_schedule )
245
247
RDS_SCHEDULE = tostring (var. rds_schedule )
246
248
AUTOSCALING_SCHEDULE = tostring (var. autoscaling_schedule )
Original file line number Diff line number Diff line change @@ -39,12 +39,19 @@ variable "schedule_action" {
39
39
}
40
40
41
41
variable "resources_tag" {
42
- description = " Set the tag use for identify resources to stop or start"
42
+ # This variable has been renamed to "scheduler_tag"
43
+ description = " DEPRECATED, use scheduler_tag variable instead"
44
+ type = map (string )
45
+ default = null
46
+ }
47
+
48
+ variable "scheduler_tag" {
49
+ description = " Set the tag to use for identify aws resources to stop or start"
43
50
type = map (string )
44
51
45
52
default = {
46
- key = " tostop"
47
- value = " true"
53
+ " key" = " tostop"
54
+ " value" = " true"
48
55
}
49
56
}
50
57
You can’t perform that action at this time.
0 commit comments