Skip to content
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(ec2): WindowsVersion enum #29738

Closed
wants to merge 14 commits into from
694 changes: 694 additions & 0 deletions allowed-breaking-changes.txt
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not thrilled about adding a ton of noise to the breaking changes list, but I don't think it would safe to not list them
all individually and use something like removed:aws-cdk-lib.aws_ec2.WindowsVersion.*

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might not be required, I'm trying to have WindowsVersion become a union of two new enums instead, WindowsLatest and WindowsSpecific. Will see if JSII doesn't complain too much

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aborting this idea, it would be even messier:

/**
 * @deprecated use {@link WindowsLatestVersion} or {@link WindowsSpecificVersion} instead
 */
export const WindowsVersion = { ...WindowsLatestVersion, ...WindowsSpecificVersion };
export type WindowsVersion = typeof WindowsVersion[keyof typeof WindowsVersion];
API elements with incompatible changes:
err  - ENUM aws-cdk-lib.aws_ec2.WindowsVersion: has been removed [removed:aws-cdk-lib.aws_ec2.WindowsVersion]
err  - METHOD aws-cdk-lib.aws_ec2.MachineImage.latestWindows: argument version, takes aws-cdk-lib.aws_ec2.WindowsLatestVersion (formerly aws-cdk-lib.aws_ec2.WindowsVersion): could not find type aws-cdk-lib.aws_ec2.WindowsVersion [incompatible-argument:aws-cdk-lib.aws_ec2.MachineImage.latestWindows]
err  - INITIALIZER aws-cdk-lib.aws_ec2.WindowsImage.<initializer>: argument version, takes aws-cdk-lib.aws_ec2.WindowsLatestVersion | aws-cdk-lib.aws_ec2.WindowsSpecificVersion (formerly aws-cdk-lib.aws_ec2.WindowsVersion): none of aws-cdk-lib.aws_ec2.WindowsVersion are assignable to aws-cdk-lib.aws_ec2.WindowsLatestVersion | aws-cdk-lib.aws_ec2.WindowsSpecificVersion, could not find type aws-cdk-lib.aws_ec2.WindowsVersion, could not find type aws-cdk-lib.aws_ec2.WindowsVersion [incompatible-argument:aws-cdk-lib.aws_ec2.WindowsImage.<initializer>]

Unsurprisingly, the enum appears as being deleted, even though it retains its values and typing. The bigger issue is that I would need to introduce another breaking change by changing the type of MachineImage.latestWindows.

Removing the unusable enum values added to WindowsVersion is not really an issue for users, but requiring them to change their existing stacks would be a huge pain for basically no gain.

So we're back to the original plan of removing the newly added datestamped WindowsVersion values

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"Outputs": {
"ImageId": {
"Value": "ami-1234"
}
},
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"Default": "/cdk-bootstrap/hnb659fds/version",
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
}
},
"Rules": {
"CheckBootstrapVersion": {
"Assertions": [
{
"Assert": {
"Fn::Not": [
{
"Fn::Contains": [
[
"1",
"2",
"3",
"4",
"5"
],
{
"Ref": "BootstrapVersion"
}
]
}
]
},
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
}
]
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"Parameters": {
"SsmParameterValueawsserviceamiwindowslatestWindowsServer2016EnglishFullBaseC96584B6F00A464EAD1953AFF4B05118Parameter": {
"Type": "AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>",
"Default": "/aws/service/ami-windows-latest/Windows_Server-2016-English-Full-Base"
},
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"Default": "/cdk-bootstrap/hnb659fds/version",
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
}
},
"Outputs": {
"ImageId": {
"Value": {
"Ref": "SsmParameterValueawsserviceamiwindowslatestWindowsServer2016EnglishFullBaseC96584B6F00A464EAD1953AFF4B05118Parameter"
}
}
},
"Rules": {
"CheckBootstrapVersion": {
"Assertions": [
{
"Assert": {
"Fn::Not": [
{
"Fn::Contains": [
[
"1",
"2",
"3",
"4",
"5"
],
{
"Ref": "BootstrapVersion"
}
]
}
]
},
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
}
]
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"Outputs": {
"ImageId": {
"Value": "ami-1234"
}
},
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"Default": "/cdk-bootstrap/hnb659fds/version",
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
}
},
"Rules": {
"CheckBootstrapVersion": {
"Assertions": [
{
"Assert": {
"Fn::Not": [
{
"Fn::Contains": [
[
"1",
"2",
"3",
"4",
"5"
],
{
"Ref": "BootstrapVersion"
}
]
}
]
},
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
}
]
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"Parameters": {
"SsmParameterValueawsserviceamiwindowslatestWindowsServer2019EnglishFullBaseC96584B6F00A464EAD1953AFF4B05118Parameter": {
"Type": "AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>",
"Default": "/aws/service/ami-windows-latest/Windows_Server-2019-English-Full-Base"
},
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"Default": "/cdk-bootstrap/hnb659fds/version",
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
}
},
"Outputs": {
"ImageId": {
"Value": {
"Ref": "SsmParameterValueawsserviceamiwindowslatestWindowsServer2019EnglishFullBaseC96584B6F00A464EAD1953AFF4B05118Parameter"
}
}
},
"Rules": {
"CheckBootstrapVersion": {
"Assertions": [
{
"Assert": {
"Fn::Not": [
{
"Fn::Contains": [
[
"1",
"2",
"3",
"4",
"5"
],
{
"Ref": "BootstrapVersion"
}
]
}
]
},
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
}
]
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"Outputs": {
"ImageId": {
"Value": "ami-1234"
}
},
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"Default": "/cdk-bootstrap/hnb659fds/version",
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
}
},
"Rules": {
"CheckBootstrapVersion": {
"Assertions": [
{
"Assert": {
"Fn::Not": [
{
"Fn::Contains": [
[
"1",
"2",
"3",
"4",
"5"
],
{
"Ref": "BootstrapVersion"
}
]
}
]
},
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
}
]
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading