-3

Terraforming a AWS ECS Service depends on this configuration:

load_balancer {
  target_group_arn = aws_lb_target_group.foo.arn
  container_name   = "mongo"
  container_port   = 8080
}

‘container_name’ here needs to be the same value as what’s defined in the task definition. The problem here is that I don’t want to terraform the Task Definition, as that’s an application-level configuration I’d like to keep separate from the terraform / terragrunt which is obviously infrastructure-level configuration. What is the best approach here? Am I forced to define the task definition in terraform?

Additional Background: I have PCF experience where a simple manifest file was tied with the source code. Cloud Foundry was very 12-factor sensitive. Here it seems to be a violation of those principles.

Marcin
  • 215,873
  • 14
  • 235
  • 294

1 Answers1

0

that’s an application-level configuration

Not in AWS. Task definition is an AWS resource, and as any resource it can be managed through IaC tools, such as CloudFormation or Terraform. Thus if you want to use IaC to manage your application at AWS, you have to accept the fact that task definition is part of the AWS infrastructure, not application.

Marcin
  • 215,873
  • 14
  • 235
  • 294