mongodb / mongodbatlas-cloudformation-resources

MongoDB Atlas CloudFormation Resources: Deploy, update, and manage MongoDB Atlas infrastructure as code through AWS CloudFormation
https://www.mongodb.com/atlas/aws-cloudformation
Apache License 2.0
58 stars 38 forks source link

MongoDB::Atlas::Cluster doesn't expose all ProviderSettings available in Atlas API #22

Closed azec-pdx closed 1 year ago

azec-pdx commented 4 years ago

After creating resources:

Then started reading https://docs.atlas.mongodb.com/reference/api/clusters-create-one/ and found this really interesting:

providerSettings.instanceSizeName

M2 and M5 clusters are multi-tenant deployments. 
You must set providerSettings.providerName to TENANT and specify the cloud service provider in providerSettings.backingProviderName.

Looking at current spec of MongoDB::Atlas::Cluster , CloudFormation property ProviderSettings DOES NOT allow specifying ProviderName, only BackingProviderName property which is not enough to provision M2 and M5 tier clusters.

This creates constraint that minimum possible tier that can be provisioned through CloudFormation (and AWS provider - duuh ) is M10 Cluster.

I am curious if this is "by design" and intentional business decision vs. implementation opportunity? Answer to that question might determine if this issue should be treated as feature-request or canceled.

Additionally , I can see that example for cluster is using also M10. However, the same example is using ProviderName as top-level property on resource here, although it is nowhere specified in JSON Schema for MongoDB::Atlas::Cluster and interestingly I did have it in my template (by pure copy-paste) and it didn't make resource fail :)

SUMMARY:

  1. There may be opportunity to expand ProviderSettings
  2. There is opportunity to clean up examples for MongoDB::Atlas::Cluster
themantissa commented 4 years ago

@azec-pdx I'll respond on what I can but as the README notes this is still beta so it's safe to expect some issues until we can move forward w/ more development.

The m10 clusters and up is to provide a simpler first experience, as you saw the underlying API is slightly different when configuring M2/M5. If development continues we'll likely add in coverage for all options in the underlying API, similar to what we've done for Terraform.

Zuhairahmed commented 1 year ago

@azec-pdx we have refreshed MongoDB Atlas resources and published to AWS CFN Third Party Public Registry in all 22 AWS regions where MongoDB Atlas is currently available in. Can you double check now if this has resolved your issue?

Zuhairahmed commented 1 year ago

Closing out this issue, but feel free to re-open in case if you need anything else. Thank you.

carthagan commented 1 year ago

This has not resolved the issue, an invalid reauest is returned as follows: 400 (request "INVALID_ENUM_VALUE") An invalid enumeration value M0 was specified

Here is the configuration in AWS CloudFormation:

  AtlasCluster:
    Type: 'MongoDB::Atlas::Cluster'
    Properties:
      ProjectId: !GetAtt 
        - AtlasProject
        - Id
      Name: !Ref AtlasClusterName
      Profile: !Ref ProfileKey
      ClusterType: REPLICASET
      ReplicationSpecs:
        - NumShards: '1'
          AdvancedRegionConfigs:
            - ElectableSpecs:
                EbsVolumeType: STANDARD
                InstanceSize: M0
                NodeCount: '3'
              RegionName: US_EAST_1
coldfire84 commented 1 year ago

Unsurprisingly this issue also impacts the 'awscdk-resources-mongodbatlas' CDK library. There seems to be a lack of documentation surrounding this limitation.

Are we likely to see the CloudFormation templates extended to support the ProviderName property, which would allow M0, M2 and M5 instance types (great for prototyping/ testing, and as a low-friction on-ramp to M10+ instance types).

Given an overview of whats needed, I'm happy to contribute.

BreitbandModem commented 1 year ago

I'm having the same trouble as the two commenters before me. There seems to be no support at all for shared clusters in the mongo cfn resources.

On our setup we're using shared instances for our development environment and larger clusters only for staging and production. So without support for shared instances, we cannot build a unified/reliable pipeline for our infrastructure.

@Zuhairahmed Could you please re-open this issue? Or should I create a new one?

RobbeVerhelst commented 1 year ago

We're also interested in getting M0, M2 and M5 included. Without it, we can't include mongo in our iac setup.

Zuhairahmed commented 1 year ago

@BreitbandModem yes please open new GitHub issue. Thank you.

manuquintero commented 11 months ago

any updates for this? we'd like to have M0 in our IAC code

macdi commented 10 months ago

Hello,

I faced the same issue while trying to create a minimal sandbox cluster M0 using Terraform.

I selected AZURE as provider.

The error is shown below:

mongodbatlas_cluster.experiment_cluster: Creating...

│ Error: error creating MongoDB Cluster: POST 400 (request "INVALID_ENUM_VALUE") An invalid enumeration value M0 was specified.

Could you please provide advice on this issue.

Kind regards,

BreitbandModem commented 10 months ago

@macdi for us this was resolved a while ago already. Refer to https://github.com/mongodb/mongodbatlas-cloudformation-resources/issues/608

ebenedetti-futuring commented 10 months ago

I have the same issue here using cdk:

const atlasBasic = new AtlasBasic(this, 'AtlasBasic', {
        clusterProps: {
          name: 'Cluster0',
          clusterType: 'REPLICASET',
          replicationSpecs: [
            {
              numShards: 1,
              advancedRegionConfigs: [
                {
                  analyticsSpecs: {
                    ebsVolumeType: "STANDARD",
                    instanceSize: "M0",
                    nodeCount: 1
                  },
                  electableSpecs: {
                    ebsVolumeType: "STANDARD",
                    instanceSize: "M0",
                    nodeCount: 3
                  },
                  priority: 7,
                  regionName: "EU_NORTH_1",
                  providerName: "AWS",
                  backingProviderName: "AWS"
                }]
            }]
        },
        projectProps: {
          name: 'demo',
          orgId: '<orgid>', //Static
        },
        ipAccessListProps: {
          accessList: [
            {ipAddress: '0.0.0.0', comment: 'All'}
          ]
        },
        profile: 'default', 
      });

AtlasBasic/cluster-AtlasBasic (AtlasBasicclusterAtlasBasic) Resource handler returned message: "https://cloud.mongodb.com/api/atlas/v2/groups/6552950c478827367c177538/clusters POST: HTTP 400 Bad Request (Error code: "INVALID_ENUM_VALUE") Detail: An invalid enumeration value M0 was specified. Reason: Bad Request. Params: [M 0]"