Reputation: 394
I am trying to create an AWS parameter store via terraform that can also pass default values with the JSON format. Here is a sample of the code.
resource "aws_ssm_parameter" "secret" {
name = "/something/env"
description = "This is a something values"
type = "SecureString"
value = "test"
tags = {
environment = "production"
}
}
Instead of passing out a single value as a "test" from value, how can I pass the json one inside value one.
So that AWS parameter store value will be like
{
"key": "value"
}
Upvotes: 1
Views: 8513
Reputation: 16775
I think you are looking for jsonencode
, which could be used as such:
resource "aws_ssm_parameter" "secret" {
name = "/something/env"
description = "This is a something values"
type = "SecureString"
value = jsonencode({
"key" : "value"
})
tags = {
environment = "production"
}
}
Upvotes: 5