Skip to content

Commit

Permalink
Add support for resource-specific tags
Browse files Browse the repository at this point in the history
  • Loading branch information
jansiwy committed Sep 21, 2024
1 parent 36b7f65 commit c4e478c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
```

Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
31 changes: 23 additions & 8 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -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 = <<EOS
Map of tags assigned to all AWS resources created by this module.
EOS
}

variable "tags" {
type = map(string)
default = {}
variable "name_prefix" {
type = string

description = "Tags which will be assigned to all resources."
description = <<EOS
Name prefix for the SecretsManager. The full name will be $${var.name_prefix}.rollbar_access_tokens.
EOS
}

variable "rollbar_tokens" {
Expand All @@ -17,5 +21,16 @@ variable "rollbar_tokens" {
access_token = string
}))

description = "List of objects having access tokens names and the token values which shall be loaded into the SecretsManager."
description = <<EOS
List of objects having access tokens names and the token values which shall be loaded into the SecretsManager.
EOS
}

variable "secretsmanager_secret_tags" {
type = map(string)
default = {}

description = <<EOS
Map of tags assigned to the SecretsManager secret.
EOS
}

0 comments on commit c4e478c

Please sign in to comment.