Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add authentication_mode to aws_elasticache_user #28928

Merged
merged 14 commits into from
Mar 15, 2023
7 changes: 7 additions & 0 deletions .changelog/28928.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```release-note:enhancement
resource/aws_elasticache_user: Add `authentication_mode` argument
```

```release-note:bug
resource/aws_elasticache_user: Change `user_id` to [ForceNew](https://developer.hashicorp.com/terraform/plugin/sdkv2/schemas/schema-behaviors#forcenew)
```
24 changes: 0 additions & 24 deletions internal/service/elasticache/find.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,30 +183,6 @@ func FindGlobalReplicationGroupMemberByID(ctx context.Context, conn *elasticache
}
}

func FindUserByID(ctx context.Context, conn *elasticache.ElastiCache, userID string) (*elasticache.User, error) {
input := &elasticache.DescribeUsersInput{
UserId: aws.String(userID),
}
out, err := conn.DescribeUsersWithContext(ctx, input)

if err != nil {
return nil, err
}

switch len(out.Users) {
case 0:
return nil, &resource.NotFoundError{
Message: "empty result",
}
case 1:
return out.Users[0], nil
default:
return nil, &resource.NotFoundError{
Message: "too many results",
}
}
}

func FindUserGroupByID(ctx context.Context, conn *elasticache.ElastiCache, groupID string) (*elasticache.UserGroup, error) {
input := &elasticache.DescribeUserGroupsInput{
UserGroupId: aws.String(groupID),
Expand Down
21 changes: 0 additions & 21 deletions internal/service/elasticache/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ const (
ReplicationGroupStatusDeleting = "deleting"
ReplicationGroupStatusCreateFailed = "create-failed"
ReplicationGroupStatusSnapshotting = "snapshotting"

UserStatusActive = "active"
UserStatusDeleting = "deleting"
UserStatusModifying = "modifying"
)

// StatusReplicationGroup fetches the Replication Group and its Status
Expand Down Expand Up @@ -130,20 +126,3 @@ func statusGlobalReplicationGroupMember(ctx context.Context, conn *elasticache.E
return member, aws.StringValue(member.Status), nil
}
}

// StatusUser fetches the ElastiCache user and its Status
func StatusUser(ctx context.Context, conn *elasticache.ElastiCache, userId string) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
user, err := FindUserByID(ctx, conn, userId)

if tfresource.NotFound(err) {
return nil, "", nil
}

if err != nil {
return nil, "", err
}

return user, aws.StringValue(user.Status), nil
}
}
Loading