Skip to content
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

Task definitions continuously beening updated #2417

Closed
kazeshini178 opened this issue Nov 23, 2017 · 8 comments
Closed

Task definitions continuously beening updated #2417

kazeshini178 opened this issue Nov 23, 2017 · 8 comments

Comments

@kazeshini178
Copy link

The issue that im experiencing is that terraform (or the aws provider) keeps trying to update my aws_ecs_task_definitions though nothing has changed in them. This causes our ecs service to continuously be updated with the "new" definition.

Our task definitions are read in from a JSON file as such:

resource "aws_ecs_task_definition" "service" {
  family                = "service"
  container_definitions = "${file("task-definitions/service-definition.json")}"
}

Only difference I have seen is the order of the environment variables and the inclusion of optional fields.

Terraform Version

Terraform v0.11.0
+ provider.aws v1.3.0
+ provider.template v1.0.0

Affected Resource(s)

  • aws_ecs_service
  • aws_ecs_task_definition

Expected Behavior

As the definition hasn't changed I should see an output of Plan: 0 to add, 0 to change, 0 to destroy.
This was the output I recieved with versions of Terraform 0.10.8 and 0.9.0

Actual Behavior

I get the following output Plan: 2 to add, 2 to change, 2 to destroy

Steps to Reproduce

  1. Create aws_ecs_service
  2. Create aws_ecs_task_definition linked to aws_ecs_service
  3. terraform plan
  4. terraform apply
  5. terraform plan

References

None from what I could find

@jurajseffer
Copy link
Contributor

@kazeshini178 This usually happens when your rendered policy does not exactly equal the document saved in AWS. Retrieve it from AWS using CLI and compare with your rendered version. AWS often accept different syntax etc for legacy reasons but then modify it according to the new format which results in always pending change during plan.

@Puneeth-n
Copy link
Contributor

Exactly my thoughts. Elasticsearch has the same issue. Checkout the solution I used for it here

@kazeshini178
Copy link
Author

@Puneeth-n I have tried matching aws output like the suggested solution, but with each apply that I run the task definitions environment variables just keep swapping their order causing a pending change.

@jurajseffer checked the AWS CLI output which seems to match my task definition JSON file. Might be missing something.
Though it doesn't explain why the previous versions mentioned didn't have this issue.

@Puneeth-n
Copy link
Contributor

@kazeshini178 can you share your task definition? I will try to fix it. I might know where the problem might be coming from.

@kazeshini178
Copy link
Author

kazeshini178 commented Nov 28, 2017

@Puneeth-n here we go,

[
    {
        "name": "service",
        "image": "eu-west-2.amazonaws.com/service:latest",
        "cpu": 10,
        "memory": 512,
        "essential": true,
        "mountPoints": [],
        "volumesFrom": [],
        "portMappings": [
            {
                "containerPort": 80,
                "hostPort": 2225,
                "protocol": "tcp"
            }
        ],
        "environment": [ 
            {
                "name": "Service_Username",
                "value": "cX6QTK2W83268Up"
            },
            {
                "name": "Account_Username",
                "value": "CIM"
            },
            {
                "name": "Service_URL",
                "value": "https://secure3.transunionafrica.com/crbws/ke?wsdl"
            },
            {
                "name": "Account_Industry",
                "value": "1346406"
            },  
            {
                "name": "ServerInstance",
                "value": "QA"
            },
            {
                "name": "Account_Code",
                "value": "2110"
            }
        ]
    }
]

@Puneeth-n
Copy link
Contributor

@kazeshini178 Can you check with v1.3.1 #2339

@kazeshini178
Copy link
Author

@Puneeth-n Just updated to v1.4.0 like 5 minutes before the GitHub email :)

This seems to have solved the issue after running terraform apply once more it no longer indicates a change on the next terraform plan.

Thanks for the assistance :)

@ghost
Copy link

ghost commented Apr 10, 2020

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!

@ghost ghost locked and limited conversation to collaborators Apr 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants