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

[Bug]: AWS pipes set container override memory by default to 0 #40117

Open Azmah-Bad opened 2 weeks ago

Azmah-Bad commented 2 weeks ago

Terraform Core Version

1.9.6

AWS Provider Version

5.73.0

Affected Resource(s)

Expected Behavior

When creating an AWS Eventbridge Pipe with an ECS task as target that has container_overrides terraform sets explicitly the Memory field even if in the container override to 0 even if the user didn't set it explicitly in his configuration or set it to null

Actual Behavior

The Memory field is set to 0, causing the ECS task to crash due to "unknown error". but if the Memory field was omitted it wouldn't have crashed.

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_pipes_pipe" "jobs" {
  name     = "xxx"
  source   = aws_sqs_queue.trigger_job.arn
  target   = aws_ecs_cluster.cluster.arn
  role_arn = aws_iam_role.pipe.arn

  source_parameters {
    sqs_queue_parameters {
      batch_size = 1
    }
  }

  enrichment = aws_lambda_function.enrichment.arn
  target_parameters {
    ecs_task_parameters {
      task_count          = 1
      launch_type         = "FARGATE"
      platform_version = "1.4.0" 
      task_definition_arn = aws_ecs_task_definition.task.arn_without_revision
      propagate_tags      = "TASK_DEFINITION"
      network_configuration {
        aws_vpc_configuration {
          subnets = var.network.subnets
          security_groups = [aws_security_group.ecs_task.id]
        }
      }
      overrides {
        cpu    = "$.cpu" 
        memory = "$.memory"
        container_override {
          name   = "jobs"
          // memory = 0 even if not set terraform will set it to 0 and not omit it from the config 

Steps to Reproduce

  1. create an SQS queue / ECS Cluster (with a basic task definition with a 1 container)
  2. create an AWS Pipes that reads the messages from SQS and trigger an ECS task in the cluster created above
  3. in the target settings of the pipe override the container's env variables
  4. Terraform will also set the Memory field to 0 even if it's not explicitly set (even if it's set to null, terraform will still set it to 0)

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 2 weeks ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue