From f4ca781ef22ddea0a9d9fa33b10a424e776476ad Mon Sep 17 00:00:00 2001 From: Michal Wieczorek Date: Thu, 28 May 2020 09:36:53 +0200 Subject: [PATCH 1/3] Add tags to aws_launch_template --- main.tf | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/main.tf b/main.tf index 9e62701..f1441e8 100755 --- a/main.tf +++ b/main.tf @@ -54,6 +54,17 @@ resource "aws_launch_template" "bastion-service-host" { lifecycle { create_before_destroy = true } + + tags = var.tags + + tag_specifications { + resource_type = "instance" + tags = var.tags +} + tag_specifications { + resource_type = "volume" + tags = var.tags + } } ####################################################### From 5b060d6f76ea9fda17da9c090fd936a809d1406a Mon Sep 17 00:00:00 2001 From: Michal Wieczorek Date: Thu, 28 May 2020 09:38:57 +0200 Subject: [PATCH 2/3] Fix aws_launch_template use base64 for userdata template use names for iam_instance_profile instead of arns --- main.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.tf b/main.tf index f1441e8..aac8fab 100755 --- a/main.tf +++ b/main.tf @@ -31,13 +31,13 @@ resource "aws_launch_template" "bastion-service-host" { image_id = local.bastion_ami_id instance_type = var.bastion_instance_type key_name = var.bastion_service_host_key_name - user_data = data.template_cloudinit_config.config.rendered + user_data = base64encode(data.template_cloudinit_config.config.rendered) iam_instance_profile { name = element( concat( - aws_iam_instance_profile.bastion_service_assume_role_profile.*.arn, - aws_iam_instance_profile.bastion_service_profile.*.arn, + aws_iam_instance_profile.bastion_service_assume_role_profile.*.name, + aws_iam_instance_profile.bastion_service_profile.*.name, ), 0, ) From d0dfbd45ecb5cec9c3000f068b41b8222b318c89 Mon Sep 17 00:00:00 2001 From: Michal Wieczorek Date: Thu, 28 May 2020 09:39:47 +0200 Subject: [PATCH 3/3] Fix aws_autoscaling_group - remove doubled $ from version --- main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index aac8fab..8d74d04 100755 --- a/main.tf +++ b/main.tf @@ -60,7 +60,7 @@ resource "aws_launch_template" "bastion-service-host" { tag_specifications { resource_type = "instance" tags = var.tags -} + } tag_specifications { resource_type = "volume" tags = var.tags @@ -97,7 +97,7 @@ resource "aws_autoscaling_group" "bastion-service" { launch_template { launch_template_specification { launch_template_id = aws_launch_template.bastion-service-host.id - version = "$$Latest" + version = "$Latest" } override {