Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
Merge pull request #824 from surminus/fix-task-role-bug
Browse files Browse the repository at this point in the history
Fix ECS task role name bug (issue #790)
  • Loading branch information
krantzinator authored Nov 19, 2020
2 parents 94f8599 + f7467e1 commit 9f06d48
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions builtin/aws/ecs/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,11 @@ func (p *Platform) Deploy(
return err
}

taskRole, err = p.SetupTaskRole(ctx, s, log, sess, src)
if err != nil {
return err
if p.config.TaskRoleName != "" {
taskRole, err = p.SetupTaskRole(ctx, s, log, sess, src)
if err != nil {
return err
}
}

logGroup, err = p.SetupLogs(ctx, s, log, sess)
Expand Down Expand Up @@ -741,11 +743,10 @@ func (p *Platform) Launch(

containerDefinitions := append([]*ecs.ContainerDefinition{&def}, additionalContainers...)

taskOut, err := ecsSvc.RegisterTaskDefinition(&ecs.RegisterTaskDefinitionInput{
registerTaskDefinitionInput := ecs.RegisterTaskDefinitionInput{
ContainerDefinitions: containerDefinitions,

ExecutionRoleArn: aws.String(executionRoleArn),
TaskRoleArn: aws.String(taskRoleArn),
Cpu: cpus,
Memory: aws.String(mems),
Family: aws.String(family),
Expand All @@ -759,7 +760,13 @@ func (p *Platform) Launch(
Value: aws.String(app.App),
},
},
})
}

if taskRoleArn != "" {
registerTaskDefinitionInput.SetTaskRoleArn(taskRoleArn)
}

taskOut, err := ecsSvc.RegisterTaskDefinition(&registerTaskDefinitionInput)

if err != nil {
return nil, err
Expand Down

0 comments on commit 9f06d48

Please sign in to comment.