-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
1 changed file
with
61 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
terraform { | ||
required_version = "~> 1.0" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "~> 4.0" | ||
} | ||
} | ||
} | ||
|
||
provider "aws" { | ||
region = "eu-west-1" | ||
} | ||
|
||
# Ec2 instances matching this filter will be affected by the schedule | ||
data "aws_instances" "dev" { | ||
filter { | ||
name = "tag:Name" | ||
values = [ | ||
"dev_1", | ||
"dev_db", | ||
"devel_platform", | ||
] | ||
} | ||
} | ||
|
||
module "switcher" { | ||
source = "../." | ||
# source = "wakumaku/ec2-instanceswitcher/aws" | ||
# version = "0.0.6" | ||
|
||
# Prefix to be used in created resources | ||
prefix = "devel_stack" | ||
|
||
# Which instances will be affected | ||
instance_list = data.aws_instances.dev.ids | ||
|
||
# Schedules in cron expression format | ||
# https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html#CronExpressions | ||
schedules = { | ||
start = [ | ||
"0 8 ? * MON-FRI *", | ||
"0 10 ? * SAT,SUN *", | ||
] | ||
stop = [ | ||
"0 18 ? * MON-FRI *", | ||
"0 16 ? * SAT *", | ||
"0 14 ? * SUN *", | ||
] | ||
terminate = [] | ||
reboot = [] | ||
switch = [] | ||
} | ||
|
||
tags = { | ||
Name = "DevMaintenance" | ||
project = "operations" | ||
component = "devmaintainer" | ||
} | ||
} |