From b19fd5eaaaf75222bfbc344a264edcf604dcf059 Mon Sep 17 00:00:00 2001 From: Nikita Pivkin Date: Mon, 18 Dec 2023 22:19:25 +0700 Subject: [PATCH] feat(ec2): name support for the launch template --- pkg/providers/aws/ec2/launch.go | 1 + pkg/terraform/presets.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/pkg/providers/aws/ec2/launch.go b/pkg/providers/aws/ec2/launch.go index 493950a98..29b2fd390 100644 --- a/pkg/providers/aws/ec2/launch.go +++ b/pkg/providers/aws/ec2/launch.go @@ -16,6 +16,7 @@ type LaunchConfiguration struct { type LaunchTemplate struct { Metadata defsecTypes.Metadata + Name defsecTypes.StringValue Instance } diff --git a/pkg/terraform/presets.go b/pkg/terraform/presets.go index 58879d809..6dff625a2 100644 --- a/pkg/terraform/presets.go +++ b/pkg/terraform/presets.go @@ -4,6 +4,7 @@ import ( "fmt" "strings" + "github.com/google/uuid" "github.com/zclconf/go-cty/cty" ) @@ -22,6 +23,9 @@ func createPresetValues(b *Block) map[string]cty.Value { switch b.TypeLabel() { case "aws_iam_policy_document": presets["json"] = cty.StringVal(b.ID()) + // If the user leaves the name blank, Terraform will automatically generate a unique name + case "aws_launch_template": + presets["name"] = cty.StringVal(uuid.New().String()) } return presets