From b0f014e04ef80c0bf486af5148175fb326b6c5a4 Mon Sep 17 00:00:00 2001 From: luqmanbazran <155408530+luqmanbazran@users.noreply.github.com> Date: Thu, 31 Oct 2024 13:10:39 +0800 Subject: [PATCH] Revert "feat: allow users to choose which user data script to apply (#13)" This reverts commit b7b895dc2c510988a4b0948b9f22496910567864. --- main.tf | 7 ++----- variables.tf | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/main.tf b/main.tf index e610205..f4232cc 100644 --- a/main.tf +++ b/main.tf @@ -446,7 +446,6 @@ resource "aws_lambda_function" "database_lambda" { WEBSERVER_HOSTNAME = var.turbo_deploy_hostname WEBSERVER_HTTP_PORT = var.turbo_deploy_http_port WEBSERVER_HTTPS_PORT = var.turbo_deploy_https_port - USER_SCRIPTS = jsonencode(keys(var.user_scripts)) AMI_FILTERS = base64gzip(jsonencode(var.image_filter_groups)) } } @@ -480,7 +479,6 @@ resource "aws_lambda_function" "my_tf_function" { HOSTED_ZONE_ID = var.zone_id PUBLIC_KEY = aws_key_pair.admin_key.key_name PROFILE_NAME = aws_iam_instance_profile.turbodeploy_profile.name - USER_SCRIPTS = jsonencode(keys(var.user_scripts)) } } depends_on = [ @@ -496,11 +494,10 @@ resource "aws_lambda_event_source_mapping" "terraform_event_mapping" { } resource "aws_s3_object" "file_upload" { - for_each = var.user_scripts bucket = aws_s3_bucket.s3_terraform_state.bucket - key = "user-data-scripts/${each.key}.sh" + key = "user-data-scripts/user-data.sh" content_type = "text/plain" - content = each.value + content = var.user_scripts } resource "aws_key_pair" "admin_key" { diff --git a/variables.tf b/variables.tf index c802601..9ebdd57 100644 --- a/variables.tf +++ b/variables.tf @@ -99,8 +99,8 @@ variable "ec2_attributes" { variable "user_scripts" { description = "The user data to use when launching the instance" - type = map(string) - default = null + type = string + default = "" } variable "zone_id" {