Skip to content

Commit

Permalink
🧹 add beck CheckRegion to aws (#2295)
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
  • Loading branch information
arlimus authored Oct 19, 2023
1 parent a8c16a5 commit c0d0560
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions providers/aws/connection/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,19 @@ func (p *AwsConnection) Type() shared.ConnectionType {
return "aws"
}

const MISSING_REGION_MSG = `The AWS region must be set for the deployment. Please use environment variables
or AWS profiles. Further details are available at:
- https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html
- https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html`

// CheckRegion verifies that the config includes a region
func CheckRegion(cfg aws.Config) error {
if len(cfg.Region) == 0 {
return errors.New(MISSING_REGION_MSG)
}
return nil
}

func CheckIam(cfg aws.Config) (*sts.GetCallerIdentityOutput, error) {
ctx := context.Background()
svc := sts.NewFromConfig(cfg)
Expand Down

0 comments on commit c0d0560

Please sign in to comment.