-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws_ecs_service.my-ecs-service->task_definition" is always shows up as modified #5205
Comments
Duplicate of #5323 |
Hi there, @Etiene For me #5833 does not solve my problem. In my case Thanks a lot! I a very appreciate your work for the whole terraform projects. Cheers Sebastian |
Hello all, I even compared the .rendered values of templates which are being passed as an arguments to container_definitions among different executions and they were absolutely the same. But the most confusing part for me is that it is not 100% reproducable. I have shed load of services and for some of them it behaves expectedly (without changes).
Here is my task definition for the service with a problem
Best Regards, |
facing the same issue like @oavdonin and same goes to the most confusing part that it is not 100% reproducable. Kindly share if this issue is fixed by some other ticker or any info regarding the same will also help. regards, |
I have the same issue. In my case the modification of the service and restart of the service every time I run 'terraform apply' happens only for services with task definition which includes mountPoints
If I run the same service with the same task def. but without the mountPoints everything works fine. |
same issue here. my container definition have a lot of environment variables. with 41 variables it works fine, when I add one more, |
I see this when I have duplicate environment variables with the same name and value at different locations within the set in the container definition. That is, I noticed the problem when I started using a formatlist to generate the environment json from a |
Hi folks 👋 It appears this issue has diverged from the original bug report. The later comments, while partially fitting the issue title, are ultimately are due to different circumstances in the Please note that we use GitHub issues for tracking bugs and enhancements rather than for questions. While we may be able to help with certain simple problems here it's generally better to use the community forums where there are far more people ready to help, whereas the GitHub issues here are generally monitored only by the small set of code maintainers. If you feel like you have a valid bug report still when using recent versions of Terraform 0.12 and the Terraform AWS Provider, please feel free to submit a new issue filling out all the details requested by the Bug Report issue template. Thanks. 👍 For the original report (@pjain00), a perpetual difference of the following in a
This can be reproduced with the following simplified, but full configuration: terraform {
required_providers {
aws = "2.34.0"
}
required_version = "0.12.13"
}
provider "aws" {
region = "us-east-2"
}
resource "aws_ecs_cluster" "test" {
name = "bflad-testing"
}
resource "aws_ecs_task_definition" "test" {
family = "bflad-testing"
container_definitions = <<DEFINITION
[
{
"cpu": 128,
"essential": true,
"image": "busybox:latest",
"memory": 128,
"name": "busybox"
}
]
DEFINITION
}
resource "aws_ecs_service" "test" {
cluster = aws_ecs_cluster.test.id
desired_count = 0
name = "bflad-testing"
task_definition = aws_ecs_task_definition.test.family
} This difference is due to how the ECS API works, while it allows submitting just the ECS Task Definition family name, it will always return the family name and active revision number separated with a colon ( To fix this in your configuration, you can either concatenate the family name and revision as the API (and therefore Terraform) expects, e.g. resource "aws_ecs_service" "test" {
# ... other settings omitted for clarity ...
task_definition = "${aws_ecs_task_definition.test.family}:${aws_ecs_task_definition.test.revision}"
} Or use the ECS Task Definition ARN (which will show a difference the first apply but be stable afterwards), e.g. resource "aws_ecs_service" "test" {
# ... other settings omitted for clarity ...
task_definition = aws_ecs_task_definition.test.arn
} If an external system (such as a Continuous Deployment system) is updating the ECS Task Definition revisions external to Terraform, you will need to use resource "aws_ecs_service" "test" {
# ... other settings omitted for clarity ...
task_definition = "${aws_ecs_task_definition.test.family}:${aws_ecs_task_definition.test.revision}"
lifecycle {
ignore_changes = [task_definition]
}
} It is also worth mentioning that the above Please see the For this report (@oavdonin), I'm not able to reproduce any issue with the following configuration (no difference on second plan): terraform {
required_providers {
aws = "2.34.0"
}
required_version = "0.12.13"
}
provider "aws" {
region = "us-east-2"
}
resource "aws_ecs_cluster" "test" {
name = "bflad-testing"
}
resource "aws_ecs_task_definition" "test" {
family = "bflad-testing"
container_definitions = <<DEFINITION
[
{
"name": "lb-nginx",
"image": "busybox:latest",
"environment": [
{
"name" : "ACCESS_KEY",
"value" : "secret"
},
{
"name" : "SECRET_KEY",
"value" : "secret"
},
{
"name" : "ENVIRONMENT",
"value" : "quality"
},
{
"name" : "spring_profiles_active",
"value" : "aws_config"
},
{
"name" : "JAVA_OPTS",
"value" : "-Xmx3072M -Xms3072M"
}
],
"memoryReservation": 1024,
"healthCheck": {
"retries": 3,
"command": [
"CMD-SHELL",
"/bin/true"
],
"interval": 10,
"timeout": 9,
"startPeriod": 15
},
"portMappings": [
{
"hostPort": 80,
"containerPort": 80,
"protocol": "tcp"
}
],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/ecs/fargate-testing/abc",
"awslogs-region": "eu-central-1",
"awslogs-stream-prefix": "ecs"
}
},
"dockerLabels": {
"environment": "quality"
}
}
, {
"name": "tomcat",
"image": "busybox:latest",
"environment": [
{
"name" : "Environment",
"value" : "quality"
}, {
"name" : "APP_PROFILE",
"value" : "test_value"
}
],
"memoryReservation": 1024,
"healthCheck": {
"retries": 3,
"command": [
"CMD-SHELL",
"/bin/true"
],
"interval": 10,
"timeout": 9,
"startPeriod": 15
},
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/ecs/fargate-testing/abc",
"awslogs-region": "eu-central-1",
"awslogs-stream-prefix": "ecs"
}
},
"dockerLabels": {
"environment": "quality"
}
}
]
DEFINITION
}
resource "aws_ecs_service" "test" {
name = "bflad-testing"
cluster = aws_ecs_cluster.test.id
task_definition = "${aws_ecs_task_definition.test.family}:${aws_ecs_task_definition.test.revision}"
desired_count = 0
} $ terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
aws_ecs_cluster.test: Refreshing state... [id=arn:aws:ecs:us-east-2:--OMITTED--:cluster/bflad-testing]
aws_ecs_task_definition.test: Refreshing state... [id=bflad-testing]
aws_ecs_service.test: Refreshing state... [id=arn:aws:ecs:us-east-2:--OMITTED--:service/bflad-testing]
------------------------------------------------------------------------
No changes. Infrastructure is up-to-date.
This means that Terraform did not detect any differences between your
configuration and real physical resources that exist. As a result, no
actions need to be performed. For the rest of the comments, we would need to see a fully reproducible configuration to potentially triage these. As mentioned above, if you feel like you have a valid bug report still when using recent versions of Terraform 0.12 and the Terraform AWS Provider, please feel free to submit a new issue filling out all the details requested by the Bug Report issue template. Thanks. 👍 |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
Terraform Version
Terraform v0.11.7
Affected Resource(s)
Terraform Configuration Files
Debug Output
Panic Output
Expected Behavior
As I did not make any change in the task definition, so I was expecting that there should not be any change in my ECS object and there should not be any new version created for task definition.
Actual Behavior
Everytime I run my terraform script it modifies the task definition of my ECS object as below.
task_definition: "my-task-def:14" => "my-task-def"
Steps to Reproduce
terraform apply
Important Factoids
References
The text was updated successfully, but these errors were encountered: