https://pulumi.com logo
#python
Title
# python
p

proud-art-41399

03/12/2024, 7:49 AM
Hi, recently I encountered a weird issue that took me some time to debug. I have two applications with basically the same stack – an ECS task definition and a service, the only difference is that one is using TypeScript and the other one Python for Pulumi program. After an upgrade of a Docker provider to v4 I was wrongly still using
image_name
instead of a
repo_digest
of the Docker image resource in the task definition. The weird thing is that the Python application still triggered task definition even update while the TypeScript application did not (which is correct IMHO). While debugging the Python program using
pulumi preview --diff
, I noticed that the update is triggered by the different order of environment variables while the values are always the same. The Pulumi program looks like this:
Copy code
task_definition = aws.ecs.TaskDefinition(
    "xxx",
    family="xxx",
    ...
    container_definitions=pulumi.Output.all(
        image=image.repo_digest,
        foo=foo.arn,
        bar=bar.arn,
        ...
    ).apply(
        lambda args: json.dumps(
            [
                {
                    "name": "xxx",
                    "image": args["image"],
                    ...
                    "environment": [
                        {"name": "FOO", "value": args["foo"]},
                        {"name": "BAR", "value": args["bar"]},
                        ...
                    ]
                }
            ]
        )
    )
)
This looks like a bug or at least something that isn't obvious. Or am I doing something not expected?