Skip to content

Commit aed9178

Browse files
authored
feat: Update CfnCluster with flex support (#494)
1 parent def815b commit aed9178

File tree

4 files changed

+38
-7
lines changed

4 files changed

+38
-7
lines changed

API.md

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

TESTING.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ npx projen test
3838

3939
## Testing the resource in a CFN stack:
4040
1. Build the construct by running `npx projen build`.
41-
2. Navigate inside `/dist/js` and copy the`.tgz` file. You will use this in the next steps.
41+
2. It will generate a `.tgz` file in `dist/js` that we will reference later.
4242
3. Create a CDK test app: We will be using a CDK app to test our construct by using the app to create, update and delete AWS CloudFormation stacks.
4343
Create the CDK app by running the following in a terminal: ([refer AWS walkthrough for details](https://docs.aws.amazon.com/cdk/v2/guide/hello_world.html#hello_world_tutorial_create_app)):
4444
```
@@ -48,10 +48,12 @@ cdk init app --language typescript
4848
# build the app:
4949
npm run build
5050
```
51-
4. Copy the .tgz file from step #2 inside the node_modules folder in your CDK test app.
51+
4. Add a reference to the previous file in the `dependencies` section in `package.json` instead of using a published version, for example:
52+
```
53+
"awscdk-resources-mongodbatlas": "file:../dist/js/[email protected]"
54+
```
5255
5. Import your CDK construct in a testing project.
5356
6. Use the construct in your app with appropriate parameters.
54-
- [Optional, not applicable for L2/L3 constructs] If you need help getting test parameters to use with the constructs you can use `./cfn-resources/cfn-testing-helper.sh`. Refer “Getting test parameters” for creating a stack here for details.
5557
7. Build your app again.
5658

5759
#### Create a stack:
@@ -79,4 +81,4 @@ cdk deploy
7981
2. Stack **Outputs** should show required data correctly.
8082
3. **Create** - Stack should complete successfully and resource should be created and correctly configured in Atlas account.
8183
4. **Update** - Stack should complete successfully and resource should be updated and correctly configured in Atlas account.
82-
5. **Delete** - Stack should complete successfully and resource should be deleted from your Atlas account.
84+
5. **Delete** - Stack should complete successfully and resource should be deleted from your Atlas account.

src/l1-resources/cluster/README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,25 @@ const clusterRes = new CfnCluster(this, 'ClusterResource', {
9090

9191
```
9292

93+
You can also create a flex cluster using CfnCluster, for example:
94+
```ts
95+
import { CfnCluster, AdvancedRegionConfigProviderName } from 'awscdk-resources-mongodbatlas';
96+
97+
const flexClusterRes = new CfnCluster(this, 'FlexClusterResource', {
98+
name: atlasProps.clusterName,
99+
projectId: projectRes.attrId,
100+
profile: atlasProps.profile,
101+
replicationSpecs: [{
102+
advancedRegionConfigs: [{
103+
regionName: atlasProps.region,
104+
providerName: AdvancedRegionConfigProviderName.FLEX,
105+
backingProviderName: "AWS",
106+
priority: 7,
107+
}]
108+
}]
109+
});
110+
```
111+
93112
## Feedback
94113

95114
This library is auto-generated and published to all supported programming languages by the [cdklabs/cdk-cloudformation] project based on the API schema published for `MongoDB::Atlas::Cluster`.
@@ -102,4 +121,4 @@ This library is auto-generated and published to all supported programming langua
102121

103122
## License
104123

105-
Distributed under the Apache-2.0 License.
124+
Distributed under the Apache-2.0 License.

src/l1-resources/cluster/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,14 +579,14 @@ export interface Tag {
579579
*
580580
* @schema tag#Key
581581
*/
582-
readonly key?: string;
582+
readonly key: string;
583583

584584
/**
585585
* Variable that belongs to the set of the tag. For example, production in the environment : production tag.
586586
*
587587
* @schema tag#Value
588588
*/
589-
readonly value?: string;
589+
readonly value: string;
590590
}
591591

592592
/**
@@ -747,6 +747,8 @@ export enum AdvancedRegionConfigProviderName {
747747
AZURE = "AZURE",
748748
/** TENANT */
749749
TENANT = "TENANT",
750+
/** FLEX */
751+
FLEX = "FLEX",
750752
}
751753

752754
/**

0 commit comments

Comments
 (0)