Skip to content

Commit d979831

Browse files
alexandearbep
authored andcommitted
deploy: Update InvalidateCloudFront to use Go CDK helper
1 parent bcf7421 commit d979831

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

‎deploy/cloudfront.go‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,14 @@ import (
2121
"time"
2222

2323
"github.com/aws/aws-sdk-go/aws"
24-
"github.com/aws/aws-sdk-go/aws/session"
2524
"github.com/aws/aws-sdk-go/service/cloudfront"
25+
gcaws "gocloud.dev/aws"
2626
)
2727

2828
// InvalidateCloudFront invalidates the CloudFront cache for distributionID.
2929
// It uses the default AWS credentials from the environment.
3030
func InvalidateCloudFront(ctx context.Context, distributionID string) error {
31-
// SharedConfigEnable enables loading "shared config (~/.aws/config) and
32-
// shared credentials (~/.aws/credentials) files".
33-
// See https://docs.aws.amazon.com/sdk-for-go/api/aws/session/ for more
34-
// details.
35-
// This is the same codepath used by Go CDK when creating an s3 URL.
36-
// TODO: Update this to a Go CDK helper once available
37-
// (https://github.com/google/go-cloud/issues/2003).
38-
sess, err := session.NewSessionWithOptions(session.Options{SharedConfigState: session.SharedConfigEnable})
31+
sess, err := gcaws.NewDefaultSession()
3932
if err != nil {
4033
return err
4134
}

0 commit comments

Comments
 (0)