diff --git a/src/main/java/com/thoughtworks/gocd/elasticagent/ecs/aws/RegisterTaskDefinitionRequestBuilder.java b/src/main/java/com/thoughtworks/gocd/elasticagent/ecs/aws/RegisterTaskDefinitionRequestBuilder.java index c806e01..dec4db5 100644 --- a/src/main/java/com/thoughtworks/gocd/elasticagent/ecs/aws/RegisterTaskDefinitionRequestBuilder.java +++ b/src/main/java/com/thoughtworks/gocd/elasticagent/ecs/aws/RegisterTaskDefinitionRequestBuilder.java @@ -20,6 +20,7 @@ import com.thoughtworks.gocd.elasticagent.ecs.domain.ElasticAgentProfileProperties; import com.thoughtworks.gocd.elasticagent.ecs.domain.Platform; import com.thoughtworks.gocd.elasticagent.ecs.domain.PluginSettings; +import org.apache.commons.lang3.StringUtils; import static com.thoughtworks.gocd.elasticagent.ecs.ECSElasticPlugin.LOG; import static java.text.MessageFormat.format; @@ -31,7 +32,7 @@ public RegisterTaskDefinitionRequest build(PluginSettings pluginSettings, Elasti final RegisterTaskDefinitionRequest request = new RegisterTaskDefinitionRequest() .withContainerDefinitions(containerDefinition) - .withTaskRoleArn(elasticAgentProfileProperties.getTaskRoleArn()); + .withTaskRoleArn(StringUtils.defaultIfBlank(elasticAgentProfileProperties.getTaskRoleArn(), null)); if (elasticAgentProfileProperties.platform() == Platform.WINDOWS) { return request;