Skip to content

Commit

Permalink
Merge pull request #40794 from tmccombs/f-elasticache-user-case-insen…
Browse files Browse the repository at this point in the history
…sitive

feat(elasticache): Make engine name case insensitive for user and user_group
  • Loading branch information
gdavison authored Jan 15, 2025
2 parents c8b853e + ea98c17 commit 6fdda48
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 19 deletions.
7 changes: 7 additions & 0 deletions .changelog/40794.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```release-note:enhancement
resource/aws_elasticache_user: engine attribute is now case insensitive
```

```release-note:enhancement
resoruce/aws_elasticache_user_group: engine attribute is now case insensitive
```
2 changes: 1 addition & 1 deletion internal/service/elasticache/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func resourceCluster() *schema.Resource {
Computed: true,
ForceNew: true,
ExactlyOneOf: []string{names.AttrEngine, "replication_group_id"},
ValidateFunc: validation.StringInSlice([]string{engineMemcached, engineRedis}, false),
ValidateFunc: validation.StringInSlice([]string{engineMemcached, engineRedis, engineValkey}, false),
},
names.AttrEngineVersion: {
Type: schema.TypeString,
Expand Down
2 changes: 1 addition & 1 deletion internal/service/elasticache/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func resourceUser() *schema.Resource {
names.AttrEngine: {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{"REDIS", "VALKEY"}, false),
ValidateFunc: validation.StringInSlice([]string{engineRedis, engineValkey}, true),
DiffSuppressFunc: sdkv2.SuppressEquivalentStringCaseInsensitive,
},
"no_password_required": {
Expand Down
2 changes: 1 addition & 1 deletion internal/service/elasticache/user_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func resourceUserGroup() *schema.Resource {
names.AttrEngine: {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{"REDIS", "VALKEY"}, false),
ValidateFunc: validation.StringInSlice([]string{engineRedis, engineValkey}, true),
DiffSuppressFunc: sdkv2.SuppressEquivalentStringCaseInsensitive,
},
names.AttrTags: tftags.TagsSchema(),
Expand Down
18 changes: 9 additions & 9 deletions internal/service/elasticache/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,14 @@ func TestAccElastiCacheUser_updateEngine(t *testing.T) {
CheckDestroy: testAccCheckUserDestroy(ctx),
Steps: []resource.TestStep{
{
Config: testAccUserConfigWithEngine(rName, "VALKEY"),
Config: testAccUserConfigWithEngine(rName, "valkey"),
Check: resource.ComposeTestCheckFunc(
testAccCheckUserExists(ctx, resourceName, &user),
resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "valkey"),
),
},
{
Config: testAccUserConfigWithEngine(rName, "REDIS"),
Config: testAccUserConfigWithEngine(rName, "redis"),
Check: resource.ComposeTestCheckFunc(
testAccCheckUserExists(ctx, resourceName, &user),
resource.TestCheckResourceAttr(resourceName, names.AttrEngine, "redis"),
Expand Down Expand Up @@ -453,7 +453,7 @@ resource "aws_elasticache_user" "test" {
user_id = %[1]q
user_name = "username1"
access_string = "on ~app::* -@all +@read +@hash +@bitmap +@geo -setbit -bitfield -hset -hsetnx -hmset -hincrby -hincrbyfloat -hdel -bitop -geoadd -georadius -georadiusbymember"
engine = "REDIS"
engine = "redis"
passwords = ["password123456789"]
}
`, rName)
Expand All @@ -465,7 +465,7 @@ resource "aws_elasticache_user" "test" {
user_id = %[1]q
user_name = "username1"
access_string = "on ~app::* -@all +@read +@hash +@bitmap +@geo -setbit -bitfield -hset -hsetnx -hmset -hincrby -hincrbyfloat -hdel -bitop -geoadd -georadius -georadiusbymember"
engine = "REDIS"
engine = "redis"
authentication_mode {
type = "password"
Expand All @@ -481,7 +481,7 @@ resource "aws_elasticache_user" "test" {
user_id = %[1]q
user_name = %[1]q
access_string = "on ~app::* -@all +@read +@hash +@bitmap +@geo -setbit -bitfield -hset -hsetnx -hmset -hincrby -hincrbyfloat -hdel -bitop -geoadd -georadius -georadiusbymember"
engine = "REDIS"
engine = "redis"
authentication_mode {
type = "iam"
Expand All @@ -496,7 +496,7 @@ resource "aws_elasticache_user" "test" {
user_id = %[1]q
user_name = "username1"
access_string = "on ~* +@all"
engine = "REDIS"
engine = "redis"
passwords = ["password234567891", "password345678912"]
}
`, rName)
Expand All @@ -520,7 +520,7 @@ resource "aws_elasticache_user" "test" {
user_id = %[1]q
user_name = "username1"
access_string = "on ~app::* -@all +@read +@hash +@bitmap +@geo -setbit -bitfield -hset -hsetnx -hmset -hincrby -hincrbyfloat -hdel -bitop -geoadd -georadius -georadiusbymember"
engine = "REDIS"
engine = "redis"
authentication_mode {
type = "password"
Expand All @@ -536,7 +536,7 @@ resource "aws_elasticache_user" "test" {
user_id = %[1]q
user_name = "username1"
access_string = "on ~app::* -@all +@read +@hash +@bitmap +@geo -setbit -bitfield -hset -hsetnx -hmset -hincrby -hincrbyfloat -hdel -bitop -geoadd -georadius -georadiusbymember"
engine = "REDIS"
engine = "redis"
authentication_mode {
type = "password"
Expand All @@ -552,7 +552,7 @@ resource "aws_elasticache_user" "test" {
user_id = %[1]q
user_name = "username1"
access_string = "on ~app::* -@all +@read +@hash +@bitmap +@geo -setbit -bitfield -hset -hsetnx -hmset -hincrby -hincrbyfloat -hdel -bitop -geoadd -georadius -georadiusbymember"
engine = "REDIS"
engine = "redis"
passwords = ["password123456789"]
tags = {
Expand Down
8 changes: 4 additions & 4 deletions website/docs/r/elasticache_user.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ resource "aws_elasticache_user" "test" {
user_id = "testUserId"
user_name = "testUserName"
access_string = "on ~app::* -@all +@read +@hash +@bitmap +@geo -setbit -bitfield -hset -hsetnx -hmset -hincrby -hincrbyfloat -hdel -bitop -geoadd -georadius -georadiusbymember"
engine = "REDIS"
engine = "redis"
passwords = ["password123456789"]
}
```
Expand All @@ -30,7 +30,7 @@ resource "aws_elasticache_user" "test" {
user_id = "testUserId"
user_name = "testUserName"
access_string = "on ~* +@all"
engine = "REDIS"
engine = "redis"
authentication_mode {
type = "iam"
Expand All @@ -43,7 +43,7 @@ resource "aws_elasticache_user" "test" {
user_id = "testUserId"
user_name = "testUserName"
access_string = "on ~* +@all"
engine = "REDIS"
engine = "redis"
authentication_mode {
type = "password"
Expand All @@ -57,7 +57,7 @@ resource "aws_elasticache_user" "test" {
The following arguments are required:

* `access_string` - (Required) Access permissions string used for this user. See [Specifying Permissions Using an Access String](https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Clusters.RBAC.html#Access-string) for more details.
* `engine` - (Required) The current supported values are `REDIS`, `VALKEY`.
* `engine` - (Required) The current supported values are `redis`, `valkey` (case insensitive).
* `user_id` - (Required) The ID of the user.
* `user_name` - (Required) The username of the user.

Expand Down
6 changes: 3 additions & 3 deletions website/docs/r/elasticache_user_group.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ resource "aws_elasticache_user" "test" {
user_id = "testUserId"
user_name = "default"
access_string = "on ~app::* -@all +@read +@hash +@bitmap +@geo -setbit -bitfield -hset -hsetnx -hmset -hincrby -hincrbyfloat -hdel -bitop -geoadd -georadius -georadiusbymember"
engine = "REDIS"
engine = "redis"
passwords = ["password123456789"]
}
resource "aws_elasticache_user_group" "test" {
engine = "REDIS"
engine = "redis"
user_group_id = "userGroupId"
user_ids = [aws_elasticache_user.test.user_id]
}
Expand All @@ -32,7 +32,7 @@ resource "aws_elasticache_user_group" "test" {

The following arguments are required:

* `engine` - (Required) The current supported value are `REDIS`, `VALKEY`.
* `engine` - (Required) The current supported value are `redis`, `valkey` (case insensitive).
* `user_group_id` - (Required) The ID of the user group.

The following arguments are optional:
Expand Down

0 comments on commit 6fdda48

Please sign in to comment.