-
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
feat(elasticsearch): graduate to stable 🚀 #13900
Merged
Merged
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6e95523
integ test
iliapolo f1f699b
standardize vpc configuration
iliapolo ead139e
one more test
iliapolo edeac4a
some doc changes
iliapolo a59faac
fix typo in metric name
iliapolo 6374871
Merge branch 'master' into epolon/graduate-elasticsearch
iliapolo 161ad1c
bump stability
iliapolo 1371cf8
Merge branch 'master' into epolon/graduate-elasticsearch
mergify[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ import '@aws-cdk/assert/jest'; | |
import * as assert from '@aws-cdk/assert'; | ||
import * as acm from '@aws-cdk/aws-certificatemanager'; | ||
import { Metric, Statistic } from '@aws-cdk/aws-cloudwatch'; | ||
import { Subnet, Vpc, EbsDeviceVolumeType } from '@aws-cdk/aws-ec2'; | ||
import { Vpc, EbsDeviceVolumeType, SecurityGroup } from '@aws-cdk/aws-ec2'; | ||
import * as iam from '@aws-cdk/aws-iam'; | ||
import * as kms from '@aws-cdk/aws-kms'; | ||
import * as logs from '@aws-cdk/aws-logs'; | ||
|
@@ -30,6 +30,84 @@ const readWriteActions = [ | |
...writeActions, | ||
]; | ||
|
||
test('connections throws if domain is placed inside a vpc', () => { | ||
|
||
expect(() => { | ||
new Domain(stack, 'Domain', { | ||
version: ElasticsearchVersion.V7_1, | ||
}).connections; | ||
}).toThrowError("Connections are only available on VPC enabled domains. Use the 'vpc' property to place a domain inside a VPC"); | ||
}); | ||
|
||
test('subnets and security groups can be provided when vpc is used', () => { | ||
|
||
const vpc = new Vpc(stack, 'Vpc'); | ||
const securityGroup = new SecurityGroup(stack, 'CustomSecurityGroup', { | ||
vpc, | ||
}); | ||
const domain = new Domain(stack, 'Domain', { | ||
version: ElasticsearchVersion.V7_9, | ||
vpc, | ||
vpcSubnets: [{ subnets: [vpc.privateSubnets[0]] }], | ||
securityGroups: [securityGroup], | ||
}); | ||
|
||
expect(domain.connections.securityGroups[0].securityGroupId).toEqual(securityGroup.securityGroupId); | ||
expect(stack).toHaveResource('AWS::Elasticsearch::Domain', { | ||
VPCOptions: { | ||
SecurityGroupIds: [ | ||
{ | ||
'Fn::GetAtt': [ | ||
'CustomSecurityGroupE5E500E5', | ||
'GroupId', | ||
], | ||
}, | ||
], | ||
SubnetIds: [ | ||
{ | ||
Ref: 'VpcPrivateSubnet1Subnet536B997A', | ||
}, | ||
], | ||
}, | ||
}); | ||
|
||
}); | ||
|
||
test('default subnets and security group when vpc is used', () => { | ||
|
||
const vpc = new Vpc(stack, 'Vpc'); | ||
const domain = new Domain(stack, 'Domain', { | ||
version: ElasticsearchVersion.V7_9, | ||
vpc, | ||
}); | ||
|
||
expect(stack.resolve(domain.connections.securityGroups[0].securityGroupId)).toEqual({ 'Fn::GetAtt': ['DomainSecurityGroup48AA5FD6', 'GroupId'] }); | ||
expect(stack).toHaveResource('AWS::Elasticsearch::Domain', { | ||
VPCOptions: { | ||
SecurityGroupIds: [ | ||
{ | ||
'Fn::GetAtt': [ | ||
'DomainSecurityGroup48AA5FD6', | ||
'GroupId', | ||
], | ||
}, | ||
], | ||
SubnetIds: [ | ||
{ | ||
Ref: 'VpcPrivateSubnet1Subnet536B997A', | ||
}, | ||
{ | ||
Ref: 'VpcPrivateSubnet2Subnet3788AAA1', | ||
}, | ||
{ | ||
Ref: 'VpcPrivateSubnet3SubnetF258B56E', | ||
}, | ||
], | ||
}, | ||
}); | ||
|
||
}); | ||
|
||
test('default removalpolicy is retain', () => { | ||
new Domain(stack, 'Domain', { | ||
version: ElasticsearchVersion.V7_1, | ||
|
@@ -1150,24 +1228,17 @@ describe('custom endpoints', () => { | |
describe('custom error responses', () => { | ||
|
||
test('error when availabilityZoneCount does not match vpcOptions.subnets length', () => { | ||
const vpc = new Vpc(stack, 'Vpc'); | ||
const vpc = new Vpc(stack, 'Vpc', { | ||
maxAzs: 1, | ||
}); | ||
|
||
expect(() => new Domain(stack, 'Domain', { | ||
version: ElasticsearchVersion.V7_4, | ||
zoneAwareness: { | ||
enabled: true, | ||
availabilityZoneCount: 2, | ||
}, | ||
vpcOptions: { | ||
subnets: [ | ||
new Subnet(stack, 'Subnet', { | ||
availabilityZone: 'testaz', | ||
cidrBlock: vpc.vpcCidrBlock, | ||
vpcId: vpc.vpcId, | ||
}), | ||
], | ||
securityGroups: [], | ||
}, | ||
vpc, | ||
})).toThrow(/you need to provide a subnet for each AZ you are using/); | ||
}); | ||
|
||
|
@@ -1357,31 +1428,7 @@ describe('custom error responses', () => { | |
|
||
expect(() => new Domain(stack, 'Domain1', { | ||
version: ElasticsearchVersion.V7_4, | ||
vpcOptions: { | ||
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 whole config wasn't really needed to assert the test, which validates the |
||
subnets: [ | ||
new Subnet(stack, 'Subnet1', { | ||
availabilityZone: 'testaz1', | ||
cidrBlock: vpc.vpcCidrBlock, | ||
vpcId: vpc.vpcId, | ||
}), | ||
new Subnet(stack, 'Subnet2', { | ||
availabilityZone: 'testaz2', | ||
cidrBlock: vpc.vpcCidrBlock, | ||
vpcId: vpc.vpcId, | ||
}), | ||
new Subnet(stack, 'Subnet3', { | ||
availabilityZone: 'testaz3', | ||
cidrBlock: vpc.vpcCidrBlock, | ||
vpcId: vpc.vpcId, | ||
}), | ||
new Subnet(stack, 'Subnet4', { | ||
availabilityZone: 'testaz4', | ||
cidrBlock: vpc.vpcCidrBlock, | ||
vpcId: vpc.vpcId, | ||
}), | ||
], | ||
securityGroups: [], | ||
}, | ||
vpc, | ||
zoneAwareness: { | ||
availabilityZoneCount: 4, | ||
}, | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Simpler way to enforce a single AZ.