Skip to content

Commit

Permalink
fix(ec2): enable set throughput param to CfnVolume (#24118)
Browse files Browse the repository at this point in the history
## EC2.Volume.throughput does not get passed on into CFN

The throughput parameter of the Ec2.Volume class (L2 Construct) was not set to the CfnVolume parameter as described in #24107

Fixed it so that the value is set.

Closes #24107 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
bun913 authored Feb 12, 2023
1 parent 1a28d3d commit 32781f8
Show file tree
Hide file tree
Showing 19 changed files with 793 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-ec2/lib/volume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ export class Volume extends VolumeBase {
multiAttachEnabled: props.enableMultiAttach ?? false,
size: props.size?.toGibibytes({ rounding: SizeRoundingBehavior.FAIL }),
snapshotId: props.snapshotId,
throughput: props.throughput,
volumeType: props.volumeType ?? EbsDeviceVolumeType.GENERAL_PURPOSE_SSD,
});
resource.applyRemovalPolicy(props.removalPolicy);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": "30.0.0",
"files": {
"21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": {
"source": {
"path": "VolumeTestDefaultTestDeployAssert896AAE82.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
}
},
"dockerImages": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"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."
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": "30.0.0",
"files": {
"d505fb8b23ebfd0467ebfb179ba7b56714072b4f413d1ee2c2a9465b284985ef": {
"source": {
"path": "aws-cdk-ec2-volume-1.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "d505fb8b23ebfd0467ebfb179ba7b56714072b4f413d1ee2c2a9465b284985ef.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
}
},
"dockerImages": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"Resources": {
"TestVolume24F725A4": {
"Type": "AWS::EC2::Volume",
"Properties": {
"AvailabilityZone": "us-east-1a",
"MultiAttachEnabled": false,
"Size": 1,
"Throughput": 200,
"VolumeType": "gp3"
},
"UpdateReplacePolicy": "Retain",
"DeletionPolicy": "Retain"
}
},
"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."
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"30.0.0"}
12 changes: 12 additions & 0 deletions packages/@aws-cdk/aws-ec2/test/integ.volume.js.snapshot/integ.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": "30.0.0",
"testCases": {
"VolumeTest/DefaultTest": {
"stacks": [
"aws-cdk-ec2-volume-1"
],
"assertionStack": "VolumeTest/DefaultTest/DeployAssert",
"assertionStackName": "VolumeTestDefaultTestDeployAssert896AAE82"
}
}
}
111 changes: 111 additions & 0 deletions packages/@aws-cdk/aws-ec2/test/integ.volume.js.snapshot/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
{
"version": "30.0.0",
"artifacts": {
"aws-cdk-ec2-volume-1.assets": {
"type": "cdk:asset-manifest",
"properties": {
"file": "aws-cdk-ec2-volume-1.assets.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version"
}
},
"aws-cdk-ec2-volume-1": {
"type": "aws:cloudformation:stack",
"environment": "aws://unknown-account/unknown-region",
"properties": {
"templateFile": "aws-cdk-ec2-volume-1.template.json",
"validateOnSynth": false,
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/d505fb8b23ebfd0467ebfb179ba7b56714072b4f413d1ee2c2a9465b284985ef.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
"additionalDependencies": [
"aws-cdk-ec2-volume-1.assets"
],
"lookupRole": {
"arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}",
"requiresBootstrapStackVersion": 8,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version"
}
},
"dependencies": [
"aws-cdk-ec2-volume-1.assets"
],
"metadata": {
"/aws-cdk-ec2-volume-1/TestVolume/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "TestVolume24F725A4"
}
],
"/aws-cdk-ec2-volume-1/BootstrapVersion": [
{
"type": "aws:cdk:logicalId",
"data": "BootstrapVersion"
}
],
"/aws-cdk-ec2-volume-1/CheckBootstrapVersion": [
{
"type": "aws:cdk:logicalId",
"data": "CheckBootstrapVersion"
}
]
},
"displayName": "aws-cdk-ec2-volume-1"
},
"VolumeTestDefaultTestDeployAssert896AAE82.assets": {
"type": "cdk:asset-manifest",
"properties": {
"file": "VolumeTestDefaultTestDeployAssert896AAE82.assets.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version"
}
},
"VolumeTestDefaultTestDeployAssert896AAE82": {
"type": "aws:cloudformation:stack",
"environment": "aws://unknown-account/unknown-region",
"properties": {
"templateFile": "VolumeTestDefaultTestDeployAssert896AAE82.template.json",
"validateOnSynth": false,
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
"additionalDependencies": [
"VolumeTestDefaultTestDeployAssert896AAE82.assets"
],
"lookupRole": {
"arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}",
"requiresBootstrapStackVersion": 8,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version"
}
},
"dependencies": [
"VolumeTestDefaultTestDeployAssert896AAE82.assets"
],
"metadata": {
"/VolumeTest/DefaultTest/DeployAssert/BootstrapVersion": [
{
"type": "aws:cdk:logicalId",
"data": "BootstrapVersion"
}
],
"/VolumeTest/DefaultTest/DeployAssert/CheckBootstrapVersion": [
{
"type": "aws:cdk:logicalId",
"data": "CheckBootstrapVersion"
}
]
},
"displayName": "VolumeTest/DefaultTest/DeployAssert"
},
"Tree": {
"type": "cdk:tree",
"properties": {
"file": "tree.json"
}
}
}
}
Loading

0 comments on commit 32781f8

Please sign in to comment.