-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Add aws_ecs_container_definition data source #7230
Conversation
this datasource allows terraform to work with externally modified state, e.g. when you're using an ECS service which is continously updated by your CI via the AWS CLI. right now you'd have to wrap terraform into a shell script which looks up the current image digest, so running terraform won't change the updated service. using the aws_ecs_container_definition data source you can now leverage terraform, removing the wrapper entirely.
|
||
# aws\_ecs\_container\_definition | ||
|
||
The Availability Zones data source allows access to the list of AWS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You always find my doc copy pasta. love it. thank you @stack72 ❤️
@stack72 done! |
Hi @nicolai86 This looks good :) Thanks for the work here! Paul |
This seems to cause a dependency cycle error in my case:
flower.json:
The error I get is:
Am I missing something? EDIT:
Noticed the support for this in https://github.com/hashicorp/terraform/blob/master/CHANGELOG.md#070-august-2-2016 |
@nareshov the task definition id is set to the
|
the example above is actually missing that part, I'll correct it |
How's that useful if service definition still refers to aws_ecs_task_definition, and every time you do CI deploy it changes task_definition revision referenced in the service, applying terraform later will switch service back to previous version? |
My use case was to get the current image digest; I think you can easily include current revision here as well, change should be minimal |
Terraform saves task definition reference in service definition in state file as [family:state], so it's more about aws_ecs_service resource... |
Point taken. Luckily, this data source is only for the containers WITHIN a task definition |
I'm having trouble using the exported |
@inversion my use case was reading it easily, which is why I convert it to a map; not sure how you'd lookup values from an array of objects in HCL. Do you have an example for that? |
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. |
this datasource allows terraform to work with externally modified state, e.g.
when you're using an ECS service which is continously updated by your CI via the
AWS CLI.
Right now you'd have to wrap terraform into a shell script which looks up the
current image digest, so running terraform won't change the updated service:
using the
aws_ecs_container_definition
data source you can now leverageterraform, removing the wrapper entirely:
This works for task definitions containing multiple container definitions, too, since a
aws_container_definition
data source only tracks one container inside atask_definition
.