$ terraform --version
Terraform v1.5.4
on linux_amd64
+ provider registry.terraform.io/hashicorp/archive v2.4.0
+ provider registry.terraform.io/hashicorp/aws v5.11.0
terraform {
required_version = ">= 1"
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
backend "s3" {
key = "terraform.tfstate"
}
}
provider "aws" {
region = var.region
default_tags {
tags = var.default_tags
}
}
module "scheduler_start" {
source = "diodonfrost/lambda-scheduler-stop-start/aws"
version = "3.4.0"
name = "scheduler_start"
cloudwatch_schedule_expression = "cron(45 05 ? * MON-FRI *)"
schedule_action = "start"
autoscaling_schedule = "true"
ec2_schedule = "true"
rds_schedule = "true"
resources_tag = {
key = "scheduled-start-stop"
value = "true"
}
}
module "scheduler_stop" {
source = "diodonfrost/lambda-scheduler-stop-start/aws"
version = "3.4.0"
name = "scheduler_stop"
cloudwatch_schedule_expression = "cron(15 19 ? * MON-FRI *)"
schedule_action = "stop"
autoscaling_schedule = "true"
ec2_schedule = "true"
rds_schedule = "true"
resources_tag = {
key = "scheduled-start-stop"
value = "true"
}
Zip file should be created and then used the hash for the lambda function and apply all the plan correctly.
$ terraform plan -out=plan.tfplan
module.scheduler_start.data.archive_file.this: Reading...
module.scheduler_stop.data.archive_file.this: Reading...
module.scheduler_start.data.archive_file.this: Read complete after 0s [id=b2a47cbbaf1f945be6ca7e9f90bde3d0c63c4359]
module.scheduler_stop.data.archive_file.this: Read complete after 0s [id=b2a47cbbaf1f945be6ca7e9f90bde3d0c63c4359]
module.scheduler_start.data.aws_iam_policy_document.resource_groups_tagging_api: Reading...
module.scheduler_stop.data.aws_iam_policy_document.rds_scheduler: Reading...
module.scheduler_start.data.aws_region.current: Reading...
module.scheduler_start.data.aws_iam_policy_document.ecs_scheduler: Reading...
module.scheduler_stop.data.aws_iam_policy_document.autoscaling_group_scheduler: Reading...
module.scheduler_start.data.aws_iam_policy_document.rds_scheduler: Reading...
module.scheduler_stop.data.aws_iam_policy_document.rds_scheduler: Read complete after 0s [id=671776352]
module.scheduler_stop.data.aws_region.current: Reading...
module.scheduler_stop.data.aws_iam_policy_document.instance_scheduler: Reading...
module.scheduler_start.data.aws_iam_policy_document.ecs_scheduler: Read complete after 0s [id=1585618646]
module.scheduler_stop.data.aws_iam_policy_document.autoscaling_group_scheduler: Read complete after 0s [id=1070175367]
module.scheduler_stop.data.aws_iam_policy_document.spot_instance_scheduler: Reading...
module.scheduler_start.data.aws_iam_policy_document.rds_scheduler: Read complete after 0s [id=671776352]
module.scheduler_stop.data.aws_iam_policy_document.instance_scheduler: Read complete after 0s [id=1732007687]
module.scheduler_stop.data.aws_region.current: Read complete after 0s [id=eu-west-1]
module.scheduler_start.data.aws_iam_policy_document.resource_groups_tagging_api: Read complete after 0s [id=2844959228]
module.scheduler_start.data.aws_iam_policy_document.cloudwatch_alarm_scheduler: Reading...
module.scheduler_start.data.aws_region.current: Read complete after 0s [id=eu-west-1]
module.scheduler_stop.data.aws_iam_policy_document.ecs_scheduler: Reading...
module.scheduler_start.data.aws_iam_policy_document.redshift_scheduler: Reading...
module.scheduler_start.data.aws_iam_policy_document.spot_instance_scheduler: Reading...
module.scheduler_stop.data.aws_iam_policy_document.spot_instance_scheduler: Read complete after 0s [id=1252256245]
module.scheduler_start.data.aws_iam_policy_document.cloudwatch_alarm_scheduler: Read complete after 0s [id=656061252]
module.scheduler_stop.data.aws_iam_policy_document.redshift_scheduler: Reading...
module.scheduler_stop.data.aws_iam_policy_document.cloudwatch_alarm_scheduler: Reading...
module.scheduler_stop.data.aws_iam_policy_document.ecs_scheduler: Read complete after 0s [id=1585618646]
module.scheduler_start.data.aws_iam_policy_document.autoscaling_group_scheduler: Reading...
module.scheduler_start.data.aws_iam_policy_document.spot_instance_scheduler: Read complete after 0s [id=1252256245]
module.scheduler_start.data.aws_iam_policy_document.redshift_scheduler: Read complete after 0s [id=2237304675]
module.scheduler_start.data.aws_iam_policy_document.autoscaling_group_scheduler: Read complete after 0s [id=1070175367]
module.scheduler_stop.data.aws_iam_policy_document.cloudwatch_alarm_scheduler: Read complete after 0s [id=656061252]
module.scheduler_stop.data.aws_iam_policy_document.redshift_scheduler: Read complete after 0s [id=2237304675]
module.scheduler_stop.data.aws_iam_policy_document.resource_groups_tagging_api: Reading...
module.scheduler_start.data.aws_iam_policy_document.instance_scheduler: Reading...
module.scheduler_stop.data.aws_iam_policy_document.this: Reading...
module.scheduler_start.data.aws_iam_policy_document.this: Reading...
module.scheduler_stop.data.aws_iam_policy_document.resource_groups_tagging_api: Read complete after 0s [id=2844959228]
module.scheduler_start.data.aws_iam_policy_document.this: Read complete after 0s [id=2690255455]
module.scheduler_start.data.aws_iam_policy_document.instance_scheduler: Read complete after 0s [id=1732007687]
module.scheduler_stop.data.aws_iam_policy_document.this: Read complete after 0s [id=2690255455]
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# module.scheduler_start.aws_cloudwatch_event_rule.this will be created
+ resource "aws_cloudwatch_event_rule" "this" {
+ arn = (known after apply)
+ description = "Trigger lambda scheduler"
+ event_bus_name = "default"
+ id = (known after apply)
+ is_enabled = true
+ name = "trigger-lambda-scheduler-scheduler_start"
+ name_prefix = (known after apply)
+ schedule_expression = "cron(45 05 ? * MON-FRI *)"
+ tags_all = {
+ "builtWith" = "terraform"
+ "environment" = "pro"
+ "project" = "acrecenta-pro"
}
}
# module.scheduler_start.aws_cloudwatch_event_target.this will be created
+ resource "aws_cloudwatch_event_target" "this" {
+ arn = (known after apply)
+ event_bus_name = "default"
+ id = (known after apply)
+ rule = "trigger-lambda-scheduler-scheduler_start"
+ target_id = (known after apply)
}
# module.scheduler_start.aws_cloudwatch_log_group.this will be created
+ resource "aws_cloudwatch_log_group" "this" {
+ arn = (known after apply)
+ id = (known after apply)
+ name = "/aws/lambda/scheduler_start"
+ name_prefix = (known after apply)
+ retention_in_days = 14
+ skip_destroy = false
+ tags_all = {
+ "builtWith" = "terraform"
+ "environment" = "pro"
+ "project" = "acrecenta-pro"
}
}
# module.scheduler_start.aws_iam_role.this[0] will be created
+ resource "aws_iam_role" "this" {
+ arn = (known after apply)
+ assume_role_policy = jsonencode(
{
+ Statement = [
+ {
+ Action = "sts:AssumeRole"
+ Effect = "Allow"
+ Principal = {
+ Service = "lambda.amazonaws.com"
}
},
]
+ Version = "2012-10-17"
}
)
+ create_date = (known after apply)
+ description = "Allows Lambda functions to stop and start ec2 and rds resources"
+ force_detach_policies = false
+ id = (known after apply)
+ managed_policy_arns = (known after apply)
+ max_session_duration = 3600
+ name = "scheduler_start-scheduler-lambda"
+ name_prefix = (known after apply)
+ path = "/"
+ tags_all = {
+ "builtWith" = "terraform"
+ "environment" = "pro"
+ "project" = "acrecenta-pro"
}
+ unique_id = (known after apply)
}
# module.scheduler_start.aws_iam_role_policy.autoscaling_group_scheduler[0] will be created
+ resource "aws_iam_role_policy" "autoscaling_group_scheduler" {
+ id = (known after apply)
+ name = "scheduler_start-autoscaling-custom-policy-scheduler"
+ policy = jsonencode(
{
+ Statement = [
+ {
+ Action = [
+ "ec2:TerminateInstances",
+ "autoscaling:UpdateAutoScalingGroup",
+ "autoscaling:TerminateInstanceInAutoScalingGroup",
+ "autoscaling:SuspendProcesses",
+ "autoscaling:ResumeProcesses",
+ "autoscaling:DescribeTags",
+ "autoscaling:DescribeScalingProcessTypes",
+ "autoscaling:DescribeAutoScalingInstances",
+ "autoscaling:DescribeAutoScalingGroups",
]
+ Effect = "Allow"
+ Resource = "*"
},
]
+ Version = "2012-10-17"
}
)
+ role = (known after apply)
}
# module.scheduler_start.aws_iam_role_policy.cloudwatch_alarm_scheduler[0] will be created
+ resource "aws_iam_role_policy" "cloudwatch_alarm_scheduler" {
+ id = (known after apply)
+ name = "scheduler_start-cloudwatch-custom-policy-scheduler"
+ policy = jsonencode(
{
+ Statement = [
+ {
+ Action = [
+ "cloudwatch:EnableAlarmActions",
+ "cloudwatch:DisableAlarmActions",
]
+ Effect = "Allow"
+ Resource = "*"
},
]
+ Version = "2012-10-17"
}
)
+ role = (known after apply)
}
# module.scheduler_start.aws_iam_role_policy.ecs_scheduler[0] will be created
+ resource "aws_iam_role_policy" "ecs_scheduler" {
+ id = (known after apply)
+ name = "scheduler_start-ecs-custom-policy-scheduler"
+ policy = jsonencode(
{
+ Statement = [
+ {
+ Action = [
+ "ecs:UpdateService",
+ "ecs:DescribeService",
]
+ Effect = "Allow"
+ Resource = "*"
},
]
+ Version = "2012-10-17"
}
)
+ role = (known after apply)
}
# module.scheduler_start.aws_iam_role_policy.instance_scheduler[0] will be created
+ resource "aws_iam_role_policy" "instance_scheduler" {
+ id = (known after apply)
+ name = "scheduler_start-ec2-custom-policy-scheduler"
+ policy = jsonencode(
{
+ Statement = [
+ {
+ Action = [
+ "ec2:StopInstances",
+ "ec2:StartInstances",
+ "autoscaling:DescribeAutoScalingInstances",
]
+ Effect = "Allow"
+ Resource = "*"
},
]
+ Version = "2012-10-17"
}
)
+ role = (known after apply)
}
# module.scheduler_start.aws_iam_role_policy.lambda_logging[0] will be created
+ resource "aws_iam_role_policy" "lambda_logging" {
+ id = (known after apply)
+ name = "scheduler_start-lambda-logging"
+ policy = (known after apply)
+ role = (known after apply)
}
# module.scheduler_start.aws_iam_role_policy.rds_scheduler[0] will be created
+ resource "aws_iam_role_policy" "rds_scheduler" {
+ id = (known after apply)
+ name = "scheduler_start-rds-custom-policy-scheduler"
+ policy = jsonencode(
{
+ Statement = [
+ {
+ Action = [
+ "rds:StopDBInstance",
+ "rds:StopDBCluster",
+ "rds:StartDBInstance",
+ "rds:StartDBCluster",
+ "rds:DescribeDBClusters",
]
+ Effect = "Allow"
+ Resource = "*"
},
]
+ Version = "2012-10-17"
}
)
+ role = (known after apply)
}
# module.scheduler_start.aws_iam_role_policy.redshift_scheduler[0] will be created
+ resource "aws_iam_role_policy" "redshift_scheduler" {
+ id = (known after apply)
+ name = "scheduler_start-redshift-custom-policy-scheduler"
+ policy = jsonencode(
{
+ Statement = [
+ {
+ Action = [
+ "redshift:ResumeCluster",
+ "redshift:PauseCluster",
]
+ Effect = "Allow"
+ Resource = "*"
},
]
+ Version = "2012-10-17"
}
)
+ role = (known after apply)
}
# module.scheduler_start.aws_iam_role_policy.resource_groups_tagging_api[0] will be created
+ resource "aws_iam_role_policy" "resource_groups_tagging_api" {
+ id = (known after apply)
+ name = "scheduler_start-resource-groups-tagging-api-scheduler"
+ policy = jsonencode(
{
+ Statement = [
+ {
+ Action = "tag:GetResources"
+ Effect = "Allow"
+ Resource = "*"
},
]
+ Version = "2012-10-17"
}
)
+ role = (known after apply)
}
# module.scheduler_start.aws_iam_role_policy.spot_instance_scheduler[0] will be created
+ resource "aws_iam_role_policy" "spot_instance_scheduler" {
+ id = (known after apply)
+ name = "scheduler_start-spot-custom-policy-scheduler"
+ policy = jsonencode(
{
+ Statement = [
+ {
+ Action = [
+ "ec2:TerminateSpotInstances",
+ "ec2:DescribeInstances",
]
+ Effect = "Allow"
+ Resource = "*"
},
]
+ Version = "2012-10-17"
}
)
+ role = (known after apply)
}
# module.scheduler_start.aws_lambda_function.this will be created
+ resource "aws_lambda_function" "this" {
+ architectures = (known after apply)
+ arn = (known after apply)
+ filename = ".terraform/modules/scheduler_start/aws-stop-start-resources.zip"
+ function_name = "scheduler_start"
+ handler = "scheduler.main.lambda_handler"
+ id = (known after apply)
+ invoke_arn = (known after apply)
+ last_modified = (known after apply)
+ memory_size = 128
+ package_type = "Zip"
+ publish = false
+ qualified_arn = (known after apply)
+ qualified_invoke_arn = (known after apply)
+ reserved_concurrent_executions = -1
+ role = (known after apply)
+ runtime = "python3.9"
+ signing_job_arn = (known after apply)
+ signing_profile_version_arn = (known after apply)
+ skip_destroy = false
+ source_code_hash = "UK8Fo9D8DgEnYefnPQtpmAcWpLZwjjjS8IYRu5ArjNk="
+ source_code_size = (known after apply)
+ tags_all = {
+ "builtWith" = "terraform"
+ "environment" = "pro"
+ "project" = "acrecenta-pro"
}
+ timeout = 600
+ version = (known after apply)
+ environment {
+ variables = {
+ "AUTOSCALING_SCHEDULE" = "true"
+ "AUTOSCALING_TERMINATE_INSTANCES" = "false"
+ "AWS_REGIONS" = "eu-west-1"
+ "CLOUDWATCH_ALARM_SCHEDULE" = "false"
+ "DOCUMENTDB_SCHEDULE" = "false"
+ "EC2_SCHEDULE" = "true"
+ "ECS_SCHEDULE" = "false"
+ "RDS_SCHEDULE" = "true"
+ "REDSHIFT_SCHEDULE" = "false"
+ "SCHEDULE_ACTION" = "start"
+ "TAG_KEY" = "scheduled-start-stop"
+ "TAG_VALUE" = "true"
}
}
}
# module.scheduler_start.aws_lambda_permission.this will be created
+ resource "aws_lambda_permission" "this" {
+ action = "lambda:InvokeFunction"
+ function_name = "scheduler_start"
+ id = (known after apply)
+ principal = "events.amazonaws.com"
+ source_arn = (known after apply)
+ statement_id = "AllowExecutionFromCloudWatch"
+ statement_id_prefix = (known after apply)
}
# module.scheduler_stop.aws_cloudwatch_event_rule.this will be created
+ resource "aws_cloudwatch_event_rule" "this" {
+ arn = (known after apply)
+ description = "Trigger lambda scheduler"
+ event_bus_name = "default"
+ id = (known after apply)
+ is_enabled = true
+ name = "trigger-lambda-scheduler-scheduler_stop"
+ name_prefix = (known after apply)
+ schedule_expression = "cron(15 19 ? * MON-FRI *)"
+ tags_all = {
+ "builtWith" = "terraform"
+ "environment" = "pro"
+ "project" = "acrecenta-pro"
}
}
# module.scheduler_stop.aws_cloudwatch_event_target.this will be created
+ resource "aws_cloudwatch_event_target" "this" {
+ arn = (known after apply)
+ event_bus_name = "default"
+ id = (known after apply)
+ rule = "trigger-lambda-scheduler-scheduler_stop"
+ target_id = (known after apply)
}
# module.scheduler_stop.aws_cloudwatch_log_group.this will be created
+ resource "aws_cloudwatch_log_group" "this" {
+ arn = (known after apply)
+ id = (known after apply)
+ name = "/aws/lambda/scheduler_stop"
+ name_prefix = (known after apply)
+ retention_in_days = 14
+ skip_destroy = false
+ tags_all = {
+ "builtWith" = "terraform"
+ "environment" = "pro"
+ "project" = "acrecenta-pro"
}
}
# module.scheduler_stop.aws_iam_role.this[0] will be created
+ resource "aws_iam_role" "this" {
+ arn = (known after apply)
+ assume_role_policy = jsonencode(
{
+ Statement = [
+ {
+ Action = "sts:AssumeRole"
+ Effect = "Allow"
+ Principal = {
+ Service = "lambda.amazonaws.com"
}
},
]
+ Version = "2012-10-17"
}
)
+ create_date = (known after apply)
+ description = "Allows Lambda functions to stop and start ec2 and rds resources"
+ force_detach_policies = false
+ id = (known after apply)
+ managed_policy_arns = (known after apply)
+ max_session_duration = 3600
+ name = "scheduler_stop-scheduler-lambda"
+ name_prefix = (known after apply)
+ path = "/"
+ tags_all = {
+ "builtWith" = "terraform"
+ "environment" = "pro"
+ "project" = "acrecenta-pro"
}
+ unique_id = (known after apply)
}
# module.scheduler_stop.aws_iam_role_policy.autoscaling_group_scheduler[0] will be created
+ resource "aws_iam_role_policy" "autoscaling_group_scheduler" {
+ id = (known after apply)
+ name = "scheduler_stop-autoscaling-custom-policy-scheduler"
+ policy = jsonencode(
{
+ Statement = [
+ {
+ Action = [
+ "ec2:TerminateInstances",
+ "autoscaling:UpdateAutoScalingGroup",
+ "autoscaling:TerminateInstanceInAutoScalingGroup",
+ "autoscaling:SuspendProcesses",
+ "autoscaling:ResumeProcesses",
+ "autoscaling:DescribeTags",
+ "autoscaling:DescribeScalingProcessTypes",
+ "autoscaling:DescribeAutoScalingInstances",
+ "autoscaling:DescribeAutoScalingGroups",
]
+ Effect = "Allow"
+ Resource = "*"
},
]
+ Version = "2012-10-17"
}
)
+ role = (known after apply)
}
# module.scheduler_stop.aws_iam_role_policy.cloudwatch_alarm_scheduler[0] will be created
+ resource "aws_iam_role_policy" "cloudwatch_alarm_scheduler" {
+ id = (known after apply)
+ name = "scheduler_stop-cloudwatch-custom-policy-scheduler"
+ policy = jsonencode(
{
+ Statement = [
+ {
+ Action = [
+ "cloudwatch:EnableAlarmActions",
+ "cloudwatch:DisableAlarmActions",
]
+ Effect = "Allow"
+ Resource = "*"
},
]
+ Version = "2012-10-17"
}
)
+ role = (known after apply)
}
# module.scheduler_stop.aws_iam_role_policy.ecs_scheduler[0] will be created
+ resource "aws_iam_role_policy" "ecs_scheduler" {
+ id = (known after apply)
+ name = "scheduler_stop-ecs-custom-policy-scheduler"
+ policy = jsonencode(
{
+ Statement = [
+ {
+ Action = [
+ "ecs:UpdateService",
+ "ecs:DescribeService",
]
+ Effect = "Allow"
+ Resource = "*"
},
]
+ Version = "2012-10-17"
}
)
+ role = (known after apply)
}
# module.scheduler_stop.aws_iam_role_policy.instance_scheduler[0] will be created
+ resource "aws_iam_role_policy" "instance_scheduler" {
+ id = (known after apply)
+ name = "scheduler_stop-ec2-custom-policy-scheduler"
+ policy = jsonencode(
{
+ Statement = [
+ {
+ Action = [
+ "ec2:StopInstances",
+ "ec2:StartInstances",
+ "autoscaling:DescribeAutoScalingInstances",
]
+ Effect = "Allow"
+ Resource = "*"
},
]
+ Version = "2012-10-17"
}
)
+ role = (known after apply)
}
# module.scheduler_stop.aws_iam_role_policy.lambda_logging[0] will be created
+ resource "aws_iam_role_policy" "lambda_logging" {
+ id = (known after apply)
+ name = "scheduler_stop-lambda-logging"
+ policy = (known after apply)
+ role = (known after apply)
}
# module.scheduler_stop.aws_iam_role_policy.rds_scheduler[0] will be created
+ resource "aws_iam_role_policy" "rds_scheduler" {
+ id = (known after apply)
+ name = "scheduler_stop-rds-custom-policy-scheduler"
+ policy = jsonencode(
{
+ Statement = [
+ {
+ Action = [
+ "rds:StopDBInstance",
+ "rds:StopDBCluster",
+ "rds:StartDBInstance",
+ "rds:StartDBCluster",
+ "rds:DescribeDBClusters",
]
+ Effect = "Allow"
+ Resource = "*"
},
]
+ Version = "2012-10-17"
}
)
+ role = (known after apply)
}
# module.scheduler_stop.aws_iam_role_policy.redshift_scheduler[0] will be created
+ resource "aws_iam_role_policy" "redshift_scheduler" {
+ id = (known after apply)
+ name = "scheduler_stop-redshift-custom-policy-scheduler"
+ policy = jsonencode(
{
+ Statement = [
+ {
+ Action = [
+ "redshift:ResumeCluster",
+ "redshift:PauseCluster",
]
+ Effect = "Allow"
+ Resource = "*"
},
]
+ Version = "2012-10-17"
}
)
+ role = (known after apply)
}
# module.scheduler_stop.aws_iam_role_policy.resource_groups_tagging_api[0] will be created
+ resource "aws_iam_role_policy" "resource_groups_tagging_api" {
+ id = (known after apply)
+ name = "scheduler_stop-resource-groups-tagging-api-scheduler"
+ policy = jsonencode(
{
+ Statement = [
+ {
+ Action = "tag:GetResources"
+ Effect = "Allow"
+ Resource = "*"
},
]
+ Version = "2012-10-17"
}
)
+ role = (known after apply)
}
# module.scheduler_stop.aws_iam_role_policy.spot_instance_scheduler[0] will be created
+ resource "aws_iam_role_policy" "spot_instance_scheduler" {
+ id = (known after apply)
+ name = "scheduler_stop-spot-custom-policy-scheduler"
+ policy = jsonencode(
{
+ Statement = [
+ {
+ Action = [
+ "ec2:TerminateSpotInstances",
+ "ec2:DescribeInstances",
]
+ Effect = "Allow"
+ Resource = "*"
},
]
+ Version = "2012-10-17"
}
)
+ role = (known after apply)
}
# module.scheduler_stop.aws_lambda_function.this will be created
+ resource "aws_lambda_function" "this" {
+ architectures = (known after apply)
+ arn = (known after apply)
+ filename = ".terraform/modules/scheduler_stop/aws-stop-start-resources.zip"
+ function_name = "scheduler_stop"
+ handler = "scheduler.main.lambda_handler"
+ id = (known after apply)
+ invoke_arn = (known after apply)
+ last_modified = (known after apply)
+ memory_size = 128
+ package_type = "Zip"
+ publish = false
+ qualified_arn = (known after apply)
+ qualified_invoke_arn = (known after apply)
+ reserved_concurrent_executions = -1
+ role = (known after apply)
+ runtime = "python3.9"
+ signing_job_arn = (known after apply)
+ signing_profile_version_arn = (known after apply)
+ skip_destroy = false
+ source_code_hash = "UK8Fo9D8DgEnYefnPQtpmAcWpLZwjjjS8IYRu5ArjNk="
+ source_code_size = (known after apply)
+ tags_all = {
+ "builtWith" = "terraform"
+ "environment" = "pro"
+ "project" = "acrecenta-pro"
}
+ timeout = 600
+ version = (known after apply)
+ environment {
+ variables = {
+ "AUTOSCALING_SCHEDULE" = "true"
+ "AUTOSCALING_TERMINATE_INSTANCES" = "false"
+ "AWS_REGIONS" = "eu-west-1"
+ "CLOUDWATCH_ALARM_SCHEDULE" = "false"
+ "DOCUMENTDB_SCHEDULE" = "false"
+ "EC2_SCHEDULE" = "true"
+ "ECS_SCHEDULE" = "false"
+ "RDS_SCHEDULE" = "true"
+ "REDSHIFT_SCHEDULE" = "false"
+ "SCHEDULE_ACTION" = "stop"
+ "TAG_KEY" = "scheduled-start-stop"
+ "TAG_VALUE" = "true"
}
}
}
# module.scheduler_stop.aws_lambda_permission.this will be created
+ resource "aws_lambda_permission" "this" {
+ action = "lambda:InvokeFunction"
+ function_name = "scheduler_stop"
+ id = (known after apply)
+ principal = "events.amazonaws.com"
+ source_arn = (known after apply)
+ statement_id = "AllowExecutionFromCloudWatch"
+ statement_id_prefix = (known after apply)
}
Plan: 30 to add, 0 to change, 0 to destroy.
─────────────────────────────────────────────────────────────────────────────
Saved the plan to: plan.tfplan
To perform exactly these actions, run the following command to apply:
terraform apply "plan.tfplan"
$ terraform apply -input=false plan.tfplan
╷
│ Error: Error in function call
│
│ on .terraform/modules/scheduler_start/main.tf line 263, in resource "aws_lambda_function" "this":
│ 263: source_code_hash = filebase64sha256(data.archive_file.this.output_path)
│ ├────────────────
│ │ while calling filebase64sha256(path)
│ │ data.archive_file.this.output_path is ".terraform/modules/scheduler_start/aws-stop-start-resources.zip"
│
│ Call to function "filebase64sha256" failed: open
│ .terraform/modules/scheduler_start/aws-stop-start-resources.zip: no such
│ file or directory.
╵
╷
│ Error: Error in function call
│
│ on .terraform/modules/scheduler_stop/main.tf line 263, in resource "aws_lambda_function" "this":
│ 263: source_code_hash = filebase64sha256(data.archive_file.this.output_path)
│ ├────────────────
│ │ while calling filebase64sha256(path)
│ │ data.archive_file.this.output_path is ".terraform/modules/scheduler_stop/aws-stop-start-resources.zip"
│
│ Call to function "filebase64sha256" failed: open
│ .terraform/modules/scheduler_stop/aws-stop-start-resources.zip: no such
│ file or directory.
╵