title: How to pass terraform variables into appspec.yml file?
body: <p>I am creating a couple of resources using terraform i.e. S3, CodeDeploy and ECS. I am creating my S3 bucket and uploading an appspec.yml file in it.</p>
  <p>This is what my appspec.yml looks like :-</p>
  <pre><code>version: 0.0
  Resources:
    - TargetService:
        Type: AWS::ECS::Service
        Properties:
          TaskDefinition: &quot;Hardcoded-ARN&quot;
          LoadBalancerInfo:
            ContainerName: &quot;new-nginx-app&quot;
            ContainerPort: 80
  </code></pre>
  <p>And this is my ECS module :-</p>
  <pre><code>resource &quot;aws_ecs_cluster&quot; &quot;foo&quot; {
    name = &quot;white-hart&quot;
  }
  
  resource &quot;aws_ecs_task_definition&quot; &quot;test&quot; {
    family                   = &quot;white-hart&quot;
    container_definitions    = file(&quot;${path.module}/definition.json&quot;)
    requires_compatibilities = toset([&quot;FARGATE&quot;])
    memory                   = 1024
    cpu                      = 256
    network_mode             = &quot;awsvpc&quot;
    execution_role_arn       = aws_iam_role.white-hart-role.arn
    runtime_platform {
      operating_system_family = &quot;LINUX&quot;
    }
  }
  </code></pre>
  <p>Basically what i am trying to do is to somehow pass the <code>aws_ecs_task_definition.arn</code> to my appspec.yml file so i do not have to hardcode it. Is there a way to achieve it without the use of build tools?</p>