2026-08-07 19:19:51 -04:00
|
|
|
# Single-table store for orders, roster entries and weekly settings.
|
|
|
|
|
#
|
2026-09-18 18:38:45 +00:00
|
|
|
# Deletion protection and point-in-time recovery are on in prod: this table
|
|
|
|
|
# holds the only copy of submitted orders, and a rebuild would lose payroll
|
|
|
|
|
# history. Dev is disposable (PITR and deletion protection off).
|
|
|
|
|
# lifecycle.prevent_destroy cannot interpolate, so it stays true in both
|
|
|
|
|
# environments. Destroy a leftover dev table from the AWS console after
|
|
|
|
|
# setting deletion_protection_enabled = false in a follow-up apply.
|
2026-08-07 19:19:51 -04:00
|
|
|
resource "aws_dynamodb_table" "orders" {
|
|
|
|
|
name = local.table_name
|
|
|
|
|
billing_mode = "PAY_PER_REQUEST"
|
|
|
|
|
hash_key = "PK"
|
|
|
|
|
range_key = "SK"
|
|
|
|
|
|
2026-09-18 18:38:45 +00:00
|
|
|
deletion_protection_enabled = local.is_prod
|
2026-08-07 19:19:51 -04:00
|
|
|
|
|
|
|
|
attribute {
|
|
|
|
|
name = "PK"
|
|
|
|
|
type = "S"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
attribute {
|
|
|
|
|
name = "SK"
|
|
|
|
|
type = "S"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ttl {
|
|
|
|
|
attribute_name = "ttl"
|
|
|
|
|
enabled = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
point_in_time_recovery {
|
2026-09-18 18:38:45 +00:00
|
|
|
enabled = local.is_prod
|
2026-08-07 19:19:51 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lifecycle {
|
|
|
|
|
prevent_destroy = true
|
|
|
|
|
}
|
|
|
|
|
}
|