Skip to content

Commit

Permalink
Fix AWS_REGION and AWS_DEFAULT_REGION support for eksctl commands (#6787
Browse files Browse the repository at this point in the history
)
  • Loading branch information
TiberiuGC authored Jul 11, 2023
1 parent 55d3e7f commit 274929f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 4 additions & 0 deletions pkg/eks/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ func New(ctx context.Context, spec *api.ProviderConfig, clusterSpec *api.Cluster
return nil, err
}

if spec.Region == "" {
spec.Region = cfg.Region
}

provider.ServicesV2 = &ServicesV2{
config: cfg,
}
Expand Down
5 changes: 2 additions & 3 deletions pkg/eks/apiv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ import (
func newV2Config(pc *api.ProviderConfig, credentialsCacheFilePath string) (aws.Config, error) {
var options []func(options *config.LoadOptions) error

if pc.Region == "" {
pc.Region = api.DefaultRegion
if pc.Region != "" {
options = append(options, config.WithRegion(pc.Region))
}
options = append(options, config.WithRegion(pc.Region))
clientLogMode := aws.ClientLogMode(1)

if logger.Level >= api.AWSDebugLevel {
Expand Down

0 comments on commit 274929f

Please sign in to comment.