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

New Resource aws_elasticache_serverless_cache #34951

Merged
merged 32 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
921b8d2
New Resource aws_elasticache_serverless
Dec 15, 2023
cd2059d
Fix linting Issues
Dec 16, 2023
fe39d6f
Fix linting Issues
Dec 16, 2023
09654ad
Fix linting Issues
Dec 16, 2023
ffc758e
Fix linting Issues
Dec 16, 2023
005c8e9
Fix linting Issues
Dec 18, 2023
974ec9d
Fix linting Issues
Dec 18, 2023
73663ee
Fix linting Issues
Dec 18, 2023
d25ed47
Amended Redis version
Dec 19, 2023
bbce923
rename files
johnsonaj Jan 2, 2024
a246e27
Merge branch 'main' into f-aws_elasticache_serverless
johnsonaj Jan 2, 2024
22ea510
aws_elasticache_serverless_cache: convert from SDKv2 to Framework
johnsonaj Jan 2, 2024
46b5140
rename files
johnsonaj Jan 2, 2024
fa9fad3
fix test
johnsonaj Jan 2, 2024
0cac786
Merge branch 'main' into f-aws_elasticache_serverless
johnsonaj Jan 2, 2024
ddfec8d
aws_elasticache_serverless_cache: update
johnsonaj Jan 2, 2024
923849f
aws_elasticache_serverless_cache: fix test naming
johnsonaj Jan 2, 2024
c925d2e
aws_elasticache_serverless_cache: fix issues with import state
johnsonaj Jan 2, 2024
91da144
chore: rename file
johnsonaj Jan 2, 2024
e0201d6
make gen
johnsonaj Jan 2, 2024
3bb3d39
resolve merge conflicts
johnsonaj Jan 2, 2024
ce411ac
aws_elasticache_serverless_cache: remove unused constants
johnsonaj Jan 2, 2024
5182a34
aws_elasticache_serverless_cache: use correct timeout for delete
johnsonaj Jan 2, 2024
cf39f91
aws_elasticache_serverless_cache: rename doc file
johnsonaj Jan 2, 2024
df1bb58
chore: documentaion
johnsonaj Jan 2, 2024
152bc46
chore: documentaion
johnsonaj Jan 2, 2024
f9f9df1
linter
johnsonaj Jan 3, 2024
cec0b44
tweak CHANGELOG entry
johnsonaj Jan 3, 2024
ca09a90
Merge branch 'main' into f-aws_elasticache_serverless
johnsonaj Jan 3, 2024
657f9dc
aws_elasticache_serverless_cache: add tags test
johnsonaj Jan 3, 2024
cebdf60
chore: documentaion
johnsonaj Jan 3, 2024
77384a9
chore: CHANGELOG
johnsonaj Jan 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/34951.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-resource
aws_elasticache_serverless_cache
```
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/ec2 v1.142.0
github.com/aws/aws-sdk-go-v2/service/ecr v1.24.6
github.com/aws/aws-sdk-go-v2/service/eks v1.37.0
github.com/aws/aws-sdk-go-v2/service/elasticache v1.34.6
github.com/aws/aws-sdk-go-v2/service/emr v1.36.0
github.com/aws/aws-sdk-go-v2/service/emrserverless v1.14.6
github.com/aws/aws-sdk-go-v2/service/evidently v1.16.5
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ github.com/aws/aws-sdk-go-v2/service/ecr v1.24.6 h1:cT7h+GWP2k0hJSsPmppKgxl4C9R6
github.com/aws/aws-sdk-go-v2/service/ecr v1.24.6/go.mod h1:AOHmGMoPtSY9Zm2zBuwUJQBisIvYAZeA1n7b6f4e880=
github.com/aws/aws-sdk-go-v2/service/eks v1.37.0 h1:tCIkZ/ZdJMGZ1MOwdcioYhOUkkD4F58KFvQTgR3ZIlc=
github.com/aws/aws-sdk-go-v2/service/eks v1.37.0/go.mod h1:L1uv3UgQlAkdM9v0gpec7nnfUiQkCnGMjBE7MJArfWQ=
github.com/aws/aws-sdk-go-v2/service/elasticache v1.34.6 h1:Y/5eE9Sc+OBID9pZ4EVFzyQviv1d1RbqB17HRur9ySg=
github.com/aws/aws-sdk-go-v2/service/elasticache v1.34.6/go.mod h1:iPx2i26hgUULkNh1Jk4QzYzzQKd2nXl/rD9Fm5hQ2uk=
github.com/aws/aws-sdk-go-v2/service/emr v1.36.0 h1:FdeZ7AYOvyL09KH250Ncz4LF4SB1Vo9l7KZzn/LIrgQ=
github.com/aws/aws-sdk-go-v2/service/emr v1.36.0/go.mod h1:Drh6y2qLaw/wnDKTIcdqM2m358MIRXsZ2Bj2tjhVLq0=
github.com/aws/aws-sdk-go-v2/service/emrserverless v1.14.6 h1:O2ppygCppB40GS7lDJUX4dGEgEdsKkX62oIAGgre/rY=
Expand Down
5 changes: 5 additions & 0 deletions internal/conns/awsclient_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions internal/framework/types/listof.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ var (
var (
// ListOfStringType is a custom type used for defining a List of strings.
ListOfStringType = listTypeOf[basetypes.StringValue]{basetypes.ListType{ElemType: basetypes.StringType{}}}

// ListOfARNType is a custom type used for defining a List of ARNs.
ListOfARNType = listTypeOf[ARN]{basetypes.ListType{ElemType: ARNType}}
)

type listTypeOf[T attr.Value] struct {
Expand Down
9 changes: 9 additions & 0 deletions internal/service/elasticache/exports_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package elasticache

// Exports for use in tests only.
var (
ResourceServerlessCache = newResourceServerlessCache
)
34 changes: 34 additions & 0 deletions internal/service/elasticache/find.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ import (
"fmt"
"strings"

elasticache_v2 "github.com/aws/aws-sdk-go-v2/service/elasticache"
awstypes "github.com/aws/aws-sdk-go-v2/service/elasticache/types"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/elasticache"
"github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2/tfawserr"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
"github.com/hashicorp/terraform-provider-aws/internal/errs"
"github.com/hashicorp/terraform-provider-aws/internal/tfresource"
)

Expand Down Expand Up @@ -69,6 +72,15 @@ func FindCacheClusterByID(ctx context.Context, conn *elasticache.ElastiCache, id
return FindCacheCluster(ctx, conn, input)
}

// FindServerlessCacheByID retrieves an ElastiCache Cache Cluster by id.
func FindServerlessCacheByID(ctx context.Context, conn *elasticache_v2.Client, id string) (awstypes.ServerlessCache, error) {
input := &elasticache_v2.DescribeServerlessCachesInput{
ServerlessCacheName: aws.String(id),
}

return FindServerlessCacheCluster(ctx, conn, input)
}

// FindCacheClusterWithNodeInfoByID retrieves an ElastiCache Cache Cluster with Node Info by id.
func FindCacheClusterWithNodeInfoByID(ctx context.Context, conn *elasticache.ElastiCache, id string) (*elasticache.CacheCluster, error) {
input := &elasticache.DescribeCacheClustersInput{
Expand Down Expand Up @@ -101,6 +113,28 @@ func FindCacheCluster(ctx context.Context, conn *elasticache.ElastiCache, input
return result.CacheClusters[0], nil
}

// FindServerlessChache retrieves an ElastiCache Cache Cluster using DescribeCacheClustersInput.
func FindServerlessCacheCluster(ctx context.Context, conn *elasticache_v2.Client, input *elasticache_v2.DescribeServerlessCachesInput) (awstypes.ServerlessCache, error) {
result, err := conn.DescribeServerlessCaches(ctx, input)

if errs.IsA[*awstypes.ServerlessCacheNotFoundFault](err) {
return awstypes.ServerlessCache{}, &retry.NotFoundError{
LastError: err,
LastRequest: input,
}
}

if err != nil {
return awstypes.ServerlessCache{}, err
}

if result == nil || len(result.ServerlessCaches) == 0 {
return awstypes.ServerlessCache{}, tfresource.NewEmptyResultError(input)
}

return result.ServerlessCaches[0], nil
}

// FindCacheClustersByID retrieves a list of ElastiCache Cache Clusters by id.
// Order of the clusters is not guaranteed.
func FindCacheClustersByID(ctx context.Context, conn *elasticache.ElastiCache, idList []string) ([]*elasticache.CacheCluster, error) {
Expand Down
1 change: 1 addition & 0 deletions internal/service/elasticache/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: MPL-2.0

//go:generate go run ../../generate/tags/main.go -ListTags -ListTagsInIDElem=ResourceName -ListTagsOutTagsElem=TagList -ServiceTagsSlice -TagOp=AddTagsToResource -TagInIDElem=ResourceName -UntagOp=RemoveTagsFromResource -UpdateTags -CreateTags
//go:generate go run ../../generate/tags/main.go -AWSSDKVersion=2 -TagsFunc=TagsV2 -KeyValueTagsFunc=keyValueTagsV2 -GetTagsInFunc=getTagsInV2 -SetTagsOutFunc=setTagsOutV2 -SkipAWSServiceImp -KVTValues -ServiceTagsSlice -- tagsv2_gen.go
//go:generate go run ../../generate/servicepackage/main.go
// ONLY generate directives and package declaration! Do not add anything else to this file.

Expand Down
Loading
Loading