From e5b7e0e16eda10bc59373d8720d5c35e916b2afd Mon Sep 17 00:00:00 2001 From: Max Inden Date: Thu, 17 Aug 2023 15:02:23 +0200 Subject: [PATCH] fix(perf): use `$Default` launch template (#257) Our perf terraform setup differentiates in long lived and short lived resources. On CI, our long lived resources are spun up once and our short lived resources are spun up on each CI run. From time to time we have to adjust the long lived resources. End result is a new launch template that needs to be referenced in the short lived resources by version. Next to our CI, the perf terraform setup can as well be used on personal AWS accounts. Their long lived launch template version likely doesn't match the configured launch template version of the short lived aws_instance. Instead of specifying a specific version, instruct terraform to use the default, thus supporting both our CI and personal AWS account use-case. --- perf/terraform/modules/long_lived/main.tf | 2 ++ perf/terraform/modules/short_lived/main.tf | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/perf/terraform/modules/long_lived/main.tf b/perf/terraform/modules/long_lived/main.tf index 3eb01f5..f01ac85 100644 --- a/perf/terraform/modules/long_lived/main.tf +++ b/perf/terraform/modules/long_lived/main.tf @@ -117,4 +117,6 @@ resource "aws_launch_template" "perf" { delete_on_termination = true } } + + update_default_version = true } diff --git a/perf/terraform/modules/short_lived/main.tf b/perf/terraform/modules/short_lived/main.tf index f7d058b..17782a5 100644 --- a/perf/terraform/modules/short_lived/main.tf +++ b/perf/terraform/modules/short_lived/main.tf @@ -19,7 +19,6 @@ resource "aws_instance" "perf" { launch_template { name = "perf-node" - version = "4" } key_name = aws_key_pair.perf.key_name