Skip to content
This repository has been archived by the owner on Jan 23, 2025. It is now read-only.

Commit

Permalink
feat(ec2): name support for the launch template (#1509)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikpivkin authored Jan 10, 2024
1 parent 968b8f1 commit 29e4764
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/providers/aws/ec2/launch.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type LaunchConfiguration struct {

type LaunchTemplate struct {
Metadata defsecTypes.Metadata
Name defsecTypes.StringValue
Instance
}

Expand Down
4 changes: 4 additions & 0 deletions pkg/terraform/presets.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"strings"

"github.com/google/uuid"
"github.com/zclconf/go-cty/cty"
)

Expand All @@ -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
Expand Down

0 comments on commit 29e4764

Please sign in to comment.