Skip to content

Commit c6511e4

Browse files
Merge pull request #51 from mydeal-com-au/fix-template-function
remove deprecated template_file function
2 parents 6035a50 + 0cd0b68 commit c6511e4

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

ec2-launch-template.tf

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
data "template_file" "userdata" {
2-
count = var.fargate_only ? 0 : 1
3-
template = file("${path.module}/userdata.tpl")
4-
5-
vars = {
6-
tf_cluster_name = var.name
7-
tf_efs_id = aws_efs_file_system.ecs[0].id
8-
userdata_extra = var.userdata
9-
}
10-
}
11-
121
resource "aws_launch_template" "ecs" {
132
count = var.fargate_only ? 0 : 1
143
name_prefix = "ecs-${var.name}-"
@@ -32,7 +21,11 @@ resource "aws_launch_template" "ecs" {
3221

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

35-
user_data = base64encode(data.template_file.userdata[0].rendered)
24+
user_data = base64encode(templatefile("${path.module}/userdata.tpl", {
25+
tf_cluster_name = var.name
26+
tf_efs_id = aws_efs_file_system.ecs[0].id
27+
userdata_extra = var.userdata
28+
}))
3629

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

0 commit comments

Comments
 (0)