Skip to content

Still unable to disable TTL on DynamoDB table #44730

@carschandler

Description

@carschandler

Terraform and AWS Provider Version

Terraform v1.13.4
on linux_amd64
+ provider registry.terraform.io/hashicorp/archive v2.7.1
+ provider registry.terraform.io/hashicorp/aws v6.17.0

Affected Resource(s) or Data Source(s)

  • aws_dynamodb_table

Expected Behavior

ttl.enable = false with an empty ttl.attribute_name should disable TTL for the table

Actual Behavior

Getting an API error due to having an attribute name with 0 length.

Relevant Error/Panic Output

aws_dynamodb_table.sessions: Modifying... [id=ConversationSessions]

│ Error: updating AWS DynamoDB Table (ConversationSessions): updating Time To Live: operation error DynamoDB: UpdateTimeToLive, https response error StatusCode: 400, RequestID: F5TVSR1QR3RGHDSTJS7R0G9R13VV4KQNSO5AEMVJF66Q9ASUAAJG, api error ValidationException: 1 validation error detected: Value '' at 'timeToLiveSpecification.attributeName' failed to satisfy constraint: Member must have length greater than or equal to 1

│   with aws_dynamodb_table.sessions,
│   on main.tf line 248, in resource "aws_dynamodb_table" "sessions":
│  248: resource "aws_dynamodb_table" "sessions" {

Sample Terraform Configuration

Click to expand configuration
resource "aws_dynamodb_table" "sessions" {
  name         = local.session_table_name
  billing_mode = "PAY_PER_REQUEST"
  hash_key     = "sessionId"

  attribute {
    name = "sessionId"
    type = "S"
  }

  ttl {
    enabled = false
  }
}

Steps to Reproduce

  1. Create a table with TTL enabled using a valid attribute name
  2. Wait an hour (sorry; AWS restriction on how frequently you can modify TTL)
  3. Comment out the attribute name from tf spec and switch to enabled = false
  4. terraform apply

Debug Logging

No response

GenAI / LLM Assisted Development

n/a

Important Facts and References

This was supposedly fixed in #39195 but still observing the same behavior.

Would you like to implement a fix?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAddresses a defect in current functionality.needs-triageWaiting for first response or review from a maintainer.service/dynamodbIssues and PRs that pertain to the dynamodb service.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions