-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
Computed desired_count for aws_ecs_service resource #4950
Comments
Hi, Based on that Terraform cannot make this optional. However, you can let Terraform initiate the ECS service with resource "aws_ecs_service" "example_ecs_service" {
name = "example"
cluster = "${aws_ecs_cluster.example_cluster1.id}"
task_definition = "${aws_ecs_task_definition.example_task_def.arn}"
desired_count = 2
iam_role = "${var.ecs_service_role_arn}"
load_balancer {
elb_name = "${aws_elb.example_service_elb.id}"
container_name = "example"
container_port = 8443
}
lifecycle {
ignore_changes = ["desired_count"]
}
} Feel free to submit an issue if that doesn't work for you. |
@radeksimko Thanks! It's exactly what I need. |
Looks like it still doesn't works as expected. Here's how to reproduce:
Here's the log:
'terraform apply' starts working again without issues as soon as I return desired count to initial value (2). Please let me know if there any options to resolve it. Thank you! |
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. |
Hi guys, I'm trying to deploy aws ecs service using terraform, setup is pretty much simple:
We have lambda function that checks request number on ELB (aws_elb.example_service_elb.id) and changes desired count of ecs service e.g. to 3 in case of requests spike. And when we do terraform apply it resets desired_count to 2 that is specified in terraform configuration. Is there possibility to make terraform to handle desired_count as calculated value e.g.:
Please advise. Thank you!
P.S. I tried not to specify desired_count in aws_ecs_service -- looks like terraform handles it as aws_ecs_service = 0 that definitely not what I'm trying to achieve.
The text was updated successfully, but these errors were encountered: