hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.83k stars 9.17k forks source link

[Bug]: When expanding the plan for aws_ecs_service.qa-ecs-service [...] provider aws produced an invalid new value for .triggers["redeployment"]: was cty.StringVal("2022-11-28T16:50:44Z"), but now │ cty.StringVal("2022-11-28T18:08:03Z"). #28070

Open domvo opened 1 year ago

domvo commented 1 year ago

Terraform Core Version

v1.3.5

AWS Provider Version

v4.41.0

Affected Resource(s)

Expected Behavior

Running apply multiple times with an aws_ecs_service that has force_new_deployment set to true should run a new deployment of the given ecs Service.

Actual Behavior

It shows an error and doesn't run apply (or when it applies, it doesn't do anything, because it says "No Changes").

Relevant Error/Panic Output Snippet

| Error: Provider produced inconsistent final plan
│
│ When expanding the plan for aws_ecs_service.qa-ecs-service to include new values learned so far during apply, provider
│ "registry.terraform.io/hashicorp/aws" produced an invalid new value for .triggers["redeployment"]: was cty.StringVal("2022-11-28T16:50:44Z"), but now
│ cty.StringVal("2022-11-28T18:08:03Z").
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Terraform Configuration Files

resource "aws_ecs_service" "qa-ecs-service" {
  name            = "qa-${var.pr_id}-ecs-service"
  cluster         = var.cluster_arn
  task_definition = aws_ecs_task_definition.qa-task-definition.arn
  desired_count   = 1
  launch_type     = "FARGATE"
  network_configuration {
    subnets       = var.subnets
    security_groups = var.security_groups
    assign_public_ip = true 
  }
  load_balancer {
    target_group_arn  = aws_lb_target_group.qa-target-group.arn
    container_name    = "qa-${var.pr_id}-container"
    container_port    = "8080"
  }
  force_new_deployment = true

  triggers = {
    redeployment = timestamp()
  }
}

Steps to Reproduce

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

No response

github-actions[bot] commented 1 year ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

rnithinpaladin commented 1 year ago

same issue

simon-turnbull-healx commented 1 year ago

Same issue as well using Terraform v1.3.6 with hashicorp/aws v4.50.0

When expanding the plan for module.xyz.aws_ecs_service.service to include new values learned so far during apply, provider "registry.terraform.io/hashicorp/aws" produced an invalid new value for .triggers["redeployment"]: was cty.StringVal("2023-01-19T09:58:45Z"), but now cty.StringVal("2023-01-19T12:58:17Z"). │ │ This is a bug in the provider, which should be reported in the provider's own issue tracker

mshanks1983 commented 1 year ago

Any updates on this yet? It's proving to be a pretty big blocker for some of my deployment efforts.

mshanks1983 commented 1 year ago

Would it reduce the likelihood of hitting this bug if I used something like date() instead of time()? Something that doesn't change with the time as quickly?

nathanhruby commented 1 year ago

Did you try using true instead of timestamp()?

scheleaap commented 1 year ago

This is likely a duplicate of #19583.

lordz-ei commented 1 year ago

Did you try using true instead of timestamp()?

I assume you mean triggers = { redeployment = true }

lordz-ei commented 1 year ago

@nathanhruby, setting triggers = { redeployment = true } does not have any efect in my case

Surgo commented 11 months ago

It's works fine for me.

  triggers = {
    redeployment = plantimestamp()
  }
LozanoMatheus commented 2 months ago

@Surgo did you also set the force_new_deployment = true or just triggers.redeployment?