From d60d97958b6fe4a05b4d60483c4bb90730092180 Mon Sep 17 00:00:00 2001 From: mikereiddigital Date: Thu, 15 Feb 2024 14:21:17 +0000 Subject: [PATCH] Adds user_data to example. --- terraform/environments/cooker/main.tf | 112 +++++++------------------- 1 file changed, 31 insertions(+), 81 deletions(-) diff --git a/terraform/environments/cooker/main.tf b/terraform/environments/cooker/main.tf index 276faf73733..d71e54fd5a9 100644 --- a/terraform/environments/cooker/main.tf +++ b/terraform/environments/cooker/main.tf @@ -9,20 +9,8 @@ locals { business_unit = var.networking[0].business-unit region = "eu-west-2" - - # autoscaling_schedules_default = { - # "scale_up" = { - # recurrence = "0 7 * * Mon-Fri" - # } - # "scale_down" = { - # desired_capacity = 0 - # recurrence = "0 19 * * Mon-Fri" - # } - # } - instance = { disable_api_termination = false - instance_type = "t3a.small" key_name = try(aws_key_pair.ec2-user.key_name) monitoring = false metadata_options_http_tokens = "required" @@ -32,44 +20,21 @@ locals { ec2_test = { tags = { - component = "test" - } - - user_data_cloud_init = { - args = { - lifecycle_hook_name = "ready-hook" - branch = "main" - ansible_repo = "modernisation-platform-configuration-management" - ansible_repo_basedir = "ansible" - ansible_args = "--tags ec2provision" - } - scripts = [ - "install-ssm-agent.sh.tftpl", - "ansible-ec2provision.sh.tftpl", - "post-ec2provision.sh.tftpl" - ] + component = "example-ec2-build-using-module" } route53_records = { - create_internal_record = true + create_internal_record = false create_external_record = false } - # user can manually increase the desired capacity to 1 via CLI/console - # to create an instance - # autoscaling_group = { - # desired_capacity = 0 - # max_size = 2 - # min_size = 0 - # } - - ec2_test_instances = { + ec2_instances = { # Remove data.aws_kms_key from cmk.tf once the NDH servers are removed - example-test-1 = { + example-1 = { tags = { server-type = "private" - description = "EC2_1" + description = "ec2-example-1" monitored = false os-type = "Linux" component = "ndh" @@ -82,12 +47,19 @@ locals { ami_owner = "137112412989" subnet_id = data.aws_subnet.private_subnets_a.id availability_zone = "eu-west-2a" + instance_type = "t3.small" + user_data = <