From 5b5250badc0c4bd035f3971a84d8e2c24fefcc74 Mon Sep 17 00:00:00 2001 From: Ryan Malloy Date: Sun, 10 Nov 2024 04:36:51 -0700 Subject: [PATCH] add user_data templatefile and add SSH_PUBLIC_KEY to trusted keys --- main.tf | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index cf0b6d9..86b2e1a 100644 --- a/main.tf +++ b/main.tf @@ -151,5 +151,8 @@ resource "aws_instance" "ubuntu_instance" { delete_on_termination = true } - user_data = var.user_data + # Use templatefile for user_data: https://developer.hashicorp.com/terraform/language/v1.2.x/functions/templatefile + user_data = templatefile("${path.module}/user_data.sh", { + extra_key = var.SSH_PUBLIC_KEY + }) }