mongodb / awscdk-resources-mongodbatlas

MongoDB Atlas AWS CDK Resources
Apache License 2.0
35 stars 17 forks source link

CfnNetworkContainer requires providerName parameter despite it not being a valid prop #163

Closed Defrosted closed 10 months ago

Defrosted commented 11 months ago

Describe the bug When attempting to use the CfnNetworkContainer construct to get/create a network container for a cluster, the deployment for it fails with Resource handler returned message: "Unable to complete request: error Containers.ListAll err:providerName is required and must be specified". However, providerName is not a prop you can give to the construct.

To Reproduce Try to deploy a CfnNetworkContainer construct using CDK to a MongoDB Atlas cluster.

Example:

new CfnNetworkContainer(scope, 'mongodb-atlas-vpc', {
  projectId: mongoDbCluster.mProject.attrId,
  regionName: 'EU_NORTH_1',
  atlasCidrBlock: '192.168.248.0/21',
  profile: props.stage,
  provisioned: true,
});

Expected behavior Expected to be able to create/get a network container so I can initiate VPC peering via CDK. Expected to be able to pass providerName as a prop since it's apparently required for the Atlas API call.

Please complete the following information:

github-actions[bot] commented 11 months ago

Thanks for opening this issue! Please make sure to provide the following information to help us reproduce the issue:

Thanks for opening this issue. The ticket INTMDB-1318 was created for internal tracking.

Defrosted commented 11 months ago

Seems like the CfnNetworkContainer construct works if I create it before creating a cluster in the project. However, this prevents me from using the AtlasBasic construct anymore, as the project needs to be created before the network container. Apparently, there's no way to get details from an existing network container using the CfnNetworkContainer construct after cluster provisioning; this would be a nice feature to have.

Initiating the VPC peering with the CfnNetworkPeering construct seems to be working nicely after doing this hurdle. It still needs to be accepted manually in AWS VPC, but that was to be expected.

The documentation for the constructs could be greatly clarified. Currently getting up and running with anything other than AtlasBasic is pretty complex and requires a lot of trial and error, and I think more in-depth examples or tutorials on setting up a VPC peering connection with a cluster using CDK would be greatly appreciated by others stumbling on this in the future. There are currently very limited resources available anywhere on how to use the CDK constructs in the first place.

maastha commented 10 months ago

Hi @Defrosted Thank you for bringing up this issue. We have merged the fix for this resource here https://github.com/mongodb/mongodbatlas-cloudformation-resources/pull/858

This will be available in our next release, we will share the release date soon.

maastha commented 10 months ago

Hi @Defrosted We have released a new Cloudformation extension version of this resource with the fix for this issue. Please ensure to activate version 2.0.1 of MongoDB::Atlas::NetworkContainer in your AWS account before trying again.

Please let us know if you have any questions and re-open if required