Skip to content

Latest commit

 

History

History
125 lines (99 loc) · 22 KB

File metadata and controls

125 lines (99 loc) · 22 KB

cfn-resources

MongoDB Atlas AWS CloudFormation Custom Resource Type

This folder contains the source code for each of the AWS CloudFormation MongoDB Atlas Resources.

Note these are also hosted on AWS CloudFormation Public Registry under Third Party Extensions.

Resource Status Table

Resource Status Examples Local Testing Scripts
alert-configuration Build example ./alert-configuration/test
auditing Build example ./auditing/test
cloud-backup-restore-jobs Build example ./cloud-backup-restore-jobs/test
cloud-backup-schedule Build example ./cloud-backup-schedule/test
cloud-backup-snapshot Build example ./cloud-backup-snapshot/test
cloud-backup-snapshot-export-bucket Build example ./cloud-backup-snapshot-export-bucket/test
cluster Build example ./cluster/test
custom-dns-configuration-cluster-aws Build example ./custom-db-role/test
custom-db-role Build example ./custom-dns-configuration-cluster-aws/test
database-user Build example ./database-user/test
encryption-at-rest Build example ./encryption-at-rest/test
federated-settings-org-role-mapping Build example ./federated-settings-org-role-mapping/test
global-cluster-config Build example ./global-cluster-config/test
ldap-configuration Build example ./ldap-configuration/test
ldap-verify Build example ./ldap-verify/test
maintenance-window Build example ./maintenance-window/test
network-container Build example ./network-container/test
network-peering Build example ./network-peering/test
online-archive Build example ./online-archive/test
org-invitation Build example ./org-invitation/test
private-endpoint Build example ./private-endpoint/test
private-endpoint-regional-mode Build example ./private-endpoint-regional-mode/test
project Build example ./project/test
project-invitation Build example ./project-invitation/test
project-ip-access-list Build example ./project-ip-access-list/test
search-index Build example ./search-indexes/test
teams Build example ./teams/test
third-party-integration Build example files ./third-party-integration/test
trigger Build example ./trigger/test
X509AuthenticationDatabaseUser Build example ./x509-authentication-database-user/test
federated-database-instance Build example ./federated-database-instance/test
privatelink-endpoint-service-data-federation-online-archive Build example ./privatelink-endpoint-service-data-federation-online-archive/test
federated-query-limit Build example ./federated-query-limit/test
api-key Build example ./api-key/test
access-list-api-key Build example ./access-list-api-key/test
organization Build example ./organization/test
cloud-outage-simulation Build example ./cloud-outage-simulation/test
private-endpoint-service Build example ./private-endpoint-service/test
private-endpoint-aws Build example ./private-endpoint-aws/test
search-deployment Build example ./search-deployment/test
stream-instance Build example ./stream-instance/test
stream-connection Build example ./stream-connection/test
resource-policy Build example ./resource-policy/test

Resource Import Operations

All MongoDB Atlas AWS CloudFormation resources support the import operation, allowing you to bring existing Atlas resources under CloudFormation management. When importing resources, please consider the following:

Import Requirements and Considerations

  1. DeletionPolicy Attribute: Your resource template must include the DeletionPolicy attribute in order to specify what happens to the resource when it is removed from the stack.

  2. UPDATE Operation Required: The import operation executes the UPDATE operation behind the scenes. Therefore, UPDATE functionality must be properly implemented for the resource type to support import. For more datails on when the update is run, please see Create a stack from existing resources using the AWS Management Console or Import an existing resource into a stack using the AWS Management Console or

  3. Outputs Restrictions: You cannot modify or add Outputs to the template during the import operation. However, you can add outputs after the import is complete.

For more details, refer to the official AWS Resource Import documentation.

Legend

Badge Meaning
Build GA, production ready
Build Beta status, stable dev/testing
Build Not fully tested
Build Beta status, stable for dev/testing but not only for advanced use
Build Deprecated

Test framework

Requirements for local dev testing

  • aws cli
  • cfn cli
  • python
  • go
  • bash
  • atlascli (you don't need this but will make testing easier)

How we handle ApiKeys

All apikey are injected through environment variables. We have a helper script which can export your mongocli profile, so this makes it very easy to switch Atlas environments.

To use this, first download and install mongocli. Next, run mongocli config and then;

$source <(./quickstart-mongodb-atlas/scripts/export-mongocli-config.py)
$env | grep ATLAS
MONGODB_ATLAS_PUBLIC_KEY=XXXXXX
MONGODB_ATLAS_PRIVATE_KEY=XXXXXX
MONGODB_ATLAS_ORG_ID=XXXXXX

Deployment.template.yaml

Note: section for project example line #145 contains an s3 bucket configuration string please edit value to S3 bucket that you require --> (SchemaHandlerPackage="s3://replace-placeholder-bucket-name-here/resources/mongodb-atlas-project.zip",)

How tests are structured

Each resource has a folder called test with 3 items:

  1. <resource_name>.sample-cfn-request.json Sample JSON template request to use for local testing with cfn invoke

  2. <resource_name>.create-sample-cfn-request.sh The create-sample-cfn-request script injects parameters into the sample json template. You run this script, passing resource specific parameters, and the tooling will inject ApiKeys based upon the exported configuration from above. See each resource README for specific testing documentation.

  3. <resource_name>.sample-template.yaml Sample real cloudformation template you can run with aws cloudformation create-stack or using ../../quickstart-mongodb-atlas/scripts/launch-x-quickstart.sh See each resource README for specific testing documentation.