https://prefect.io logo
Title
a

Anthony Desmier

10/07/2022, 3:40 PM
Hi everyone! We're in the process of migrating to 2.0 and experimenting with the ECSTask block. We define our task definitions within terraform and deploying our agent ECS task works fine and it can successfully retrieve a task definition for a flow - the type, cluster and task_definition_arn are defined on the ECSTask block for the flow we're testing. However, when the agent tries to register the task definition we receive AWS errors of the form:
Unknown parameter in input: "registeredBy", must be one of: family, taskRoleArn, executionRoleArn, networkMode, containerDefinitions, volumes, placementConstraints, requiresCompatibilities, cpu, memory, tags, pidMode, ipcMode, proxyConfiguration, inferenceAccelerators, ephemeralStorage, runtimePlatform
This appears to be an api incompatibility on the aws-sdk side where the json returned from the describe call contains fields that are incompatible with the register command. There is a workaround described in the issue, but I'm wondering if anyone has come across this before when using prefect-aws or whether we need to do some additional configuration on our end to account for this? Thanks in advance!
1
a

Anna Geller

10/07/2022, 3:54 PM
you need to remove this field from your task definition - once you do it, it should work
a

Anthony Desmier

10/10/2022, 12:54 PM
Thanks for your reply Anna! I doubled check my task definition in our terraform code and neither the registerBy field, or registeredAt and requiresAttributes fields which were also throwing the same error, are defined. Our task definition is pretty much the same as the one in your example. I've tried adding the fields as 'null' in the definition, but terraform errors when I apply the changes that the arguments are not supported. I was looking through the code for prefect-aws and found this line that checks if a task definition needs to be registered. In my case, the task definition has already been registered (I can see it in the AWS console), but the if block is still executed or perhaps
_prepare_task_definition()
returns a different task than the one I've already registered which I'm guessing it doesn't need to?
a

Anna Geller

10/10/2022, 12:57 PM
It should work with a predefined task definition, we have tests for that. If it doesn't work, feel free to open a GitHub issue on the prefect-aws repo with a minimal reproducible example of your task definition and how you register and use it with ECSTask block (ideally without terraform to make it easier to reproduce) - thanks a lot in advance
a

Anthony Desmier

10/10/2022, 1:00 PM
Ok thanks Anna. I'll do a bit more digging on my end and open up an issue next.
👍 1