-
Notifications
You must be signed in to change notification settings - Fork 21
feat: Update CfnCluster with flex support #494
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,7 +38,7 @@ npx projen test | |
|
|
||
| ## Testing the resource in a CFN stack: | ||
| 1. Build the construct by running `npx projen build`. | ||
| 2. Navigate inside `/dist/js` and copy the`.tgz` file. You will use this in the next steps. | ||
| 2. It will generate a `.tgz` file in `dist/js` that we will reference later. | ||
| 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. | ||
| 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)): | ||
| ``` | ||
|
|
@@ -48,10 +48,12 @@ cdk init app --language typescript | |
| # build the app: | ||
| npm run build | ||
| ``` | ||
| 4. Copy the .tgz file from step #2 inside the node_modules folder in your CDK test app. | ||
| 4. Add a reference to the previous file in the `dependencies` section in `package.json` instead of using a published version, for example: | ||
| ``` | ||
| "awscdk-resources-mongodbatlas": "file:../dist/js/[email protected]" | ||
| ``` | ||
| 5. Import your CDK construct in a testing project. | ||
| 6. Use the construct in your app with appropriate parameters. | ||
| - [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. | ||
|
Member
Author
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. leftover |
||
| 7. Build your app again. | ||
|
|
||
| #### Create a stack: | ||
|
|
@@ -79,4 +81,4 @@ cdk deploy | |
| 2. Stack **Outputs** should show required data correctly. | ||
| 3. **Create** - Stack should complete successfully and resource should be created and correctly configured in Atlas account. | ||
| 4. **Update** - Stack should complete successfully and resource should be updated and correctly configured in Atlas account. | ||
| 5. **Delete** - Stack should complete successfully and resource should be deleted from your Atlas account. | ||
| 5. **Delete** - Stack should complete successfully and resource should be deleted from your Atlas account. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -90,6 +90,25 @@ const clusterRes = new CfnCluster(this, 'ClusterResource', { | |
|
|
||
| ``` | ||
|
|
||
| You can also create a flex cluster using CfnCluster, for example: | ||
|
Member
Author
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. example of creating a flex cluster with CfnCluster so docs team can update this README file to reference it |
||
| ```ts | ||
| import { CfnCluster, AdvancedRegionConfigProviderName } from 'awscdk-resources-mongodbatlas'; | ||
|
|
||
| const flexClusterRes = new CfnCluster(this, 'FlexClusterResource', { | ||
| name: atlasProps.clusterName, | ||
| projectId: projectRes.attrId, | ||
| profile: atlasProps.profile, | ||
| replicationSpecs: [{ | ||
| advancedRegionConfigs: [{ | ||
| regionName: atlasProps.region, | ||
| providerName: AdvancedRegionConfigProviderName.FLEX, | ||
| backingProviderName: "AWS", | ||
| priority: 7, | ||
| }] | ||
| }] | ||
| }); | ||
| ``` | ||
|
|
||
| ## Feedback | ||
|
|
||
| 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 | |
|
|
||
| ## License | ||
|
|
||
| Distributed under the Apache-2.0 License. | ||
| Distributed under the Apache-2.0 License. | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
I think this is better and you can do changes in our provider and generate the file again without having to copy it over and over again