From e0703d41484e6f2d037c979838eb4bf69f7c6e5a Mon Sep 17 00:00:00 2001 From: Jaeha Kim Date: Mon, 10 Jul 2023 20:21:47 +0900 Subject: [PATCH] fix: drop deprecated hashicorp/template function --- fargate/ecs.tf | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/fargate/ecs.tf b/fargate/ecs.tf index 0398a3e..51ff7be 100644 --- a/fargate/ecs.tf +++ b/fargate/ecs.tf @@ -24,9 +24,8 @@ resource "aws_iam_role_policy_attachment" "ecs_task_execution_role" { } -data "template_file" "service" { - template = file(var.tpl_path) - vars = { +locals { + service_template = templatefile(var.tpl_path, { region = var.region aws_ecr_repository = aws_ecr_repository.repo.repository_url tag = "latest" @@ -34,7 +33,12 @@ data "template_file" "service" { host_port = var.host_port app_name = var.app_name environment = var.environment - } + }) +} + +resource "local_file" "service" { + content = local.service_template + filename = "/path/to/generated/file" } resource "aws_ecs_task_definition" "service" { @@ -80,4 +84,4 @@ resource "aws_ecs_service" "ecs-service" { Environment = var.environment Application = var.app_name } -} \ No newline at end of file +}