Skip to content

Conversation

oycyc
Copy link
Contributor

@oycyc oycyc commented Oct 14, 2025

Problem

The current default value for serverless_cache_usage_limits is {} (empty object). When this is used, the dynamic block creates an empty cache_usage_limits block with no nested content:

cache_usage_limits { }

AWS/the provider expects either:

  • No cache_usage_limits block at all, OR
  • A cache_usage_limits block with at least one nested block (data_storage or ecpu_per_second)

This results in the following error during apply:

Error: Provider produced inconsistent result after apply .cache_usage_limits: block count changed from 1 to 0. 

Changes

Changed the default value of serverless_cache_usage_limits from {} to null in variables.tf:

variable "serverless_cache_usage_limits" { ... - default = {} + default = null description = "..." }

This allows the existing dynamic block logic to correctly skip creating the block when no limits are specified:

dynamic "cache_usage_limits" { for_each = try([var.serverless_cache_usage_limits], []) # When var is null, try() returns [], so the block is not created

Issue

Closes #268

See #268 for more detail.

The serverless_cache_usage_limits variable had a default value of {} (empty object), which caused the dynamic block to create an empty cache_usage_limits block with no nested content. AWS rejects this configuration during apply, resulting in: Error: Provider produced inconsistent result after apply .cache_usage_limits: block count changed from 1 to 0 Changing the default to null allows the dynamic block logic to correctly skip creating the block when no limits are specified.
@oycyc oycyc requested review from a team as code owners October 14, 2025 15:42
@oycyc oycyc requested review from gberenice and jamengual October 14, 2025 15:42
@oycyc
Copy link
Contributor Author

oycyc commented Oct 14, 2025

/terratest

@mergify mergify bot added the triage Needs triage label Oct 14, 2025
@oycyc
Copy link
Contributor Author

oycyc commented Oct 14, 2025

Curious to see if this requires a MAJOR version? Since it changes the default functionality from {} to null. But again, it is both the equivalent of empty. BUT again the default was non-functional - it literally caused errors, so no one was successfully using it.

I'll hear from the community/other contributors to see what others think.

@oycyc oycyc self-assigned this Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage Needs triage

1 participant