-
Notifications
You must be signed in to change notification settings - Fork 9.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
r/aws_launch_template: Fix various bugs #4321
Changes from all commits
72512d3
2ff8a5d
42a1b86
a1c4471
8bd25a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1751,8 +1751,8 @@ func validateLaunchTemplateName(v interface{}, k string) (ws []string, errors [] | |
errors = append(errors, fmt.Errorf("%q cannot be longer than 99 characters, name is limited to 125", k)) | ||
} else if !strings.HasSuffix(k, "prefix") && len(value) > 125 { | ||
errors = append(errors, fmt.Errorf("%q cannot be longer than 125 characters", k)) | ||
} else if !regexp.MustCompile(`^[0-9a-zA-Z()./_]+$`).MatchString(value) { | ||
errors = append(errors, fmt.Errorf("%q can only alphanumeric characters and ()./_ symbols", k)) | ||
} else if !regexp.MustCompile(`^[0-9a-zA-Z()./_\-]+$`).MatchString(value) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding a dash here looks good according to the EC2 API documentation: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateLaunchTemplate.html
|
||
errors = append(errors, fmt.Errorf("%q can only alphanumeric characters and ()./_- symbols", k)) | ||
} | ||
return | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,16 +10,24 @@ description: |- | |
|
||
Provides an EC2 launch template resource. Can be used to create instances or auto scaling groups. | ||
|
||
-> **Note:** All arguments are optional except for either `name`, or `name_prefix`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm curious why this was removed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As noted in the commit message, terraform will generate a name if the name is missing. This is also noted in the description of the attribute:
|
||
|
||
## Example Usage | ||
|
||
```hcl | ||
resource "aws_launch_template" "foo" { | ||
name = "foo" | ||
|
||
block_device_mappings { | ||
device_name = "test" | ||
# to change the type or size of the root volume, override the ami's root device name | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should add this helper information to the |
||
# you can figure this out based on the ami id by running: | ||
# aws ec2 describe-images --region us-west-2 --image-id ami-4e79ed36 | ||
device_name = "/dev/sda1" | ||
ebs { | ||
volume_size = 20 | ||
} | ||
} | ||
|
||
block_device_mappings { | ||
device_name = "/dev/xvdb" | ||
} | ||
|
||
credit_specification { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An acceptance test implementing this part of the resource would've caught this. I'll add one.