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.87k stars 9.21k forks source link

[Bug]: produced an invalid new value for .capacity_provider_strategy #39584

Open OldCrowEW opened 1 month ago

OldCrowEW commented 1 month ago

Terraform Core Version

1.9.5

AWS Provider Version

5.69.0

Affected Resource(s)

resource "aws_ecs_capacity_provider" "this" {
  name = "cp-capacity-provider"

  auto_scaling_group_provider {
    auto_scaling_group_arn         = aws_autoscaling_group.asg_name.arn
    managed_termination_protection = "ENABLED"

    managed_scaling {
      maximum_scaling_step_size = 1
      minimum_scaling_step_size = 1
      status                    = "ENABLED"
      target_capacity           = 100
    }
  }
}

resource "aws_ecs_service" "this" {
  name            = "ecs-service"
  cluster         = aws_ecs_cluster.cluster.id
  task_definition = aws_ecs_task_definition.task.arn
  desired_count   = 1

  capacity_provider_strategy {
    capacity_provider = aws_ecs_capacity_provider.this.name
    weight            = 1
  }

  deployment_circuit_breaker {
    enable   = true
    rollback = true
  }
}

Expected Behavior

ECS service should be deployed, attached the capacity provider

Actual Behavior

fails to apply :(

Relevant Error/Panic Output Snippet

│ Error: Provider produced inconsistent final plan
│ 
│ When expanding the plan for
│ aws_ecs_service.this to include new values
│ learned so far during apply, provider "registry.terraform.io/hashicorp/aws"
│ produced an invalid new value for .capacity_provider_strategy: planned set
│ element cty.ObjectVal(map[string]cty.Value{"base":cty.NullVal(cty.Number),
│ "capacity_provider":cty.StringVal(""), "weight":cty.NullVal(cty.Number)})
│ does not correlate with any element in actual.
│ 
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.

Terraform Configuration Files

example above has relevant code block

Steps to Reproduce

terraform apply

Debug Output

No response

Panic Output

No response

Important Factoids

looks similar to https://github.com/hashicorp/terraform-provider-aws/issues/37865

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 1 month ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue