Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions API.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)):
```
Expand All @@ -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]"
```
Copy link
Member Author

@lantoli lantoli Sep 10, 2025

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

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.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leftover

7. Build your app again.

#### Create a stack:
Expand Down Expand Up @@ -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.
21 changes: 20 additions & 1 deletion src/l1-resources/cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,25 @@ const clusterRes = new CfnCluster(this, 'ClusterResource', {

```

You can also create a flex cluster using CfnCluster, for example:
Copy link
Member Author

Choose a reason for hiding this comment

The 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`.
Expand All @@ -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.
6 changes: 4 additions & 2 deletions src/l1-resources/cluster/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -579,14 +579,14 @@ export interface Tag {
*
* @schema tag#Key
*/
readonly key?: string;
readonly key: string;

/**
* Variable that belongs to the set of the tag. For example, production in the environment : production tag.
*
* @schema tag#Value
*/
readonly value?: string;
readonly value: string;
}

/**
Expand Down Expand Up @@ -747,6 +747,8 @@ export enum AdvancedRegionConfigProviderName {
AZURE = "AZURE",
/** TENANT */
TENANT = "TENANT",
/** FLEX */
FLEX = "FLEX",
}

/**
Expand Down