Skip to content

Commit

Permalink
Merge pull request #11 from troydieter/feature/add-permissions_bounda…
Browse files Browse the repository at this point in the history
…ry-option

Added permissions_boundary variable, input and added to README descri…
  • Loading branch information
neillturner authored Nov 4, 2020
2 parents 0d04fdd + 56989bc commit ed46fb0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ module "lambda-scheduler" {
rds_schedule = "true"
default = "{\"mon\": {\"start\": [7], \"stop\": [19]},\"tue\": {\"start\": [7], \"stop\": [19]},\"wed\": {\"start\": [9, 22], \"stop\": [19]},\"thu\": {\"start\": [7], \"stop\": [2,19]}, \"fri\": {\"start\": [7], \"stop\": [19]}, \"sat\": {\"start\": [22]}, \"sun\": {\"stop\": [7]}}"
time = "Europe/London"
permissions_boundary = "arn:aws:iam::AWSACCTID:policy/optional-permissions-boundary-ARN"
}
```
## variables
Expand Down Expand Up @@ -99,6 +100,9 @@ Default for default is:
### time
Timezone to use for scheduler. Can be 'local', 'gmt' or an Olson timezone from https://gist.github.com/ykessler/3349954. default is 'gmt'. local time is for the AWS region.

### permissions_boundary
An optional AWS IAM permissions boundary ARN to be attached to the AWS IAM role. default = "".

### ec2_schedule
Whether to do scheduling for EC2 instances. default = "true".

Expand Down
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ resource "aws_cloudwatch_event_target" "check-scheduler-event-lambda-target" {
# IAM Role for Lambda function
resource "aws_iam_role" "scheduler_lambda" {
name = "${var.resource_name_prefix}scheduler_lambda"
permissions_boundary = var.permissions_boundary != "" ? var.permissions_boundary : ""
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ variable "schedule_tag_force" {
description = "Whether to force the EC2 or RDS instance to have the default schedule tag is no schedule tag exists for the instance."
}

variable "permissions_boundary" {
type = string
default = ""
description = "AWS IAM Permissions Boundary ARN to be attached to the IAM Role"
}

variable "exclude" {
default = ""
description = "common separated list of EC2 and RDS instance ids to exclude from scheduling."
Expand Down

0 comments on commit ed46fb0

Please sign in to comment.