question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update ECS Service only when TaskDefinition is changed locally in pulumi

See original GitHub issue

I created ECS Service and initial TaskDefintion with pulumi, then I set up automatic deployment (creating new task definition and update service from CI).

In this configuration, how do I achieve both of 1 and 2?:

  1. When pulumi up without change, expects no change.
  2. When pulumi up with change on task definition, expects updating Service.

pulumi/pulumi-awsx#856 suggests ignoreChanges but it does not solve the second case. Maybe we need to have ignoreChanges with function, to ignore only when updating revision is older than the state.

Current behavior of pulumi up after task def & service are updated by automatic deployment:

When I made NO changes to task def and without ignoreChanges

        ~ aws:ecs/service:Service: (update)
            [id=...]
            [urn=...]
            [provider=...]
          ~ taskDefinition: "arn:aws:ecs:ap-northeast-1:XXXXXXXXXXXX:task-definition/our-app-rails:5" => "arn:aws:ecs:ap-northeast-1:711533999350:task-definition/our-app-rails:4"

Pulumi is reverting task definition revision of service, even after pulumi refresh (Use Case of pulumi/pulumi-awsx#856)

When I made SOME changes to task def and with ignoreChanges (in transformations

     └─ awsx:x:ecs:FargateTaskDefinition  rails
 +-     └─ aws:ecs:TaskDefinition         rails           replace     [diff: ~containerDefinitions]

and no Service update.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
lukehobancommented, Nov 19, 2022

This means that the environment variable with an undefined value got ignored (makes sense) but now the provider calculates the difference as if it was meaningful.

This is due to the design of the upstream provider diff implementation - which does some normalization on containerDefinitions, but does not normalize empty values. You must either leave off env vars that are undefined, or specify them with the empty string value. The request to handle this and similar issues more specifically in the upstream provider is https://github.com/hashicorp/terraform-provider-aws/issues/11526.

0reactions
mikhailshilkovcommented, May 30, 2022

When I run the repro from @phillipedwards for the second time, this is the essence of the diff that I get:

                  ~ environment : [
                      + [1]: {
                              + name: "boolean-test"
                            }
                    ]

This means that the environment variable with an undefined value got ignored (makes sense) but now the provider calculates the difference as if it was meaningful.

I believe this is specific to the provider implementation, so I’ll move the issue to pulumi-aws.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Update ECS Service only when TaskDefinition is changed ...
I created ECS Service and initial TaskDefintion with pulumi, then I set up automatic deployment (creating new task definition and update ...
Read more >
aws.ecs.TaskDefinition - Pulumi
Documentation for the aws.ecs.TaskDefinition resource with examples, input properties, output properties, lookup functions, and supporting types.
Read more >
aws.ecs.Service - Pulumi
Documentation for the aws.ecs.Service resource with examples, input properties, output properties, lookup functions, and supporting types.
Read more >
Module ecs | Package @pulumi/awsx | Node.js SDK
Create an ECS Service resource for EC2 with the given unique name, arguments, and options. Creates Task definition if taskDefinitionArgs is specified.
Read more >
Module classic/ecs | Package @pulumi/awsx | Node.js SDK
Explore members of the ecs module in the @pulumi/awsx package. ... A Task Definition can be used to define a Service, or it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found