Skip to content

Commit

Permalink
chore(cloud9): fix integ test that cannot pass (#21561)
Browse files Browse the repository at this point in the history
This integ test cannot pass using `CONNECT_SSM`  because it requires setup of resources
ahead of time that the L1 construct does not handle. Because roles use eventual consistency, 
just adding the role to the test isn't a good solution. `CONNECT_SSH` works just fine.

A note has been added to the `ConnectionType.CONNECT_SSM` enum that a role and instance
profile must be setup beforehand if it is selected. Eventually if/when an L2 construct is created 
we should handle this setup.


----

### All Submissions:

* [ ] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
TheRealAmazonKendra authored Aug 11, 2022
1 parent d1097b5 commit ebab1cd
Show file tree
Hide file tree
Showing 15 changed files with 170 additions and 542 deletions.
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-cloud9/lib/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export enum ConnectionType {
CONNECT_SSH = 'CONNECT_SSH',
/**
* Connect through AWS Systems Manager
* When using SSM, service role and instance profile aren't automatically created.
* See https://docs.aws.amazon.com/cloud9/latest/user-guide/ec2-ssm.html#service-role-ssm
*/
CONNECT_SSM = 'CONNECT_SSM'
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"version": "20.0.0",
"files": {
"f9e7c320234302f703a47f0be7da188a1e91f7863c71a04835efd508d926216c": {
"bce46c387f7a562ced8e71e7f0c8bd1829de8aa12a8f5938bf4ccba9f3748d84": {
"source": {
"path": "C9Stack.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "f9e7c320234302f703a47f0be7da188a1e91f7863c71a04835efd508d926216c.json",
"objectKey": "bce46c387f7a562ced8e71e7f0c8bd1829de8aa12a8f5938bf4ccba9f3748d84.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,9 @@
"C9EnvF05FC3BE": {
"Type": "AWS::Cloud9::EnvironmentEC2",
"Properties": {
"InstanceType": "t2.micro",
"ConnectionType": "CONNECT_SSH",
"ImageId": "amazonlinux-2-x86_64",
"InstanceType": "t2.micro",
"Repositories": [
{
"PathComponent": "/foo",
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"17.0.0"}
{"version":"20.0.0"}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "17.0.0",
"version": "20.0.0",
"artifacts": {
"Tree": {
"type": "cdk:tree",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"id": "Tree",
"path": "Tree",
"constructInfo": {
"fqn": "@aws-cdk/core.Construct",
"version": "0.0.0"
"fqn": "constructs.Construct",
"version": "10.1.71"
}
},
"C9Stack": {
Expand Down Expand Up @@ -646,6 +646,8 @@
"aws:cdk:cloudformation:type": "AWS::Cloud9::EnvironmentEC2",
"aws:cdk:cloudformation:props": {
"instanceType": "t2.micro",
"connectionType": "CONNECT_SSH",
"imageId": "amazonlinux-2-x86_64",
"repositories": [
{
"repositoryUrl": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"Tags": [
{
"Key": "Name",
"Value": "C9Stack/VPC"
"Value": "C9ConnectionTypeStack/VPC"
}
]
}
Expand Down Expand Up @@ -42,7 +42,7 @@
},
{
"Key": "Name",
"Value": "C9Stack/VPC/PublicSubnet1"
"Value": "C9ConnectionTypeStack/VPC/PublicSubnet1"
}
]
}
Expand All @@ -56,7 +56,7 @@
"Tags": [
{
"Key": "Name",
"Value": "C9Stack/VPC/PublicSubnet1"
"Value": "C9ConnectionTypeStack/VPC/PublicSubnet1"
}
]
}
Expand Down Expand Up @@ -94,7 +94,7 @@
"Tags": [
{
"Key": "Name",
"Value": "C9Stack/VPC/PublicSubnet1"
"Value": "C9ConnectionTypeStack/VPC/PublicSubnet1"
}
]
}
Expand All @@ -114,7 +114,7 @@
"Tags": [
{
"Key": "Name",
"Value": "C9Stack/VPC/PublicSubnet1"
"Value": "C9ConnectionTypeStack/VPC/PublicSubnet1"
}
]
}
Expand Down Expand Up @@ -146,7 +146,7 @@
},
{
"Key": "Name",
"Value": "C9Stack/VPC/PublicSubnet2"
"Value": "C9ConnectionTypeStack/VPC/PublicSubnet2"
}
]
}
Expand All @@ -160,7 +160,7 @@
"Tags": [
{
"Key": "Name",
"Value": "C9Stack/VPC/PublicSubnet2"
"Value": "C9ConnectionTypeStack/VPC/PublicSubnet2"
}
]
}
Expand Down Expand Up @@ -218,7 +218,7 @@
},
{
"Key": "Name",
"Value": "C9Stack/VPC/PrivateSubnet1"
"Value": "C9ConnectionTypeStack/VPC/PrivateSubnet1"
}
]
}
Expand All @@ -232,7 +232,7 @@
"Tags": [
{
"Key": "Name",
"Value": "C9Stack/VPC/PrivateSubnet1"
"Value": "C9ConnectionTypeStack/VPC/PrivateSubnet1"
}
]
}
Expand Down Expand Up @@ -287,7 +287,7 @@
},
{
"Key": "Name",
"Value": "C9Stack/VPC/PrivateSubnet2"
"Value": "C9ConnectionTypeStack/VPC/PrivateSubnet2"
}
]
}
Expand All @@ -301,7 +301,7 @@
"Tags": [
{
"Key": "Name",
"Value": "C9Stack/VPC/PrivateSubnet2"
"Value": "C9ConnectionTypeStack/VPC/PrivateSubnet2"
}
]
}
Expand Down Expand Up @@ -335,7 +335,7 @@
"Tags": [
{
"Key": "Name",
"Value": "C9Stack/VPC"
"Value": "C9ConnectionTypeStack/VPC"
}
]
}
Expand All @@ -360,9 +360,9 @@
"C9EnvF05FC3BE": {
"Type": "AWS::Cloud9::EnvironmentEC2",
"Properties": {
"ConnectionType": "CONNECT_SSM",
"ImageId": "amazonlinux-2-x86_64",
"InstanceType": "t2.micro",
"ConnectionType": "CONNECT_SSH",
"ImageId": "amazonlinux-2-x86_64",
"Repositories": [
{
"PathComponent": "/foo",
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"17.0.0"}
{"version":"20.0.0"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
{
"version": "20.0.0",
"testCases": {
"integ.connection-type": {
"cloud-9-connection-type/DefaultTest": {
"stacks": [
"C9Stack"
"C9ConnectionTypeStack"
],
"diffAssets": false,
"stackUpdateWorkflow": true
"assertionStack": "cloud9connectiontypeDefaultTestDeployAssert401C3608"
}
},
"synthContext": {},
"enableLookups": false
}
}
Loading

0 comments on commit ebab1cd

Please sign in to comment.