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
# 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.
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!
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.ImportStatePassthroughmethod 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-L243You'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 :)