Skip to content

Commit 07acac2

Browse files
committed
Revert "feat(rds): custom security groups for OptionGroups"
This reverts commit ea1072d.
1 parent ea1072d commit 07acac2

File tree

3 files changed

+7
-86
lines changed

3 files changed

+7
-86
lines changed

packages/@aws-cdk/aws-rds/README.md

-24
Original file line numberDiff line numberDiff line change
@@ -324,27 +324,3 @@ const instance = new rds.DatabaseInstance(this, 'Instance', {
324324
// ...
325325
});
326326
```
327-
328-
### Option Groups
329-
330-
Some DB engines offer additional features that make it easier to manage data and databases, and to provide additional security for your database.
331-
Amazon RDS uses option groups to enable and configure these features. An option group can specify features, called options,
332-
that are available for a particular Amazon RDS DB instance.
333-
334-
```ts
335-
const vpc: ec2.IVpc = ...;
336-
const securityGroup: ec2.ISecurityGroup = ...;
337-
new rds.OptionGroup(stack, 'Options', {
338-
engine: DatabaseInstanceEngine.oracleSe({
339-
version: OracleLegacyEngineVersion.VER_11_2,
340-
}),
341-
configurations: [
342-
{
343-
name: 'OEM',
344-
port: 5500,
345-
vpc,
346-
securityGroups: [securityGroup], // Optional - a default group will be created if not provided.
347-
},
348-
],
349-
});
350-
```

packages/@aws-cdk/aws-rds/lib/option-group.ts

+6-16
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,6 @@ export interface OptionConfiguration {
5353
* @default - no VPC
5454
*/
5555
readonly vpc?: ec2.IVpc;
56-
57-
/**
58-
* Optional list of security groups to use for this option, if `vpc` is specified.
59-
* If no groups are provided, a default one will be created.
60-
*
61-
* @default - a default group will be created if `port` or `vpc` are specified.
62-
*/
63-
readonly securityGroups?: ec2.ISecurityGroup[];
6456
}
6557

6658
/**
@@ -143,22 +135,20 @@ export class OptionGroup extends Resource implements IOptionGroup {
143135
throw new Error('`port` and `vpc` must be specified together.');
144136
}
145137

146-
const securityGroups = config.securityGroups && config.securityGroups.length > 0
147-
? config.securityGroups
148-
: [new ec2.SecurityGroup(this, `SecurityGroup${config.name}`, {
149-
description: `Security group for ${config.name} option`,
150-
vpc: config.vpc,
151-
})];
138+
const securityGroup = new ec2.SecurityGroup(this, `SecurityGroup${config.name}`, {
139+
description: `Security group for ${config.name} option`,
140+
vpc: config.vpc,
141+
});
152142

153143
this.optionConnections[config.name] = new ec2.Connections({
154-
securityGroups: securityGroups,
144+
securityGroups: [securityGroup],
155145
defaultPort: ec2.Port.tcp(config.port),
156146
});
157147

158148
configuration = {
159149
...configuration,
160150
port: config.port,
161-
vpcSecurityGroupMemberships: securityGroups.map(sg => sg.securityGroupId),
151+
vpcSecurityGroupMemberships: [securityGroup.securityGroupId],
162152
};
163153
}
164154

packages/@aws-cdk/aws-rds/test/test.option-group.ts

+1-46
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export = {
3636
test.done();
3737
},
3838

39-
'option group with new security group'(test: Test) {
39+
'option group with security groups'(test: Test) {
4040
// GIVEN
4141
const stack = new cdk.Stack();
4242
const vpc = new ec2.Vpc(stack, 'VPC');
@@ -96,51 +96,6 @@ export = {
9696
test.done();
9797
},
9898

99-
'option group with existing security group'(test: Test) {
100-
// GIVEN
101-
const stack = new cdk.Stack();
102-
const vpc = new ec2.Vpc(stack, 'VPC');
103-
104-
// WHEN
105-
const securityGroup = new ec2.SecurityGroup(stack, 'CustomSecurityGroup', { vpc });
106-
new OptionGroup(stack, 'Options', {
107-
engine: DatabaseInstanceEngine.oracleSe({
108-
version: OracleLegacyEngineVersion.VER_11_2,
109-
}),
110-
configurations: [
111-
{
112-
name: 'OEM',
113-
port: 1158,
114-
vpc,
115-
securityGroups: [securityGroup],
116-
},
117-
],
118-
});
119-
120-
// THEN
121-
expect(stack).to(haveResource('AWS::RDS::OptionGroup', {
122-
EngineName: 'oracle-se',
123-
MajorEngineVersion: '11.2',
124-
OptionGroupDescription: 'Option group for oracle-se 11.2',
125-
OptionConfigurations: [
126-
{
127-
OptionName: 'OEM',
128-
Port: 1158,
129-
VpcSecurityGroupMemberships: [
130-
{
131-
'Fn::GetAtt': [
132-
'CustomSecurityGroupE5E500E5',
133-
'GroupId',
134-
],
135-
},
136-
],
137-
},
138-
],
139-
}));
140-
141-
test.done();
142-
},
143-
14499
'throws when using an option with port and no vpc'(test: Test) {
145100
// GIVEN
146101
const stack = new cdk.Stack();

0 commit comments

Comments
 (0)