-
Notifications
You must be signed in to change notification settings - Fork 4k
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
fix(autoscaling): error not thrown when associatePublicIpAddress is set to false when specifying launchTemplate #21714
Changes from 1 commit
84161a8
fb35b5e
1bf056c
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 |
---|---|---|
|
@@ -80,6 +80,8 @@ export interface CommonAutoScalingGroupProps { | |
/** | ||
* Name of SSH keypair to grant access to instances | ||
* | ||
* Cannot specify this property when `launchTemplate` or `mixedInstancesPolicy` are specified | ||
* | ||
* @default - No SSH access will be possible. | ||
*/ | ||
readonly keyName?: string; | ||
|
@@ -190,6 +192,8 @@ export interface CommonAutoScalingGroupProps { | |
* Whether instances in the Auto Scaling Group should have public | ||
* IP addresses associated with them. | ||
* | ||
* Cannot specify this property when `launchTemplate` or `mixedInstancesPolicy` are specified | ||
* | ||
* @default - Use subnet setting. | ||
*/ | ||
readonly associatePublicIpAddress?: boolean; | ||
|
@@ -198,6 +202,8 @@ export interface CommonAutoScalingGroupProps { | |
* The maximum hourly price (in USD) to be paid for any Spot Instance launched to fulfill the request. Spot Instances are | ||
* launched when the price you specify exceeds the current Spot market price. | ||
* | ||
* Cannot specify this property when `launchTemplate` or `mixedInstancesPolicy` are specified | ||
* | ||
* @default none | ||
*/ | ||
readonly spotPrice?: string; | ||
|
@@ -217,6 +223,8 @@ export interface CommonAutoScalingGroupProps { | |
* You can use block device mappings to specify additional EBS volumes or | ||
* instance store volumes to attach to an instance when it is launched. | ||
* | ||
* Cannot specify this property when `launchTemplate` or `mixedInstancesPolicy` are specified | ||
* | ||
* @see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html | ||
* | ||
* @default - Uses the block device mapping of the AMI | ||
|
@@ -243,6 +251,8 @@ export interface CommonAutoScalingGroupProps { | |
* When detailed monitoring is enabled, Amazon CloudWatch generates metrics every minute and your account | ||
* is charged a fee. When you disable detailed monitoring, CloudWatch generates metrics every 5 minutes. | ||
* | ||
* Cannot specify this property when `launchTemplate` or `mixedInstancesPolicy` are specified | ||
* | ||
* @see https://docs.aws.amazon.com/autoscaling/latest/userguide/as-instance-monitoring.html#enable-as-instance-metrics | ||
* | ||
* @default - Monitoring.DETAILED | ||
|
@@ -543,7 +553,7 @@ export interface AutoScalingGroupProps extends CommonAutoScalingGroupProps { | |
/** | ||
* Type of instance to launch | ||
* | ||
* `launchTemplate` must not be specified when this property is specified. | ||
* Cannot specify this property when `launchTemplate` or `mixedInstancesPolicy` are specified | ||
* | ||
* @default - Do not provide any instance type | ||
*/ | ||
|
@@ -552,7 +562,7 @@ export interface AutoScalingGroupProps extends CommonAutoScalingGroupProps { | |
/** | ||
* AMI to launch | ||
* | ||
* `launchTemplate` must not be specified when this property is specified. | ||
* Cannot specify this property when `launchTemplate` or `mixedInstancesPolicy` are specified | ||
* | ||
* @default - Do not provide any machine image | ||
*/ | ||
|
@@ -561,7 +571,7 @@ export interface AutoScalingGroupProps extends CommonAutoScalingGroupProps { | |
/** | ||
* Security group to launch the instances in. | ||
* | ||
* `launchTemplate` must not be specified when this property is specified. | ||
* Cannot specify this property when `launchTemplate` or `mixedInstancesPolicy` are specified | ||
* | ||
* @default - A SecurityGroup will be created if none is specified. | ||
*/ | ||
|
@@ -572,7 +582,7 @@ export interface AutoScalingGroupProps extends CommonAutoScalingGroupProps { | |
* | ||
* The UserData may still be mutated after creation. | ||
* | ||
* `launchTemplate` must not be specified when this property is specified. | ||
* Cannot specify this property when `launchTemplate` or `mixedInstancesPolicy` are specified | ||
* | ||
* @default - A UserData object appropriate for the MachineImage's | ||
* Operating System is created. | ||
|
@@ -584,7 +594,7 @@ export interface AutoScalingGroupProps extends CommonAutoScalingGroupProps { | |
* | ||
* The role must be assumable by the service principal `ec2.amazonaws.com`: | ||
* | ||
* `launchTemplate` must not be specified when this property is specified. | ||
* Cannot specify this property when `launchTemplate` or `mixedInstancesPolicy` are specified | ||
* | ||
* @example | ||
* | ||
|
@@ -1523,7 +1533,7 @@ export class AutoScalingGroup extends AutoScalingGroupBase implements | |
if (props.instanceMonitoring) { | ||
throw new Error('Setting \'instanceMonitoring\' must not be set when \'launchTemplate\' or \'mixedInstancesPolicy\' is set'); | ||
} | ||
if (props.associatePublicIpAddress) { | ||
if (props.associatePublicIpAddress || props.associatePublicIpAddress === false) { | ||
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 not sure I get why setting it to false should be an issue here. It seems like we're mishandling it somewhere else and that's where we need to apply the fix. 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. This could probably be simplified to It looks like if you specify the I think long term we should deprecate the 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. Yep, the design here isn't too great. However I'm not sure what we can do for now except ensure the error gets thrown. |
||
throw new Error('Setting \'associatePublicIpAddress\' must not be set when \'launchTemplate\' or \'mixedInstancesPolicy\' is set'); | ||
} | ||
if (props.spotPrice) { | ||
|
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.
This comment stands for each instance here (I won't repeat it because that's just kind of annoying), but I think we actually want the original style comment of: