bright-toddler-17549
06/13/2024, 7:20 AMmodule.test-service[0].aws_ecs_service.this
$0.00
+ module.test-service.aws_ecs_service.this
$0.00
Can someone let me know what might be the reason for this?mysterious-teacher-68276
06/13/2024, 7:21 AMbright-toddler-17549
06/13/2024, 9:27 AMARM
processor .. I'm trying to create ECS fargate @mysterious-teacher-68276mysterious-teacher-68276
06/13/2024, 1:04 PMbright-toddler-17549
06/14/2024, 2:44 AMIf the stack creation/plan happening in the same terraform run or are they separate projects?
- So when I raise a PR, 1st plan generation will happen. Next, we will review the plan and if things are good, I will merge the PR and then apply run will happen.
Cost calculation for other resources are working fine
in this approach.
task definition configuration to actually be part of the run so that we can infer the service constraints.
- Task definition is also part of the same terraform run but it is not part of ECS module actually.
Like you mentioned, we are passing it's arn
in service module.mysterious-teacher-68276
06/14/2024, 6:45 AMdata
block this will not work with infracost. Again because of the requirement of access to your cloud environment.stocky-businessperson-50900
06/14/2024, 1:24 PMresource "aws_ecs_service" "ecs_service_create" {
name = local.service-name
cluster = local.ecs_cluster
task_definition = data.aws_ecs_task_definition.get_latest_task_version.arn // ALSO TESTED: aws_ecs_task_definition.task_definitions_create.arn
desired_count = var.desired_count
...
...
}
I have always used data
to get the ARN of the task, and it has always worked. But as Hugo suggested, I also tried calling the resource directly since it is in the same Terraform. Even so, the cost is not calculated.
I use data
to always get the latest version of the task. Sometimes the developers do manual tests and generate new tasks outside of Terraform. So, Terraform always uses data to list the latest version of the task to configure in the service. This was not a problem for calculating ECS costs until a few months ago.