diff --git a/.changelog/36766.txt b/.changelog/36766.txt new file mode 100644 index 00000000000..1d197e2f31d --- /dev/null +++ b/.changelog/36766.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/serverless_cache: Add `minimum` attribute in `cache_usage_limits.data_storage` and `cache_usage_limits.ecpu_per_second` +``` \ No newline at end of file diff --git a/internal/service/elasticache/serverless_cache.go b/internal/service/elasticache/serverless_cache.go index 25d88eb72d6..4322d2c55b6 100644 --- a/internal/service/elasticache/serverless_cache.go +++ b/internal/service/elasticache/serverless_cache.go @@ -196,7 +196,13 @@ func (r *serverlessCacheResource) Schema(ctx context.Context, request resource.S NestedObject: schema.NestedBlockObject{ Attributes: map[string]schema.Attribute{ "maximum": schema.Int64Attribute{ - Required: true, + Optional: true, + PlanModifiers: []planmodifier.Int64{ + int64planmodifier.RequiresReplace(), + }, + }, + "minimum": schema.Int64Attribute{ + Optional: true, PlanModifiers: []planmodifier.Int64{ int64planmodifier.RequiresReplace(), }, @@ -216,7 +222,16 @@ func (r *serverlessCacheResource) Schema(ctx context.Context, request resource.S NestedObject: schema.NestedBlockObject{ Attributes: map[string]schema.Attribute{ "maximum": schema.Int64Attribute{ - Required: true, + Optional: true, + Validators: []validator.Int64{ + int64validator.Between(1000, 15000000), + }, + PlanModifiers: []planmodifier.Int64{ + int64planmodifier.RequiresReplace(), + }, + }, + "minimum": schema.Int64Attribute{ + Optional: true, Validators: []validator.Int64{ int64validator.Between(1000, 15000000), }, @@ -482,11 +497,13 @@ type cacheUsageLimitsModel struct { type dataStorageModel struct { Maximum types.Int64 `tfsdk:"maximum"` + Minimum types.Int64 `tfsdk:"minimum"` Unit fwtypes.StringEnum[awstypes.DataStorageUnit] `tfsdk:"unit"` } type ecpuPerSecondModel struct { Maximum types.Int64 `tfsdk:"maximum"` + Minimum types.Int64 `tfsdk:"minimum"` } type endpointModel struct { diff --git a/internal/service/elasticache/serverless_cache_test.go b/internal/service/elasticache/serverless_cache_test.go index 96b2bf9f10b..6b19c975c7f 100644 --- a/internal/service/elasticache/serverless_cache_test.go +++ b/internal/service/elasticache/serverless_cache_test.go @@ -130,6 +130,11 @@ func TestAccElastiCacheServerlessCache_full(t *testing.T) { testAccCheckServerlessCacheExists(ctx, resourceName, &serverlessElasticCache), resource.TestCheckResourceAttrSet(resourceName, "arn"), resource.TestCheckResourceAttrSet(resourceName, "cache_usage_limits.#"), + resource.TestCheckResourceAttr(resourceName, "cache_usage_limits.0.data_storage.0.maximum", "10"), + resource.TestCheckResourceAttr(resourceName, "cache_usage_limits.0.data_storage.0.minimum", "1"), + resource.TestCheckResourceAttr(resourceName, "cache_usage_limits.0.data_storage.0.unit", "GB"), + resource.TestCheckResourceAttr(resourceName, "cache_usage_limits.0.ecpu_per_second.0.maximum", "10000"), + resource.TestCheckResourceAttr(resourceName, "cache_usage_limits.0.ecpu_per_second.0.minimum", "1000"), resource.TestCheckResourceAttrSet(resourceName, "create_time"), resource.TestCheckResourceAttrSet(resourceName, "endpoint.#"), resource.TestCheckResourceAttrSet(resourceName, "engine"), @@ -484,10 +489,12 @@ resource "aws_elasticache_serverless_cache" "test" { cache_usage_limits { data_storage { maximum = 10 + minimum = 1 unit = "GB" } ecpu_per_second { - maximum = 1000 + maximum = 10000 + minimum = 1000 } } diff --git a/website/docs/r/elasticache_serverless_cache.html.markdown b/website/docs/r/elasticache_serverless_cache.html.markdown index 59e59375fdf..3917a720203 100644 --- a/website/docs/r/elasticache_serverless_cache.html.markdown +++ b/website/docs/r/elasticache_serverless_cache.html.markdown @@ -89,11 +89,13 @@ The following arguments are optional: ### DataStorage Configuration +* `minimum` - The lower limit for data storage the cache is set to use. Must be between 1 and 5,000. * `maximum` - The upper limit for data storage the cache is set to use. Must be between 1 and 5,000. * `unit` - The unit that the storage is measured in, in GB. ### ECPUPerSecond Configuration +* `minimum` - The minimum number of ECPUs the cache can consume per second. Must be between 1,000 and 15,000,000. * `maximum` - The maximum number of ECPUs the cache can consume per second. Must be between 1,000 and 15,000,000. ## Attribute Reference