-
-
Notifications
You must be signed in to change notification settings - Fork 252
Open
Labels
bugπ An issue with the systemπ An issue with the system
Description
Describe the Bug
When serverless_cache_usage_limits is set to an empty object {} (or left unset, defaulting to {}) or null, the module creates an empty cache_usage_limits block in the aws_elasticache_serverless_cache resource. AWS rejects this empty block during apply, causing a "Provider produced inconsistent result after apply" error.
Steps to Reproduce
- Call the module with
serverless_enabled = true - Either:
- Set
serverless_cache_usage_limits = null, OR - Don't set
serverless_cache_usage_limitsat all (uses default, which is currently {})
- Set
- Run
tofu apply
Error Message
Error: Provider produced inconsistent result after apply
When applying changes to module.valkey_redis.aws_elasticache_serverless_cache.default[0],
provider "provider["registry.opentofu.org/hashicorp/aws"]" produced an unexpected new value:
.cache_usage_limits: block count changed from 1 to 0.
Plan Output
The plan shows an empty block being created:
cache_usage_limits {
}Root Cause
The variable default value is {} (empty object), which causes the dynamic block to iterate once but produce no nested content:
dynamic "cache_usage_limits" {
for_each = try([var.serverless_cache_usage_limits], [])
# When var is {}, this becomes [{}], creating an empty blockAWS/the provider expects either:
- No
cache_usage_limitsblock at all, OR - A
cache_usage_limitsblock with at least one nesteddata_storageorecpu_per_secondblock
Even if we explicitly pass in null as serverless_cache_usage_limits, it will go back to the default of {}.
Suggested Fix
Change the current default of {} to null
variable "serverless_cache_usage_limits" {
type = map(any)
default = null
description = "The usage limits for the serverless cache"
}
Expected Behavior
See above.
Steps to Reproduce
See above.
Screenshots
No response
Environment
No response
Additional Context
No response
Metadata
Metadata
Assignees
Labels
bugπ An issue with the systemπ An issue with the system