From 2c6ec710d33ad0b2440ee09b5a9e6c2eb790339f Mon Sep 17 00:00:00 2001 From: nikhil Date: Sat, 6 Apr 2024 12:46:01 +0100 Subject: [PATCH 1/5] f-aws_elasticache_serverless_cache:supports-minimum for cache_usage_limits --- .../service/elasticache/serverless_cache.go | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/internal/service/elasticache/serverless_cache.go b/internal/service/elasticache/serverless_cache.go index 25d88eb72d6a..4322d2c55b61 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 { From 08d4c1bd70ba49e7bd35ef11a521673bb9c13492 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sat, 6 Apr 2024 12:49:58 +0100 Subject: [PATCH 2/5] f-aws_elasticache_serverless_cache:supports-minimum for cache_usage_limits --- .changelog/36766.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/36766.txt diff --git a/.changelog/36766.txt b/.changelog/36766.txt new file mode 100644 index 000000000000..c9746b715b1a --- /dev/null +++ b/.changelog/36766.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/serverless_cache: add `minimum` attribute in data_storage and ecpu_per_second +``` \ No newline at end of file From fb4185c65a0cb5328d4e392da05739491ce8cf03 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sat, 6 Apr 2024 12:56:17 +0100 Subject: [PATCH 3/5] f-aws_elasticache_serverless_cache:supports-minimum for cache_usage_limits --- website/docs/r/elasticache_serverless_cache.html.markdown | 2 ++ 1 file changed, 2 insertions(+) diff --git a/website/docs/r/elasticache_serverless_cache.html.markdown b/website/docs/r/elasticache_serverless_cache.html.markdown index 59e59375fdf6..3917a7202032 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 From d5bbe1087c861953fa4145ddfba207d080fc0186 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Fri, 12 Apr 2024 10:43:41 -0500 Subject: [PATCH 4/5] aws_elasticache_serverless_cache: update test checks --- internal/service/elasticache/serverless_cache_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/service/elasticache/serverless_cache_test.go b/internal/service/elasticache/serverless_cache_test.go index 96b2bf9f10b2..6b19c975c7f8 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 } } From e9d828dd92138d74b3aaf3c622d34752e6d42f05 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Fri, 12 Apr 2024 10:45:32 -0500 Subject: [PATCH 5/5] tweak CHANGELOG entry --- .changelog/36766.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changelog/36766.txt b/.changelog/36766.txt index c9746b715b1a..1d197e2f31d6 100644 --- a/.changelog/36766.txt +++ b/.changelog/36766.txt @@ -1,3 +1,3 @@ ```release-note:enhancement -resource/serverless_cache: add `minimum` attribute in data_storage and ecpu_per_second +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