From c4e478c364da8063c970485bf50b3119212a98a1 Mon Sep 17 00:00:00 2001 From: Jan Sebastian Siwy Date: Sat, 21 Sep 2024 19:58:23 +0200 Subject: [PATCH] Add support for resource-specific tags --- README.md | 5 ----- main.tf | 2 +- variables.tf | 31 +++++++++++++++++++++++-------- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 97ba6c7..ce7dc1d 100644 --- a/README.md +++ b/README.md @@ -14,11 +14,6 @@ module "secretsmanager-for-rollbar-access-tokens" { name_prefix = "example" rollbar_tokens = values(rollbar_project_access_token.example) - - tags = { - app = "example" - env = "production" - } } ``` diff --git a/main.tf b/main.tf index 7a77a95..31cbb6c 100644 --- a/main.tf +++ b/main.tf @@ -2,7 +2,7 @@ resource "aws_secretsmanager_secret" "this" { name = "${var.name_prefix}.rollbar_access_tokens" description = "Secret value is managed via Terraform" - tags = var.tags + tags = merge(var.default_tags, var.secretsmanager_secret_tags) } resource "aws_secretsmanager_secret_version" "this" { diff --git a/variables.tf b/variables.tf index cff21f2..d1bf817 100644 --- a/variables.tf +++ b/variables.tf @@ -1,14 +1,18 @@ -variable "name_prefix" { - type = string +variable "default_tags" { + type = map(string) + default = {} - description = "Name prefix for the SecretsManager. The full name will be $${var.name_prefix}.rollbar_access_tokens." + description = <