-
-
Notifications
You must be signed in to change notification settings - Fork 27
feat!: Update Terraform and AWS provider versions to 1.11
and 6.0
respectively
#14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
ecc276f
8c83dc4
2b944d0
9682e45
f5ac140
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,8 +38,8 @@ module "secrets_manager" { | |
# Policy | ||
create_policy = true | ||
block_public_policy = true | ||
policy_statements = { | ||
read = { | ||
policy_statements = [ | ||
{ | ||
sid = "AllowAccountRead" | ||
principals = [{ | ||
type = "AWS" | ||
|
@@ -48,12 +48,11 @@ module "secrets_manager" { | |
actions = ["secretsmanager:GetSecretValue"] | ||
resources = ["*"] | ||
} | ||
} | ||
] | ||
|
||
# Version | ||
create_random_password = true | ||
random_password_length = 64 | ||
random_password_override_special = "!@#$%^&*()_+" | ||
secret_string_wo = ephemeral.random_password.password.result | ||
secret_string_wo_version = 1 | ||
|
||
tags = local.tags | ||
} | ||
|
@@ -69,8 +68,8 @@ module "secrets_manager_rotate" { | |
# Policy | ||
create_policy = true | ||
block_public_policy = true | ||
policy_statements = { | ||
lambda = { | ||
policy_statements = [ | ||
{ | ||
sid = "LambdaReadWrite" | ||
principals = [{ | ||
type = "AWS" | ||
|
@@ -83,8 +82,8 @@ module "secrets_manager_rotate" { | |
"secretsmanager:UpdateSecretVersionStage", | ||
] | ||
resources = ["*"] | ||
} | ||
account = { | ||
}, | ||
{ | ||
sid = "AccountDescribe" | ||
principals = [{ | ||
type = "AWS" | ||
|
@@ -93,15 +92,15 @@ module "secrets_manager_rotate" { | |
actions = ["secretsmanager:DescribeSecret"] | ||
resources = ["*"] | ||
} | ||
} | ||
] | ||
|
||
# Version | ||
ignore_secret_changes = true | ||
secret_string = jsonencode({ | ||
engine = "mariadb", | ||
host = "mydb.cluster-123456789012.us-east-1.rds.amazonaws.com", | ||
username = "Bill", | ||
password = "ThisIsMySuperSecretString12356!" | ||
password = "ThisIsMySuperSecretString12356!", | ||
dbname = "mydb", | ||
port = 3306 | ||
}) | ||
|
@@ -127,6 +126,12 @@ module "secrets_manager_disabled" { | |
# Supporting Resources | ||
################################################################################ | ||
|
||
ephemeral "random_password" "password" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ephemeral outside of the module is fine, but I think we should have ephemeral within the module as well. This way, users can just call the module without any external resources/ephemerals. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like OpenTofu doesn't support ephemeral variables yet, so if we add ephemeral variables into the module, it will break it for OpenTofu users. https://opentofu.org/docs/language/values/variables/#arguments There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. re-added using ephemeral resource 9682e45 |
||
length = 16 | ||
special = true | ||
override_special = "!#$%&*()-_=+[]{}<>:?" | ||
} | ||
|
||
# https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets-required-permissions-function.html | ||
data "aws_iam_policy_document" "this" { | ||
statement { | ||
|
@@ -152,13 +157,13 @@ data "aws_iam_policy_document" "this" { | |
|
||
module "lambda" { | ||
source = "terraform-aws-modules/lambda/aws" | ||
version = "~> 6.0" | ||
version = "~> 8.0" | ||
|
||
function_name = local.name | ||
description = "Example Secrets Manager secret rotation lambda function" | ||
|
||
handler = "function.lambda_handler" | ||
runtime = "python3.10" | ||
runtime = "python3.12" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just for being lazy for another more year, let's put it to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed in 9682e45 |
||
timeout = 60 | ||
memory_size = 512 | ||
source_path = "${path.module}/function.py" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
terraform { | ||
required_version = ">= 1.0" | ||
required_version = ">= 1.11" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = ">= 5.0" | ||
version = ">= 6.0" | ||
} | ||
random = { | ||
source = "hashicorp/random" | ||
version = ">= 3.7" | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was the reason for the change from map to list? I like maps, because keys there are like comments. Also,
*_statements
are maps in other modules, I guess.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
crap, looks like I've mixed up and some are maps some are lists in the other updated modules - I'll move this back to a map
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in f5ac140