Skip to content

Commit f4a4253

Browse files
authored
feat: allow schedule expression and duration for rotation_rules (#8)
* feat: allow schedule expression and duration for rotation_rules * build: update AWS provider version lower binding
1 parent 0f51e4b commit f4a4253

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,7 @@ resource "aws_secretsmanager_secret_rotation" "default" {
7474

7575
rotation_rules {
7676
automatically_after_days = var.rotation["automatically_after_days"]
77+
duration = var.rotation["duration"]
78+
schedule_expression = var.rotation["schedule_expression"]
7779
}
7880
}

variables.tf

+8-3
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,12 @@ variable "rotation" {
9999
type = object({
100100
enabled = optional(bool, false)
101101
lambda_arn = string
102-
automatically_after_days = number
102+
automatically_after_days = optional(number, null)
103+
duration = optional(string, null)
104+
schedule_expression = optional(string, null)
103105
})
104106
default = {
105-
lambda_arn = ""
106-
automatically_after_days = 0
107+
lambda_arn = ""
107108
}
108109
description = <<-DOC
109110
enabled:
@@ -113,5 +114,9 @@ variable "rotation" {
113114
Specifies the ARN of the Lambda function that can rotate the secret.
114115
automatically_after_days:
115116
Specifies the number of days between automatic scheduled rotations of the secret.
117+
duration:
118+
The length of the rotation window in hours. For example, `3h` for a three hour window.
119+
schedule_expression:
120+
A `cron()` or `rate()` expression that defines the schedule for rotating your secret. Either `automatically_after_days` or `schedule_expression` must be specified.
116121
DOC
117122
}

versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 3.0"
7+
version = ">= 4.16"
88
}
99
}
1010
}

0 commit comments

Comments
 (0)