Skip to content

Commit

Permalink
Revert "GH-134: localstack compatibility for aws providers (#135)"
Browse files Browse the repository at this point in the history
This reverts commit 7b714bc.
  • Loading branch information
kaplanelad authored Oct 13, 2022
1 parent 7b714bc commit c58463e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 36 deletions.
20 changes: 2 additions & 18 deletions pkg/providers/aws_secretsmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ import (
"encoding/json"
"errors"
"fmt"
"os"
"sort"
"strings"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/secretsmanager"
smtypes "github.com/aws/aws-sdk-go-v2/service/secretsmanager/types"
Expand Down Expand Up @@ -42,7 +40,7 @@ func init() {
metaInfo := core.MetaInfo{
Name: "aws_secretsmanager",
Description: "AWS Secrets Manager",
Authentication: "Your standard `AWS_DEFAULT_REGION`, `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` need to be populated in your environment. `AWS_ENDPOINT` is used to allow usage of localstack",
Authentication: "Your standard `AWS_DEFAULT_REGION`, `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` need to be populated in your environment",
ConfigTemplate: `
# configure only from environment
aws_secretsmanager:
Expand All @@ -59,21 +57,7 @@ func init() {
}

func NewAWSSecretsManager(logger logging.Logger) (core.Provider, error) {
customResolver := aws.EndpointResolverFunc(func(service, region string) (aws.Endpoint, error) {
awsEndpointOverride := os.Getenv("AWS_ENDPOINT")
if awsEndpointOverride != "" {
return aws.Endpoint{
PartitionID: "aws",
URL: awsEndpointOverride,
SigningRegion: region,
}, nil
}

// returning EndpointNotFoundError will allow the service to fallback to its default resolution
return aws.Endpoint{}, &aws.EndpointNotFoundError{}
})

cfg, err := config.LoadDefaultConfig(context.Background(), config.WithEndpointResolver(customResolver))
cfg, err := config.LoadDefaultConfig(context.Background())
if err != nil {
return nil, err
}
Expand Down
20 changes: 2 additions & 18 deletions pkg/providers/aws_ssm.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ package providers
import (
"context"
"fmt"
"os"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/ssm"
"github.com/spectralops/teller/pkg/core"
Expand All @@ -27,7 +25,7 @@ func init() {
metaInfo := core.MetaInfo{
Description: "AWS SSM (aka paramstore)",
Name: awsssmName,
Authentication: "Your standard `AWS_DEFAULT_REGION`, `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` need to be populated in your environment. `AWS_ENDPOINT` is used to allow usage of localstack",
Authentication: "Your standard `AWS_DEFAULT_REGION`, `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` need to be populated in your environment",
ConfigTemplate: `
# configure only from environment
aws_ssm:
Expand All @@ -42,21 +40,7 @@ func init() {
}

func NewAWSSSM(logger logging.Logger) (core.Provider, error) {
customResolver := aws.EndpointResolverFunc(func(service, region string) (aws.Endpoint, error) {
awsEndpointOverride := os.Getenv("AWS_ENDPOINT")
if awsEndpointOverride != "" {
return aws.Endpoint{
PartitionID: "aws",
URL: awsEndpointOverride,
SigningRegion: region,
}, nil
}

// returning EndpointNotFoundError will allow the service to fallback to its default resolution
return aws.Endpoint{}, &aws.EndpointNotFoundError{}
})

cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithEndpointResolver(customResolver))
cfg, err := config.LoadDefaultConfig(context.TODO())
if err != nil {
return nil, err
}
Expand Down

0 comments on commit c58463e

Please sign in to comment.