Skip to content

Commit

Permalink
Merge pull request #51 from mydeal-com-au/fix-template-function
Browse files Browse the repository at this point in the history
remove deprecated template_file function
  • Loading branch information
caiovfernandes authored Jul 26, 2023
2 parents 6035a50 + 0cd0b68 commit c6511e4
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions ec2-launch-template.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
data "template_file" "userdata" {
count = var.fargate_only ? 0 : 1
template = file("${path.module}/userdata.tpl")

vars = {
tf_cluster_name = var.name
tf_efs_id = aws_efs_file_system.ecs[0].id
userdata_extra = var.userdata
}
}

resource "aws_launch_template" "ecs" {
count = var.fargate_only ? 0 : 1
name_prefix = "ecs-${var.name}-"
Expand All @@ -32,7 +21,11 @@ resource "aws_launch_template" "ecs" {

vpc_security_group_ids = concat([aws_security_group.ecs_nodes.id], var.security_group_ids)

user_data = base64encode(data.template_file.userdata[0].rendered)
user_data = base64encode(templatefile("${path.module}/userdata.tpl", {
tf_cluster_name = var.name
tf_efs_id = aws_efs_file_system.ecs[0].id
userdata_extra = var.userdata
}))

key_name = var.ec2_key_enabled ? aws_key_pair.generated_key[0].key_name : null

Expand Down

0 comments on commit c6511e4

Please sign in to comment.