Skip to content

Commit 3f23c73

Browse files
committed
Fix AWS target check
Signed-off-by: Frank Jogeleit <[email protected]>
1 parent f0894c0 commit 3f23c73

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

pkg/config/target_factory.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ func (f *TargetFactory) createS3Client(config, parent *S3) target.Client {
598598
}
599599

600600
config.MapAWSParent(parent.AWSConfig)
601-
if config.Endpoint == "" {
601+
if config.Endpoint == "" && !hasAWSIdentity() {
602602
return nil
603603
}
604604

@@ -902,11 +902,15 @@ func NewTargetFactory(secretClient secrets.Client) *TargetFactory {
902902
return &TargetFactory{secretClient: secretClient}
903903
}
904904

905-
func checkAWSConfig(name string, config AWSConfig, parent AWSConfig) error {
905+
func hasAWSIdentity() bool {
906906
arn := os.Getenv("AWS_ROLE_ARN")
907907
file := os.Getenv("AWS_WEB_IDENTITY_TOKEN_FILE")
908908

909-
noEnvConfig := arn == "" && file == ""
909+
return arn != "" && file != ""
910+
}
911+
912+
func checkAWSConfig(name string, config AWSConfig, parent AWSConfig) error {
913+
noEnvConfig := !hasAWSIdentity()
910914

911915
if noEnvConfig && (config.AccessKeyID == "" && parent.AccessKeyID == "") {
912916
return fmt.Errorf("%s.AccessKeyID has not been declared", name)

0 commit comments

Comments
 (0)