Can anyone suggest a way of making the AWS DynamoDB TTL declaration conditional?
resource "aws_dynamodb_table" "this" {
name = join("-", compact([var.name, var.purpose]))
billing_mode = "PAY_PER_REQUEST"
hash_key = var.hash_key
range_key = var.range_key
ttl {
enabled =
attribute_name =
}
Attempts I’ve made often end up stating:
│ Error: Unsupported block type
│
│ on modules/services/dynamodb/main.tf line 24, in resource “aws_dynamodb_table” “this”:
│ 24: ttl {
│
│ Blocks of type “ttl” are not expected here.
I have several DynamoDB’s tables to create, but only a couple of tables will need the TTL setting declared. Hence why I am looking to make the TTL block conditional.
TIA.