Skip to content

Commit

Permalink
feat: allow schedule expression and duration for rotation_rules (#8)
Browse files Browse the repository at this point in the history
* feat: allow schedule expression and duration for rotation_rules

* build: update AWS provider version lower binding
  • Loading branch information
soya-miyoshi authored Sep 13, 2023
1 parent 0f51e4b commit f4a4253
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,7 @@ resource "aws_secretsmanager_secret_rotation" "default" {

rotation_rules {
automatically_after_days = var.rotation["automatically_after_days"]
duration = var.rotation["duration"]
schedule_expression = var.rotation["schedule_expression"]
}
}
11 changes: 8 additions & 3 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,12 @@ variable "rotation" {
type = object({
enabled = optional(bool, false)
lambda_arn = string
automatically_after_days = number
automatically_after_days = optional(number, null)
duration = optional(string, null)
schedule_expression = optional(string, null)
})
default = {
lambda_arn = ""
automatically_after_days = 0
lambda_arn = ""
}
description = <<-DOC
enabled:
Expand All @@ -113,5 +114,9 @@ variable "rotation" {
Specifies the ARN of the Lambda function that can rotate the secret.
automatically_after_days:
Specifies the number of days between automatic scheduled rotations of the secret.
duration:
The length of the rotation window in hours. For example, `3h` for a three hour window.
schedule_expression:
A `cron()` or `rate()` expression that defines the schedule for rotating your secret. Either `automatically_after_days` or `schedule_expression` must be specified.
DOC
}
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.0"
version = ">= 4.16"
}
}
}

0 comments on commit f4a4253

Please sign in to comment.