diff --git a/commands/out.go b/commands/out.go index 65e81ac..0ac85b3 100644 --- a/commands/out.go +++ b/commands/out.go @@ -63,7 +63,7 @@ func (o *Out) Execute() error { src := o.args[1] - if (req.Source.AwsAccessKeyId != "" && req.Source.AwsSecretAccessKey != "" && req.Source.AwsRegion != "") || (req.Source.AwsRegion != "" && req.Source.AwsUseInstanceRole == true) { + if (req.Source.AwsAccessKeyId != "" && req.Source.AwsSecretAccessKey != "" && req.Source.AwsRegion != "") || (req.Source.AwsRegion != "" && req.Source.AwsUseInstanceRole) { if !req.Source.AuthenticateToECR() { return fmt.Errorf("cannot authenticate with ECR") } diff --git a/types.go b/types.go index ed4f268..f28b807 100644 --- a/types.go +++ b/types.go @@ -62,7 +62,7 @@ type AwsCredentials struct { AWSECRRegistryId string `json:"aws_ecr_registry_id,omitempty"` AwsRoleArn string `json:"aws_role_arn,omitempty"` AwsRoleArns []string `json:"aws_role_arns,omitempty"` - AwsUseInstanceRole bool `json:"aws_use_instance_role,omitempty"` + AwsUseInstanceRole bool `json:"aws_use_instance_role"` } type BasicCredentials struct { @@ -306,7 +306,7 @@ func (source *Source) AuthenticateToECR() bool { })) // Override mySession if aws_use_instance_role is set - if source.AwsUseInstanceRole == true { + if source.AwsUseInstanceRole { mySession = session.Must(session.NewSession(&aws.Config{ Region: aws.String(source.AwsRegion)})) } diff --git a/types_test.go b/types_test.go index bb0c1c3..2fef1fa 100644 --- a/types_test.go +++ b/types_test.go @@ -45,7 +45,7 @@ var _ = Describe("Source", func() { json, err := json.Marshal(source) Expect(err).ToNot(HaveOccurred()) - Expect(json).To(MatchJSON(`{"repository":"foo","insecure":false,"tag":"0"}`)) + Expect(json).To(MatchJSON(`{"repository":"foo","insecure":false,"tag":"0", "aws_use_instance_role":false}`)) }) Describe("ecr", func() {