Skip to content

Commit

Permalink
fix(awstf): add random id for secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
tjholm committed Dec 13, 2024
1 parent 182f4ce commit 4ffd07c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion cloud/aws/deploytf/.nitric/modules/secret/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@


resource "random_id" "secret_id" {
byte_length = 4

prefix = "${var.secret_name}-"
keepers = {
# Generate a new id each time we switch to a new AMI id
secret_name = var.secret_name
}
}

# Create a new AWS secret manager secret
resource "aws_secretsmanager_secret" "secret" {
name = var.secret_name
name = random_id.secret_id.hex
tags = {
"x-nitric-${var.stack_id}-name" = var.secret_name
"x-nitric-${var.stack_id}-type" = "secret"
Expand Down

0 comments on commit 4ffd07c

Please sign in to comment.