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

ecs_service inconsistent apply intermittently when placement_constraints is set #24018

Closed
driskillb43 opened this issue Apr 4, 2022 · 2 comments · Fixed by #25641
Closed
Assignees
Labels
bug Addresses a defect in current functionality. service/ecs Issues and PRs that pertain to the ecs service.
Milestone

Comments

@driskillb43
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

Terraform: 0.14.10
AWS Provider Version: 4.8.0

Affected Resource(s)

  • aws_ecs_service

Terraform Configuration Files

data "aws_ecs_cluster" "this" {
  cluster_name = "test"
}

resource "aws_ecs_task_definition" "test_task_definition" {
  family                   = "test-service"
  network_mode             = "bridge"
  requires_compatibilities = ["EC2"]
  container_definitions = jsonencode([
    {
      essential   = true
      name        = "test-server"
      image       = "test-image"
      cpu         = 128
      memory      = 256
      environment = []
      portMappings = [
        {
          containerPort = 8000
          hostPort      = 8000
        }
      ]
    }
  ])
}

resource "aws_ecs_service" "test_service" {
  name                = "test-service"
  cluster             = data.aws_ecs_cluster.this.arn
  task_definition     = "${aws_ecs_task_definition.test_task_definition.family}:${aws_ecs_task_definition.test_task_definition.revision}"
  scheduling_strategy = "DAEMON"
  deployment_controller {
    type = "ECS"
  }
  placement_constraints {
    type       = "memberOf"
    expression = "attribute:user_data_version == 2"
  }
}

Debug Output

Not able to reproduce it with TF_LOG=TRACE set oddly.

Expected Behavior

Should apply fine

Actual Behavior

The following error is thrown intermittently:

When applying changes to aws_ecs_service.test_service, provider "registry.terraform.io/hashicorp/aws" produced an unexpected new value: Root resource was present, but now absent.

This is a bug in the provider, which should be reported in the provider's own issue tracker.

Steps to Reproduce

It requires multiple tries to hit it, it does not happen every time.

  1. terraform apply

Important Factoids

If I remove the placement_constraints from the aws_ecs_service, I do not encounter the issue anymore. Also, this seems to have cropped up in the last two weeks. I was not seeing this issue a few weeks before.

References

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. bug Addresses a defect in current functionality. service/ecs Issues and PRs that pertain to the ecs service. labels Apr 4, 2022
@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Apr 4, 2022
@gdavison gdavison self-assigned this Jun 30, 2022
@github-actions github-actions bot added this to the v4.22.0 milestone Jul 4, 2022
@github-actions
Copy link

github-actions bot commented Jul 8, 2022

This functionality has been released in v4.22.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

github-actions bot commented Aug 7, 2022

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/ecs Issues and PRs that pertain to the ecs service.
Projects
None yet
3 participants