-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Julen Dixneuf
committed
May 5, 2021
1 parent
0dd66e7
commit 3b8e732
Showing
5 changed files
with
221 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
output "scheduler_module_output" { | ||
value = module.aws_start_stop_scheduler | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
output "lambda_iam_role_arn" { | ||
description = "The ARN of the IAM role used by Lambda function" | ||
value = aws_iam_role.lambda.arn | ||
} | ||
|
||
output "lambda_iam_role_name" { | ||
description = "The name of the IAM role used by Lambda function" | ||
value = aws_iam_role.lambda.name | ||
} | ||
|
||
output "lambda_function_arn" { | ||
description = "The ARN of the Lambda function" | ||
value = aws_lambda_function.start_stop_scheduler.arn | ||
} | ||
|
||
output "lambda_function_name" { | ||
description = "The name of the Lambda function" | ||
value = aws_lambda_function.start_stop_scheduler.function_name | ||
} | ||
|
||
output "lambda_function_invoke_arn" { | ||
description = "The ARN to be used for invoking Lambda function from API Gateway" | ||
value = aws_lambda_function.start_stop_scheduler.function_name | ||
} | ||
|
||
output "lambda_function_last_modified" { | ||
description = "The date Lambda function was last modified" | ||
value = aws_lambda_function.start_stop_scheduler.last_modified | ||
} | ||
|
||
output "lambda_function_version" { | ||
description = "Latest published version of your Lambda function" | ||
value = aws_lambda_function.start_stop_scheduler.version | ||
} | ||
|
||
output "lambda_function_log_group_name" { | ||
description = "The name of the lambda's log group" | ||
value = aws_cloudwatch_log_group.start_stop_scheduler.name | ||
} | ||
|
||
output "lambda_function_log_group_arn" { | ||
description = "The ARN of the lambda's log group" | ||
value = aws_cloudwatch_log_group.start_stop_scheduler.arn | ||
} | ||
|
||
output "clouwatch_event_rules" { | ||
description = "Cloudwatch event rules generated by the module to trigger the lambda" | ||
value = concat( | ||
[for r in aws_cloudwatch_event_rule.start : { arn = r.arn, description = r.description }], | ||
[for r in aws_cloudwatch_event_rule.stop : { arn = r.arn, description = r.description }] | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,50 @@ | ||
# variable "my_var" { | ||
# type = string | ||
# description = "A variable with a default value and a condition." | ||
# default = "toto!" | ||
|
||
# validation { | ||
# condition = length(var.my_var) > 4 | ||
# error_message = "This variable should have more than 4 characters." | ||
# } | ||
# } | ||
|
||
# variable "another_var" { | ||
# type = string | ||
# description = "A variable with a condition." | ||
|
||
# validation { | ||
# condition = length(var.another_var) > 6 | ||
# error_message = "This variable should have more than 6 characters." | ||
# } | ||
# } | ||
variable "name" { | ||
description = "A name used to create resources in module" | ||
type = string | ||
validation { | ||
condition = length(var.name) > 1 | ||
error_message = "This variable should have more than 1 characters." | ||
} | ||
} | ||
|
||
variable "schedules" { | ||
description = "The configuration of your crons. Select your resources with tags, and specify several crons for start and stop." | ||
type = list(map(map(string))) | ||
|
||
# TODO validation | ||
} | ||
|
||
variable "tags" { | ||
default = {} | ||
description = "Custom Resource tags" | ||
type = map(string) | ||
} | ||
|
||
variable "lambda_timeout" { | ||
default = 10 | ||
description = "Amount of time your Lambda Function has to run in seconds." | ||
type = number | ||
|
||
validation { | ||
condition = var.lambda_timeout < 900 | ||
error_message = "AWS Lambda Quota limits lambda execution to 15 min." | ||
} | ||
} | ||
|
||
variable "rds_schedule" { | ||
default = true | ||
description = "Run the scheduler on RDS." | ||
type = bool | ||
} | ||
|
||
variable "asg_schedule" { | ||
default = true | ||
description = "Run the scheduler on AutoScalingGroup." | ||
type = bool | ||
} | ||
|
||
variable "aws_regions" { | ||
default = null | ||
description = "List of AWS region where the scheduler will be applied. By default target the current region." | ||
type = list(string) | ||
} |