Add the abilitiy to set ECS task definition task role and execution role arns (#3869)
This commit is contained in:
parent
d3f20694a9
commit
d8be72e483
3 changed files with 26 additions and 0 deletions
|
|
@ -129,6 +129,8 @@ class TaskDefinition(BaseObject, CloudFormationModel):
|
|||
requires_compatibilities=None,
|
||||
cpu=None,
|
||||
memory=None,
|
||||
task_role_arn=None,
|
||||
execution_role_arn=None,
|
||||
):
|
||||
self.family = family
|
||||
self.revision = revision
|
||||
|
|
@ -169,6 +171,11 @@ class TaskDefinition(BaseObject, CloudFormationModel):
|
|||
else:
|
||||
self.network_mode = network_mode
|
||||
|
||||
if task_role_arn is not None:
|
||||
self.task_role_arn = task_role_arn
|
||||
if execution_role_arn is not None:
|
||||
self.execution_role_arn = execution_role_arn
|
||||
|
||||
self.placement_constraints = (
|
||||
placement_constraints if placement_constraints is not None else []
|
||||
)
|
||||
|
|
@ -737,6 +744,8 @@ class EC2ContainerServiceBackend(BaseBackend):
|
|||
requires_compatibilities=None,
|
||||
cpu=None,
|
||||
memory=None,
|
||||
task_role_arn=None,
|
||||
execution_role_arn=None,
|
||||
):
|
||||
if family in self.task_definitions:
|
||||
last_id = self._get_last_task_definition_revision_id(family)
|
||||
|
|
@ -756,6 +765,8 @@ class EC2ContainerServiceBackend(BaseBackend):
|
|||
requires_compatibilities=requires_compatibilities,
|
||||
cpu=cpu,
|
||||
memory=memory,
|
||||
task_role_arn=task_role_arn,
|
||||
execution_role_arn=execution_role_arn,
|
||||
)
|
||||
self.task_definitions[family][revision] = task_definition
|
||||
|
||||
|
|
|
|||
|
|
@ -67,6 +67,9 @@ class EC2ContainerServiceResponse(BaseResponse):
|
|||
requires_compatibilities = self._get_param("requiresCompatibilities")
|
||||
cpu = self._get_param("cpu")
|
||||
memory = self._get_param("memory")
|
||||
task_role_arn = self._get_param("taskRoleArn")
|
||||
execution_role_arn = self._get_param("executionRoleArn")
|
||||
|
||||
task_definition = self.ecs_backend.register_task_definition(
|
||||
family,
|
||||
container_definitions,
|
||||
|
|
@ -77,6 +80,8 @@ class EC2ContainerServiceResponse(BaseResponse):
|
|||
requires_compatibilities=requires_compatibilities,
|
||||
cpu=cpu,
|
||||
memory=memory,
|
||||
task_role_arn=task_role_arn,
|
||||
execution_role_arn=execution_role_arn,
|
||||
)
|
||||
return json.dumps({"taskDefinition": task_definition.response_object})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue