@ -390,10 +390,13 @@ def main():
return True
return True
def _task_definition_matches ( requested_volumes , requested_containers , existing_task_definition) :
def _task_definition_matches ( requested_volumes , requested_containers , requested_task_role_arn, existing_task_definition) :
if td [ ' status ' ] != " ACTIVE " :
if td [ ' status ' ] != " ACTIVE " :
return None
return None
if requested_task_role_arn != td . get ( ' taskRoleArn ' , " " ) :
return None
existing_volumes = td . get ( ' volumes ' , [ ] ) or [ ]
existing_volumes = td . get ( ' volumes ' , [ ] ) or [ ]
if len ( requested_volumes ) != len ( existing_volumes ) :
if len ( requested_volumes ) != len ( existing_volumes ) :
@ -433,9 +436,10 @@ def main():
# No revision explicitly specified. Attempt to find an active, matching revision that has all the properties requested
# No revision explicitly specified. Attempt to find an active, matching revision that has all the properties requested
for td in existing_definitions_in_family :
for td in existing_definitions_in_family :
requested_volumes = module . params . get ( ' volumes ' , [ ] ) or [ ]
requested_volumes = module . params [ ' volumes ' ] or [ ]
requested_containers = module . params . get ( ' containers ' , [ ] ) or [ ]
requested_containers = module . params [ ' containers ' ] or [ ]
existing = _task_definition_matches ( requested_volumes , requested_containers , td )
requested_task_role_arn = module . params [ ' task_role_arn ' ]
existing = _task_definition_matches ( requested_volumes , requested_containers , requested_task_role_arn , td )
if existing :
if existing :
break
break