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

The platform version must be null when specifying an EC2 launch type #2122

Open
slawek-survicate opened this issue Dec 6, 2024 · 3 comments
Assignees
Labels
bug service/ecs upstream-aws Unable to proceed due to missing or broken functionality from an AWS dependency.

Comments

@slawek-survicate
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
  • The resources and data sources in this provider are generated from the CloudFormation schema, so they can only support the actions that the underlying schema supports. For this reason submitted bugs should be limited to defects in the generation and runtime code of the provider. Customizing behavior of the resource, or noting a gap in behavior are not valid bugs and should be submitted as enhancements to AWS via the CloudFormation Open Coverage Roadmap.

Terraform CLI and Terraform AWS Cloud Control Provider Version

❯ terraform -v
Terraform v1.10.1
on darwin_arm64
+ provider registry.terraform.io/hashicorp/awscc v1.23.0

Affected Resource(s)

  • awscc_ecs_service

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

terraform {
  required_providers {
    awscc = {
      version = "1.23.0"
      source  = "hashicorp/awscc"
    }
  }
  backend "local" {
    path = "*****/terraform.cdktf.tfstate"
  }
}

provider "awscc"  {}

resource "awscc_ecs_task_definition" "task-definition" {
  container_definitions = [{
    image              = "nginx"
    memory_reservation = 50
    name               = "nginx"
  }]
  family = "tf-test"
}

resource "awscc_ecs_service" "example" {
  cluster          = "arn:aws:ecs:eu-west-1:*******:cluster/main"
  desired_count    = 1
  launch_type      = "EC2"
  platform_version = null
  service_name     = "tf-test"
  task_definition  = "${awscc_ecs_task_definition.task-definition.id}"
}

Debug Output

https://gist.github.com/slawek-survicate/6eb826c1d51f10050335786e2a9fbf4a

Expected Behavior

platform_version should be set to null if null is provided explicitly.

Actual Behavior

platform_version is sett to LATEST even if null is set explicitly.

And I get the error:

│ Waiting for Cloud Control API service CreateResource operation completion returned: waiter state transitioned to FAILED. StatusMessage:
| Invalid request provided: CreateService error: The platform version must be null when specifying an EC2 launch type. (Service: AmazonECS;
│ Status Code: 400; Error Code: InvalidParameterException; Request ID: 508dc722-cadd-4073-8aad-fb3781cb2331; Proxy: null). ErrorCode:
│ InvalidRequest

Steps to Reproduce

  1. terraform plan - you can see that platform_version is set to LATEST
  2. terraform apply
@quixoticmonk
Copy link
Collaborator

Thank you for opening the issue @slawek-survicate . I am able to replicate this with an EC2 instance and it does seem like an issue with the Service schema which has a default of LATEST. Opening a service ticket on this for it to be removed or updated.

@quixoticmonk quixoticmonk added upstream-aws Unable to proceed due to missing or broken functionality from an AWS dependency. service/ecs and removed needs-triage labels Dec 9, 2024
@quixoticmonk quixoticmonk self-assigned this Dec 9, 2024
@slawek-survicate
Copy link
Author

Thank you @quixoticmonk. Theoretically do we need to include fields that have a default value? To my knowledge fields with default value are optional.

@quixoticmonk
Copy link
Collaborator

No, you wouldn't need to. The schema had set the default value for the version which wasn't applicable for every situation and the cloudcontrol API would pass that along as the value for that field to service . This should be corrected on the CloudFormation schema.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug service/ecs upstream-aws Unable to proceed due to missing or broken functionality from an AWS dependency.
Projects
None yet
Development

No branches or pull requests

2 participants