From 481df7f1043316c360e1aae9293e0c08a6c3d6ea Mon Sep 17 00:00:00 2001 From: Patrick Force Date: Mon, 20 Oct 2025 19:29:54 -0600 Subject: [PATCH 1/2] add in overwrite variable and pass through to the call to the ssm parameter resource that is not ignoring value changes --- main.tf | 2 ++ variables.tf | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/main.tf b/main.tf index 78420c4..7c58076 100644 --- a/main.tf +++ b/main.tf @@ -24,6 +24,8 @@ resource "aws_ssm_parameter" "this" { allowed_pattern = var.allowed_pattern data_type = var.data_type + overwrite = var.overwrite + tags = var.tags } diff --git a/variables.tf b/variables.tf index bf35fb0..d790d97 100644 --- a/variables.tf +++ b/variables.tf @@ -79,3 +79,9 @@ variable "tags" { type = map(string) default = {} } + +variable "overwrite" { + description = "Overwrite an existing parameter. If not specified, defaults to false during create operations to avoid overwriting existing resources and then true for all subsequent operations once the resource is managed by Terraform. Only relevant if ignore_value_changes is false." + type = bool + default = false +} From 3b69e4c1bab9c51f9f03f53c26aad0261cae5453 Mon Sep 17 00:00:00 2001 From: Anton Babenko Date: Tue, 21 Oct 2025 15:02:05 +0200 Subject: [PATCH 2/2] Fixed docs --- README.md | 1 + wrappers/main.tf | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index 0e5639e..c430a54 100644 --- a/README.md +++ b/README.md @@ -198,6 +198,7 @@ No modules. | [ignore\_value\_changes](#input\_ignore\_value\_changes) | Whether to create SSM Parameter and ignore changes in value | `bool` | `false` | no | | [key\_id](#input\_key\_id) | KMS key ID or ARN for encrypting a parameter (when type is SecureString) | `string` | `null` | no | | [name](#input\_name) | Name of SSM parameter | `string` | `null` | no | +| [overwrite](#input\_overwrite) | Overwrite an existing parameter. If not specified, defaults to false during create operations to avoid overwriting existing resources and then true for all subsequent operations once the resource is managed by Terraform. Only relevant if ignore\_value\_changes is false. | `bool` | `false` | no | | [secure\_type](#input\_secure\_type) | Whether the type of the value should be considered as secure or not? | `bool` | `false` | no | | [tags](#input\_tags) | A mapping of tags to assign to resources | `map(string)` | `{}` | no | | [tier](#input\_tier) | Parameter tier to assign to the parameter. If not specified, will use the default parameter tier for the region. Valid tiers are Standard, Advanced, and Intelligent-Tiering. Downgrading an Advanced tier parameter to Standard will recreate the resource. | `string` | `null` | no | diff --git a/wrappers/main.tf b/wrappers/main.tf index d1b6067..18355f7 100644 --- a/wrappers/main.tf +++ b/wrappers/main.tf @@ -10,6 +10,7 @@ module "wrapper" { ignore_value_changes = try(each.value.ignore_value_changes, var.defaults.ignore_value_changes, false) key_id = try(each.value.key_id, var.defaults.key_id, null) name = try(each.value.name, var.defaults.name, null) + overwrite = try(each.value.overwrite, var.defaults.overwrite, false) secure_type = try(each.value.secure_type, var.defaults.secure_type, false) tags = try(each.value.tags, var.defaults.tags, {}) tier = try(each.value.tier, var.defaults.tier, null)