From fe8cb6ae012a1fe7d35bc87820ee757487945adf Mon Sep 17 00:00:00 2001 From: Serhii Zheliabin Date: Tue, 12 Nov 2024 17:58:53 +0200 Subject: [PATCH] feat: Added possibility to enable replica tags propagation --- README.md | 1 + docs/terraform.md | 1 + main.tf | 2 +- variables.tf | 6 ++++++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d59e302..2d378b1 100644 --- a/README.md +++ b/README.md @@ -261,6 +261,7 @@ Available targets: | [local\_secondary\_index\_map](#input\_local\_secondary\_index\_map) | Additional local secondary indexes in the form of a list of mapped values |
list(object({
name = string
non_key_attributes = list(string)
projection_type = string
range_key = string
}))
| `[]` | no | | [name](#input\_name) | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.
This is the only ID element not also included as a `tag`.
The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input. | `string` | `null` | no | | [namespace](#input\_namespace) | ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique | `string` | `null` | no | +| [propagate\_tags\_to\_replica](#input\_propagate\_tags\_to\_replica) | Set to `true` to enable tags propagation on replica. Changes to tags only move in one direction: from global (source) to replica. | `bool` | `false` | no | | [range\_key](#input\_range\_key) | DynamoDB table Range Key | `string` | `""` | no | | [range\_key\_type](#input\_range\_key\_type) | Range Key type, which must be a scalar type: `S`, `N`, or `B` for (S)tring, (N)umber or (B)inary data | `string` | `"S"` | no | | [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.
Characters matching the regex will be removed from the ID elements.
If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no | diff --git a/docs/terraform.md b/docs/terraform.md index 3bbe162..06e8c14 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -67,6 +67,7 @@ | [local\_secondary\_index\_map](#input\_local\_secondary\_index\_map) | Additional local secondary indexes in the form of a list of mapped values |
list(object({
name = string
non_key_attributes = list(string)
projection_type = string
range_key = string
}))
| `[]` | no | | [name](#input\_name) | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.
This is the only ID element not also included as a `tag`.
The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input. | `string` | `null` | no | | [namespace](#input\_namespace) | ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique | `string` | `null` | no | +| [propagate\_tags\_to\_replica](#input\_propagate\_tags\_to\_replica) | Set to `true` to enable tags propagation on replica. Changes to tags only move in one direction: from global (source) to replica. | `bool` | `false` | no | | [range\_key](#input\_range\_key) | DynamoDB table Range Key | `string` | `""` | no | | [range\_key\_type](#input\_range\_key\_type) | Range Key type, which must be a scalar type: `S`, `N`, or `B` for (S)tring, (N)umber or (B)inary data | `string` | `"S"` | no | | [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.
Characters matching the regex will be removed from the ID elements.
If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no | diff --git a/main.tf b/main.tf index 4302dd5..ba3d433 100644 --- a/main.tf +++ b/main.tf @@ -137,7 +137,7 @@ resource "aws_dynamodb_table" "default" { region_name = replica.value # If kms_key_arn is null, the provider uses the default key kms_key_arn = null - propagate_tags = false + propagate_tags = var.propagate_tags_to_replica point_in_time_recovery = false } } diff --git a/variables.tf b/variables.tf index f8a57eb..f0f50fb 100644 --- a/variables.tf +++ b/variables.tf @@ -208,3 +208,9 @@ variable "import_table" { default = null description = "Import Amazon S3 data into a new table." } + +variable "propagate_tags_to_replica" { + type = bool + default = false + description = "Set to `true` to enable tags propagation on replica. Changes to tags only move in one direction: from global (source) to replica." +}