Terraform-provider-aws: Add support for importing aws_ecs_task_definition

Created on 27 Jun 2018  ·  6Comments  ·  Source: hashicorp/terraform-provider-aws

Hello,

I searched through issues in both terraform and terraform-providers and didn't find any that brought this up. Is it feasible to add support for importing aws_ecs_task_definition? It doesn't seem to be supported on the version that I have:

$ terraform -version
Terraform v0.11.7
+ provider.aws v1.24.0

I tried to import a hello-world type task definition and was informed that this is currently unsupported:

$ terraform import aws_ecs_task_definition.fargate-email fargate-email
provider.aws.region
  The region where AWS operations will take place. Examples
  are us-east-1, us-west-2, etc.

  Default: us-east-1
  Enter a value:

aws_ecs_task_definition.fargate-email: Importing from ID "fargate-email"...

Error: aws_ecs_task_definition.fargate-email (import id: fargate-email): import aws_ecs_task_definition.fargate-email (id: fargate-email): resource aws_ecs_task_definition doesn't support import

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 "me too" comments, 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

Description

New or Affected Resource(s)

  • aws_XXXXX

Potential Terraform Configuration

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key.

References

  • 0000

  • enhancement servicecs

    Most helpful comment

    @wolfgangmeyers if you're feeling up to contributing this feature you should be able to largely follow what has been done with other import support additions such as for ECR repositories.

    The schema.ImportStatePassthrough method provides a convenient way to import a resource based on its ID/ARN as long as that resource can be read that way. Thankfully that seems to be the case here: https://github.com/terraform-providers/terraform-provider-aws/blob/25655c2b04b8f354701d3a0c99ce36c21949de92/aws/resource_aws_ecs_task_definition.go#L241-L243

    You'll need to add an acceptance test that piggy backs off the other acceptance tests to create a task definition and then check that it imports the state properly as you can see in the above linked commit. After that you should then run the acceptance test(s) locally and show the output in your PR. I also like to build the provider locally and then use it directly so I can play around with edge cases/get real world usage.

    Your PR should also include adding a section to the docs so other users now know that they can import ECS task definitions.

    Let me know if you need any more pointers :)

    All 6 comments

    Also, I'm comfortable with go development so if anyone could point me in the right direction for this I might be able to contribute 😸

    @wolfgangmeyers if you're feeling up to contributing this feature you should be able to largely follow what has been done with other import support additions such as for ECR repositories.

    The schema.ImportStatePassthrough method provides a convenient way to import a resource based on its ID/ARN as long as that resource can be read that way. Thankfully that seems to be the case here: https://github.com/terraform-providers/terraform-provider-aws/blob/25655c2b04b8f354701d3a0c99ce36c21949de92/aws/resource_aws_ecs_task_definition.go#L241-L243

    You'll need to add an acceptance test that piggy backs off the other acceptance tests to create a task definition and then check that it imports the state properly as you can see in the above linked commit. After that you should then run the acceptance test(s) locally and show the output in your PR. I also like to build the provider locally and then use it directly so I can play around with edge cases/get real world usage.

    Your PR should also include adding a section to the docs so other users now know that they can import ECS task definitions.

    Let me know if you need any more pointers :)

    Would love to have this feature as well. Maybe a comment can bump this up? Not fresh on my go, wish I could contribute. Would be happy to help test one day whenever this is working!

    Support for this has been merged in and will release with version 1.51.0 of the AWS provider, likely later today. 👍

    This has been released in version 1.51.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

    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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

    Was this page helpful?
    0 / 5 - 0 ratings

    Related issues

    reedloden picture reedloden  ·  3Comments

    hazmeister picture hazmeister  ·  3Comments

    dvishniakov picture dvishniakov  ·  3Comments

    modax picture modax  ·  3Comments

    gothrek22 picture gothrek22  ·  3Comments