-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gsi projection and ttl fix #17
Conversation
Update from original repo
…global_secondary_index
Ttl attribute support
PLM-1398 Added support for projection_type and non_key_attributes in …
Ttl attribute support
added TTL to readme
PLM-1398 fix(main.tf): conditionally assign non_key_attributes in Dyn…
Gsi projection and ttl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added one minor comment below.
} | ||
|
||
dynamic "ttl" { | ||
for_each = var.ttl_attribute_name != null ? [1] : [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @evgenygigi , the ttl_attribute_name is string and not a list, and I am confused with the foreach loop that you are having here. Can you please explain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of how dynamic block works https://developer.hashicorp.com/terraform/language/expressions/dynamic-blocks
If var.ttl_attribute_name is not null (meaning it has a value), the for_each expression evaluates to [1], creating a single iteration of the block.
If var.ttl_attribute_name is null, the expression evaluates to an empty list ([]), effectively skipping the block's execution.
the [1] indicates the number of iterations.
This is a continuation of #14
In this PR we implementing the TTL a bit different due to the know bug/feature of AWS.
When you passing
ttl_attribute_name
attribute the TTL will be enabled on your dynamodb table otherwise it will not be crated at all.