diff --git a/go.mod b/go.mod index 97e27d6..eeaadb1 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( ) require ( - github.com/aws/aws-sdk-go-v2 v1.36.3 + github.com/aws/aws-sdk-go-v2 v1.41.5 github.com/aws/aws-sdk-go-v2/credentials v1.17.46 github.com/aws/aws-sdk-go-v2/service/amplify v1.28.8 github.com/aws/aws-sdk-go-v2/service/backup v1.40.10 @@ -27,6 +27,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/ec2 v1.202.4 github.com/aws/aws-sdk-go-v2/service/efs v1.34.11 github.com/aws/aws-sdk-go-v2/service/eks v1.64.0 + github.com/aws/aws-sdk-go-v2/service/elasticache v1.52.0 github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.43.12 github.com/aws/aws-sdk-go-v2/service/iam v1.38.1 github.com/aws/aws-sdk-go-v2/service/kafka v1.38.16 @@ -54,8 +55,8 @@ require ( github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.7 // indirect github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.20 // indirect github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.41 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.34 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.34 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.32 // indirect github.com/aws/aws-sdk-go-v2/service/acm v1.30.6 // indirect @@ -78,7 +79,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/ssm v1.56.0 // indirect github.com/aws/aws-sdk-go-v2/service/sso v1.24.6 // indirect github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.5 // indirect - github.com/aws/smithy-go v1.22.3 // indirect + github.com/aws/smithy-go v1.24.2 // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect diff --git a/go.sum b/go.sum index 50e19a7..991e037 100644 --- a/go.sum +++ b/go.sum @@ -16,8 +16,8 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPd github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/aws/aws-sdk-go v1.55.7 h1:UJrkFq7es5CShfBwlWAC8DA077vp8PyVbQd3lqLiztE= github.com/aws/aws-sdk-go v1.55.7/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= -github.com/aws/aws-sdk-go-v2 v1.36.3 h1:mJoei2CxPutQVxaATCzDUjcZEjVRdpsiiXi2o38yqWM= -github.com/aws/aws-sdk-go-v2 v1.36.3/go.mod h1:LLXuLpgzEbD766Z5ECcRmi8AzSwfZItDtmABVkRLGzg= +github.com/aws/aws-sdk-go-v2 v1.41.5 h1:dj5kopbwUsVUVFgO4Fi5BIT3t4WyqIDjGKCangnV/yY= +github.com/aws/aws-sdk-go-v2 v1.41.5/go.mod h1:mwsPRE8ceUUpiTgF7QmQIJ7lgsKUPQOUl3o72QBrE1o= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.7 h1:lL7IfaFzngfx0ZwUGOZdsFFnQ5uLvR0hWqqhyE7Q9M8= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.7/go.mod h1:QraP0UcVlQJsmHfioCrveWOC1nbiWUl3ej08h4mXWoc= github.com/aws/aws-sdk-go-v2/config v1.28.5 h1:Za41twdCXbuyyWv9LndXxZZv3QhTG1DinqlFsSuvtI0= @@ -28,10 +28,10 @@ github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.20 h1:sDSXIrlsFSFJtWKLQS4PUW github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.20/go.mod h1:WZ/c+w0ofps+/OUqMwWgnfrgzZH1DZO1RIkktICsqnY= github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.41 h1:hqcxMc2g/MwwnRMod9n6Bd+t+9Nf7d5qRg7RaXKPd6o= github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.41/go.mod h1:d1eH0VrttvPmrCraU68LOyNdu26zFxQFjrVSb5vdhog= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.34 h1:ZK5jHhnrioRkUNOc+hOgQKlUL5JeC3S6JgLxtQ+Rm0Q= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.34/go.mod h1:p4VfIceZokChbA9FzMbRGz5OV+lekcVtHlPKEO0gSZY= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.34 h1:SZwFm17ZUNNg5Np0ioo/gq8Mn6u9w19Mri8DnJ15Jf0= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.34/go.mod h1:dFZsC0BLo346mvKQLWmoJxT+Sjp+qcVR1tRVHQGOH9Q= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21 h1:Rgg6wvjjtX8bNHcvi9OnXWwcE0a2vGpbwmtICOsvcf4= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21/go.mod h1:A/kJFst/nm//cyqonihbdpQZwiUhhzpqTsdbhDdRF9c= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21 h1:PEgGVtPoB6NTpPrBgqSE5hE/o47Ij9qk/SEZFbUOe9A= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21/go.mod h1:p+hz+PRAYlY3zcpJhPwXlLC4C+kqn70WIHwnzAfs6ps= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc= github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.32 h1:OIHj/nAhVzIXGzbAE+4XmZ8FPvro3THr6NlqErJc3wY= @@ -62,6 +62,8 @@ github.com/aws/aws-sdk-go-v2/service/efs v1.34.11 h1:PgeGNM3l3fg7UlFpIFEogySDrYs github.com/aws/aws-sdk-go-v2/service/efs v1.34.11/go.mod h1:pH1iibM/aigOyMTkB9RFdGDXbofNRaLzh1qoh2fIp6E= github.com/aws/aws-sdk-go-v2/service/eks v1.64.0 h1:EYeOThTRysemFtC6J6h6b7dNg3jN03QuO5cg92ojIQE= github.com/aws/aws-sdk-go-v2/service/eks v1.64.0/go.mod h1:v1xXy6ea0PHtWkjFUvAUh6B/5wv7UF909Nru0dOIJDk= +github.com/aws/aws-sdk-go-v2/service/elasticache v1.52.0 h1:inluxH5ArTlQNGrFxP7RN5o5DEfP8bRbkPC/408Esgs= +github.com/aws/aws-sdk-go-v2/service/elasticache v1.52.0/go.mod h1:DxywiXnEB21757xcql9xCqgt8vyTxSB7tVEIOdfKIY8= github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.43.12 h1:PLoBTtHl376mmxe5NSMUx1UD8yiM+BgIi9yJ1SgibHk= github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.43.12/go.mod h1:h7JSZfD6QGeaAWpTk0+e1hQw2Venf5gh7UlUTEAiZL8= github.com/aws/aws-sdk-go-v2/service/iam v1.38.1 h1:hfkzDZHBp9jAT4zcd5mtqckpU4E3Ax0LQaEWWk1VgN8= @@ -106,8 +108,8 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.33.1 h1:6SZUVRQNvExYlMLbHdlKB48x0fLb github.com/aws/aws-sdk-go-v2/service/sts v1.33.1/go.mod h1:GqWyYCwLXnlUB1lOAXQyNSPqPLQJvmo8J0DWBzp9mtg= github.com/aws/aws-sdk-go-v2/service/wafv2 v1.58.0 h1:vJfgEyoSRn0E7Z3SwnXgA04xbp6/MiTFOE5Ypw/lbXw= github.com/aws/aws-sdk-go-v2/service/wafv2 v1.58.0/go.mod h1:Zai6/lANvFn0uX9OKqPGy4C9a7TIcbnlzzM1EHTd3kE= -github.com/aws/smithy-go v1.22.3 h1:Z//5NuZCSW6R4PhQ93hShNbyBbn8BWCmCVCt+Q8Io5k= -github.com/aws/smithy-go v1.22.3/go.mod h1:t1ufH5HMublsJYulve2RKmHDC15xu1f26kHCp/HgceI= +github.com/aws/smithy-go v1.24.2 h1:FzA3bu/nt/vDvmnkg+R8Xl46gmzEDam6mZ1hzmwXFng= +github.com/aws/smithy-go v1.24.2/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= diff --git a/pkg/aws/amplify.go b/pkg/aws/amplify.go index aaa73cf..f2a5435 100644 --- a/pkg/aws/amplify.go +++ b/pkg/aws/amplify.go @@ -47,4 +47,3 @@ func StartDeploymentJob(t *testing.T, ctx context.Context, client *amplify.Clien require.NoError(t, err) return jobStart.JobSummary.JobId } - diff --git a/pkg/aws/backup.go b/pkg/aws/backup.go index c6460f8..8bd5fe6 100644 --- a/pkg/aws/backup.go +++ b/pkg/aws/backup.go @@ -4,8 +4,8 @@ import ( "testing" "github.com/aws/aws-sdk-go-v2/service/backup" - "github.com/stretchr/testify/require" "github.com/gruntwork-io/terratest/modules/aws" + "github.com/stretchr/testify/require" ) func NewBackupClient(t *testing.T, region string) *backup.Client { diff --git a/pkg/aws/documentdb.go b/pkg/aws/documentdb.go index de84d29..1d8994a 100644 --- a/pkg/aws/documentdb.go +++ b/pkg/aws/documentdb.go @@ -1,10 +1,11 @@ package aws import ( + "testing" + "github.com/aws/aws-sdk-go-v2/service/docdb" "github.com/gruntwork-io/terratest/modules/aws" "github.com/stretchr/testify/require" - "testing" ) func NewDocDBClient(t *testing.T, region string) *docdb.Client { diff --git a/pkg/aws/ec2.go b/pkg/aws/ec2.go index 4f6b82f..128ac4a 100644 --- a/pkg/aws/ec2.go +++ b/pkg/aws/ec2.go @@ -7,7 +7,7 @@ import ( awstypes "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/ec2" "github.com/aws/aws-sdk-go-v2/service/ec2/types" - "github.com/gruntwork-io/terratest/modules/aws" + "github.com/gruntwork-io/terratest/modules/aws" "github.com/stretchr/testify/assert" ) diff --git a/pkg/aws/efs.go b/pkg/aws/efs.go index 0c1f640..381a302 100644 --- a/pkg/aws/efs.go +++ b/pkg/aws/efs.go @@ -8,7 +8,6 @@ import ( "github.com/stretchr/testify/require" ) - func NewEFSClient(t *testing.T, region string) *efs.Client { client, err := NewEFSClientE(t, region) require.NoError(t, err) diff --git a/pkg/aws/eks.go b/pkg/aws/eks.go index bedf1fa..2ce555e 100644 --- a/pkg/aws/eks.go +++ b/pkg/aws/eks.go @@ -7,8 +7,8 @@ import ( "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/eks" "github.com/aws/aws-sdk-go-v2/service/eks/types" + terratestAWS "github.com/gruntwork-io/terratest/modules/aws" "github.com/gruntwork-io/terratest/modules/testing" - terratestAWS "github.com/gruntwork-io/terratest/modules/aws" "github.com/stretchr/testify/require" "k8s.io/client-go/kubernetes" @@ -53,7 +53,6 @@ func CreateEksClusterE(t testing.TestingT, ctx context.Context, region string, n }, RoleArn: aws.String(roleArn), }) - if err != nil { return nil, err } @@ -98,7 +97,6 @@ func NewEksClientE(t testing.TestingT, region string) (*eks.Client, error) { return eks.NewFromConfig(*sess), nil } - func NewK8SClientConfig(cluster *types.Cluster) (*rest.Config, error) { gen, err := token.NewGenerator(true, false) if err != nil { @@ -125,7 +123,6 @@ func NewK8SClientConfig(cluster *types.Cluster) (*rest.Config, error) { }, nil } - func NewK8SClientset(cluster *types.Cluster) (*kubernetes.Clientset, error) { config, err := NewK8SClientConfig(cluster) if err != nil { diff --git a/pkg/aws/eks_test.go b/pkg/aws/eks_test.go index 7f1b0b9..a3bd0dd 100644 --- a/pkg/aws/eks_test.go +++ b/pkg/aws/eks_test.go @@ -7,10 +7,10 @@ import ( "time" "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/eks/types" "github.com/aws/aws-sdk-go-v2/service/iam" - "github.com/aws/aws-sdk-go-v2/service/eks/types" - "github.com/gruntwork-io/terratest/modules/retry" terratestAWS "github.com/gruntwork-io/terratest/modules/aws" + "github.com/gruntwork-io/terratest/modules/retry" "github.com/stretchr/testify/assert" ) @@ -67,4 +67,4 @@ func TestEksCluster(t *testing.T) { assert.Nil(t, err) assert.Equal(t, "terratest", *c2.Name) -} \ No newline at end of file +} diff --git a/pkg/aws/elasticache.go b/pkg/aws/elasticache.go new file mode 100644 index 0000000..9ea095b --- /dev/null +++ b/pkg/aws/elasticache.go @@ -0,0 +1,25 @@ +package aws + +import ( + "testing" + + "github.com/aws/aws-sdk-go-v2/service/elasticache" + "github.com/gruntwork-io/terratest/modules/aws" + "github.com/stretchr/testify/require" +) + +func NewElasticacheClient(t *testing.T, region string) *elasticache.Client { + client, err := NewElasticacheClientE(t, region) + require.NoError(t, err) + + return client +} + +func NewElasticacheClientE(t *testing.T, region string) (*elasticache.Client, error) { + sess, err := aws.NewAuthenticatedSession(region) + if err != nil { + return nil, err + } + + return elasticache.NewFromConfig(*sess), nil +} diff --git a/pkg/aws/elb.go b/pkg/aws/elb.go index ed125b8..12fb32c 100644 --- a/pkg/aws/elb.go +++ b/pkg/aws/elb.go @@ -8,7 +8,6 @@ import ( "github.com/stretchr/testify/require" ) - func NewElbV2Client(t *testing.T, region string) *elasticloadbalancingv2.Client { client, err := NewElbV2ClientE(t, region) require.NoError(t, err) diff --git a/pkg/aws/msk.go b/pkg/aws/msk.go index 0378c75..4372ad4 100644 --- a/pkg/aws/msk.go +++ b/pkg/aws/msk.go @@ -4,8 +4,8 @@ import ( "testing" "github.com/aws/aws-sdk-go-v2/service/kafka" - "github.com/stretchr/testify/require" "github.com/gruntwork-io/terratest/modules/aws" + "github.com/stretchr/testify/require" ) func NewMSKClient(t *testing.T, region string) *kafka.Client { diff --git a/pkg/aws/rds.go b/pkg/aws/rds.go index 3550f54..8cb2f2b 100644 --- a/pkg/aws/rds.go +++ b/pkg/aws/rds.go @@ -1,4 +1,3 @@ - package aws import ( @@ -9,7 +8,6 @@ import ( "github.com/stretchr/testify/require" ) - func AssertPotgresqlDatabaseExists(t *testing.T, dbUrl string, dbPort int32, dbUsername string, dbPassword string, databaseName string) bool { output, err := AssertPotgresqlDatabaseExistsE(t, dbUrl, dbPort, dbUsername, dbPassword, databaseName) require.NoError(t, err) @@ -43,9 +41,7 @@ func AssertPotgresqlSchemaExistsE(t *testing.T, dbUrl string, dbPort int32, dbUs return false, connErr } defer db.Close() - var ( - schemaName string - ) + var schemaName string sqlStatement := `SELECT "schema_name" FROM "information_schema"."schemata" where schema_name=$1` row := db.QueryRow(sqlStatement, expectedSchemaName) scanErr := row.Scan(&schemaName) @@ -71,9 +67,7 @@ func AssertPotgresqlGrantsExistsE(t *testing.T, dbUrl string, dbPort int32, dbUs return false, connErr } defer db.Close() - var ( - schemaName string - ) + var schemaName string sqlStatement := `SELECT grantee AS user, CONCAT(table_schema, '.', table_name) AS table, CASE WHEN COUNT(privilege_type) = 7 THEN 'ALL' diff --git a/pkg/aws/route53.go b/pkg/aws/route53.go index c5a7add..478bdd1 100644 --- a/pkg/aws/route53.go +++ b/pkg/aws/route53.go @@ -12,8 +12,6 @@ import ( "github.com/aws/aws-sdk-go-v2/aws" ) - - func GetDNSZoneByNameE(t *testing.T, ctx context.Context, hostName string, awsRegion string) (*types.HostedZone, error) { if hostName == "" { return nil, fmt.Errorf("hostName cannot be empty") @@ -49,8 +47,8 @@ func CleanDNSZoneID(t *testing.T, ctx context.Context, zoneID string, awsRegion } o, err := route53Client.ListResourceRecordSets(ctx, &route53.ListResourceRecordSetsInput{ - HostedZoneId: &zoneID, - MaxItems: aws.Int32(100), + HostedZoneId: &zoneID, + MaxItems: aws.Int32(100), }) if err != nil { return err diff --git a/pkg/aws/ses.go b/pkg/aws/ses.go index 2ad9ca9..6b64d21 100644 --- a/pkg/aws/ses.go +++ b/pkg/aws/ses.go @@ -8,8 +8,6 @@ import ( "github.com/stretchr/testify/require" ) - - // NewElbV2Client creates en ELB client. func NewSESV2Client(t *testing.T, region string) *sesv2.Client { client, err := NewSESV2ClientE(t, region) diff --git a/pkg/aws/waf.go b/pkg/aws/waf.go index 2d5347e..3183c19 100644 --- a/pkg/aws/waf.go +++ b/pkg/aws/waf.go @@ -11,7 +11,6 @@ import ( "github.com/stretchr/testify/require" ) - func NewWAFClient(t *testing.T, region string) *wafv2.Client { client, err := NewWAFClientE(t, region) require.NoError(t, err) @@ -83,4 +82,3 @@ func WafGetIPSetByARN(t *testing.T, client *wafv2.Client, arn string) *wafv2.Get require.NotNil(t, ipSet.IPSet) return ipSet } -