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

[Bug]: aws_ecs_service fails with "Family should not be null or empty." #27362

Closed
durnote opened this issue Oct 20, 2022 · 10 comments · Fixed by #27390
Closed

[Bug]: aws_ecs_service fails with "Family should not be null or empty." #27362

durnote opened this issue Oct 20, 2022 · 10 comments · Fixed by #27390
Labels
bug Addresses a defect in current functionality. service/ecs Issues and PRs that pertain to the ecs service.
Milestone

Comments

@durnote
Copy link

durnote commented Oct 20, 2022

Terraform Core Version

0.12.31

AWS Provider Version

4.35

Affected Resource(s)

AWS ECS - CreateService fails when you try to create ECS service that uses EXTERNAL deployment controller

deployment_controller {
type = "EXTERNAL"
}

Expected Behavior

ECS Service should be created.

Actual Behavior

Error: error creating ECS service (service-name): InvalidParameterException: Family should not be null or empty.

Relevant Error/Panic Output Snippet

Error: error creating ECS service (svc-name): InvalidParameterException: Family should not be null or empty.

Terraform Configuration Files

resource "aws_ecs_service" "my_service_test" {
  name          = "svc-name"
  cluster       = "cluster-name"
  desired_count = 0

  scheduling_strategy = "REPLICA"
  deployment_controller {
    type = "EXTERNAL"
  }

  deployment_maximum_percent = "100"   
  deployment_minimum_healthy_percent = "0"
  propagate_tags = "TASK_DEFINITION"

  tags = {
    Name     = "svc-name"
    testing  = "yes"
  }
}

Steps to Reproduce

As you probably know, when using EXTERNAL deployment controller on ECS you should not provide task definition to the ECS during the creation of service. From AWS Cloud Trail logs I could confirm that latest Terraform provider still sends taskDefiniton as empty string. Looks like this was workinig fine until few days ago.

It seems that AWS updated ECS api recently and now requires that taskDefinition element is strictly not present in JSON request. I could confirm this by creating the same ECS service using AWS Cli and providing JSON without taskDefinition element.

aws ecs create-service --cluster cluster-name--service-name svc-name --region us-east-1 --cli-input-json file://ecsaws.json

If taskDefinition field is present in JSON file it fails with the same error:

"An error occurred (InvalidParameterException) when calling the CreateService operation: Family should not be null or empty."

Debug Output

Just attaching Cloud Trail log that confirms Terraform providers is sending taskDefinition in API request as empty string "".

"taskDefinition": ""

Full event

{
    "eventVersion": "1.08",
    "eventTime": "2022-10-17T17:52:47Z",
    "eventSource": "ecs.amazonaws.com ",
    "eventName": "CreateService",
    "awsRegion": "us-east-1",
    "userAgent": "APN/1.0 HashiCorp/1.0 Terraform/0.12.31 (+https://www.terraform.io ) terraform-provider-aws/dev (+https://registry.terraform.io/providers/hashicorp/aws ) aws-sdk-go/1.44.114 (go1.18.4; linux; amd64)",
    "errorCode": "InvalidParameterException",
    "errorMessage": "Family should not be null or empty.",
    "requestParameters": {
        "capacityProviderStrategy": [],
        "cluster": "cluster-name",
        "deploymentConfiguration": {
            "maximumPercent": 100,
            "minimumHealthyPercent": 0
        },
        "deploymentController": {
            "type": "EXTERNAL"
        },
        "desiredCount": 0,
        "enableECSManagedTags": false,
        "enableExecuteCommand": false,
        "propagateTags": "TASK_DEFINITION",
        "schedulingStrategy": "REPLICA",
        "serviceName": "svc-name",
        "createdBy": "arn:aws:iam::--SENSITIVE-REMOVED--",
        "taskDefinition": ""

    },
    "responseElements": null,
    "requestID": "96483ddc-a949-4d04-b557-7f775836d914",
    "eventID": "f8d4c080-5121-45ad-90ad-eae7b26bd92a",
    "readOnly": false,
    "eventType": "AwsApiCall",
    "managementEvent": true,
    "recipientAccountId": "SENSITIVE-REMOVED",
    "eventCategory": "Management",
    "tlsDetails": {
        "tlsVersion": "TLSv1.2",
        "cipherSuite": "ECDHE-RSA-AES128-GCM-SHA256",
        "clientProvidedHostHeader": "ecs.us-east-1.amazonaws.com "
    }
}

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

No response

@durnote durnote added bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. labels Oct 20, 2022
@github-actions github-actions bot added the service/ecs Issues and PRs that pertain to the ecs service. label Oct 20, 2022
@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • 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.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@durnote
Copy link
Author

durnote commented Oct 20, 2022

I hope this should be easy fix. All we need is to make sure when Terraform creates ECS with external deployment controller to ignore taskDefinition. Not even providing it as an empty string.

@durnote
Copy link
Author

durnote commented Oct 20, 2022

Update: Just confirmed the issue is also present on latest Terraform v1.3.3 using latest aws provider (4.35).

Error: error creating ECS service (svc-name): InvalidParameterException: Family should not be null or empty.

Please note - this issue blocks anyone to create ECS service that uses EXTERNAL deploy controller. I think it should be prioritized accordingly.

@durnote durnote changed the title [Bug]: AWS ECS CreateService fails with "Family should not be null or empty." [Bug]: aws_ecs_service fails with "Family should not be null or empty." Oct 21, 2022
@aoskotsky-amplify
Copy link

I am also seeing this bug for my EXTERNAL deployment controller services

@jusunglee
Copy link

jusunglee commented Oct 21, 2022

I cannot even pass a valid task definition name as a parameter to workaround this issue

@sgirones
Copy link
Contributor

here is a fix if you want to upvote: #27390

tested myself and works

@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label Oct 24, 2022
@walter-hernandez
Copy link

Currently experiencing the same bug. Let's wait for the maintainers to merge your PR #27390 @sgirones

@durnote
Copy link
Author

durnote commented Oct 24, 2022

Thanks everyone!

@github-actions
Copy link

This functionality has been released in v4.37.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

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 Nov 27, 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
6 participants