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.

TaskDefinition Always Replace When Default Values Not Included in ContainerDefinitions

See original GitHub issue

I have an ECS service that is having it’s task definition replaced every time I run pulumi up even if no changes are made to the task definition. The diff that pulumi is reporting shows the only change being the container definitions string. It appears that the container definitions string in the stack’s state has default values for several fields filled in (e.g. cpu=0, mountPoints=[], volumesFrom=[], etc.) while my code does not. The comparison isn’t adding those default values before comparing the two strings so it reports they are different. I’ve manually added all the default values and now pulumi up correctly reports there are no changes. Is it possible to have those default values considered when doing the comparison so I don’t have to make sure they are always present in my code? I’m using version 1.14.1 with the golang SDK.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
emiioancommented, Jan 13, 2021

@mattsleiman-discovery for Fargate task definition I was able to fix this by providing default health check values, for the rest like CPU and memory I didn’t mention it as for Fargate its not mandatory and it does not replace container definition anyway, the only values for me that kept replacing containerdefinitions was heathCheck values:

healthCheck: {
  command: ["CMD-SHELL", "curl -f http://localhost/ || exit 1"],
  retries: 3,
  timeout: 5,
  interval: 30
},
0reactions
lukehobancommented, Nov 19, 2022

This is effectively due to https://github.com/hashicorp/terraform-provider-aws/issues/11526 in upstream. The normalization used in the diff implementation could in principle handle all of the topics raised here:

  1. Normalizing away env vars set to undefined values
  2. Normalizing user missing or set to default value
  3. Normalizing away health check default values
Read more comments on GitHub >

github_iconTop Results From Across the Web

TaskDefinition Always Replace When Default Values Not ...
It appears that the container definitions string in the stack's state has default values for several fields filled in (e.g. cpu=0, mountPoints ...
Read more >
Task definition parameters - Amazon Elastic Container Service
For Amazon ECS tasks hosted on Amazon EC2 Windows instances, the valid values are default , and awsvpc . If no network mode...
Read more >
aws_ecs_task_definition | Resources | hashicorp/aws
The valid values are EC2 and FARGATE . skip_destroy - (Optional) Whether to retain the old revision when the resource is destroyed or...
Read more >
class ECS. Client - Boto3 Docs 1.26.28 documentation
DEFAULT : The awslogs configuration in the task definition is used. If no logging parameter is specified, it defaults to this value. If...
Read more >
terraform keeps forcing new resource/force replacement for ...
Above is the terraform plan that is forcing new task definition/container definition. As you can see , terraform is replacing all default values...
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