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 + }) }