terraform-aws-ssm-parameter
terraform-aws-ssm-parameter copied to clipboard
StringList cannot be created with a list(string)
Description
I tried these examples
- https://github.com/terraform-aws-modules/terraform-aws-ssm-parameter/blob/master/README.md?plain=1#L99-L101
- https://github.com/terraform-aws-modules/terraform-aws-ssm-parameter/blob/master/README.md?plain=1#L110-L113
But they don't actually create StringList of comma-separated values like this
item1,item2
instead they create a JSON representation of the Terraform list
["item1","item2"]
- [x] β I have searched the open/closed issues and my issue is not listed.
β οΈ Note
Before you submit an issue, please perform the following first:
- Remove the local
.terraformdirectory (! ONLY if state is stored remotely, which hopefully you are following that best practice!):rm -rf .terraform/ - Re-initialize the project root to pull down modules:
terraform init - Re-attempt your terraform plan or apply and check if the issue still persists
Versions
-
Module version [Required]: latest
-
Terraform version: >= 1.7.4
-
Provider version(s): aws 5.68.0
Reproduction Code [Required]
variable "env" {
default = "dev"
}
variable "application" {
default = "test"
}
variable "parameters" {
type = map(object({
value = optional(any)
values = optional(list(any), [])
description = optional(string)
allowed_pattern = optional(string)
data_type = optional(string)
}))
default = {
values = ["item1","item2"]
}
}
locals {
parameters = {
for key, value in var.parameters :
format("/%s/%s/%s", var.env, var.application, upper(key)) => value
}
}
provider "aws" {
region = var.region
}
module "ssm_parameters" {
for_each = merge(local.parameters, var.additional_parameters)
source = "terraform-aws-modules/ssm-parameter/aws"
name = each.key
value = try(tostring(each.value.value), null)
values = try(each.value.values, [])
description = try(each.value.description, null)
allowed_pattern = try(each.value.allowed_pattern, null)
data_type = try(each.value.data_type, null)
}
Steps to reproduce the behavior:
Not using workspace. .terraform directory was cleared.
Expected behavior
item1,item2
Actual behavior
["item1", "item2"]