Skip to content
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

Need ability to create the default CfnCloudBackupSchedule when creating a cluster #285

Closed
lockenj opened this issue May 31, 2024 · 6 comments
Labels

Comments

@lockenj
Copy link

lockenj commented May 31, 2024

Is your feature request related to a problem? Please describe.

I am loving this CDK but am constantly having the problem of trying to understand what the possible values of properties are. This tells me I am not looking in the right place.

The latest example is I am trying to setup a Backup Policy with a single Item like below:

this.#_cloudBackupSchedule = new CfnCloudBackupSchedule(this, 'CloudBackupSchedule', {
      profile: this.#_secretName,
      projectId: this.#_atlasProjectId,
      clusterName: this.#_clusterName,

      autoExportEnabled: false,
     
      policies: [
        {
          policyItems: [
            {
              retentionUnit: 'Days',
              retentionValue: 7,
              frequencyType: 'Daily',
              frequencyInterval: undefined,
            }
          ]
        }
      ]
    });

Error I am seeing with this:

error: All values from PolicyItem should be set when `PolicyItems` is set"

Describe the solution you'd like
I'd love to know where to look to find what are the possible values of each prop and any properties that depend on each other (in the cases where if you set propX to blah then you also must set props Y and Z).

Describe alternatives you've considered
Thoroughly explored:

  1. https://constructs.dev/packages/awscdk-resources-mongodbatlas/v/3.5.2?lang=typescript
  2. https://github.com/mongodb/awscdk-resources-mongodbatlas
  3. https://github.com/mongodb/mongodbatlas-cloudformation-resources

Could not find anything in the examples or code that show possible prop values or description of prop dependencies.

Copy link

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

  • CDK code used by the customer
  • The output of cdk synth
  • List of Public CFN Resources that are activated in the AWS account with their release version
  • AWS Region where the CFN stack is running

Thanks for opening this issue. The ticket CLOUDP-251736 was created for internal tracking.

@lockenj
Copy link
Author

lockenj commented May 31, 2024

After adding a id property of value 1 to the policy item...

The CDK under the covers appears to be doing a PATCH, which makes me believe the policies are already created... How do I set the backup policy to do just a once a day backup that is retained for 7 days?

PATCH error:

Resource handler returned message: "https://cloud.mongodb.com/api/atlas/v2/groups/65c7a364ba5030155d686ffa/clusters/core-environment-manual-test/backup/schedule PATCH: HTTP 400 Bad Request (Error code
: "INVALID_JSON_ATTRIBUTE") Detail: Received JSON for the policies.java.util.ArrayList[0].id attribute does not match expected format. Reason: Bad Request. Params: [policies.java.util.ArrayList[0].id]

@lockenj
Copy link
Author

lockenj commented May 31, 2024

Looks like I am not the only one stumbling through this....

For others take a look at this

https://www.mongodb.com/community/forums/t/policy-id-wrongly-described-in-docs/211687/5

@lockenj
Copy link
Author

lockenj commented May 31, 2024

Without the ability to retrieve the default PolicyIDs via the CDK I dont see how we can handle defining the backup policy upon creation this has to be some manual process after creation are some programatic change outside of the CDK.

@lockenj lockenj changed the title Values of props are total guesswork Need ability to create the default CfnCloudBackupSchedule when creating a cluster May 31, 2024
@maastha
Copy link
Collaborator

maastha commented Jun 7, 2024

Hi @lockenj

Thanks a lot for creating this issue!

Below are some examples in our repository for using this construct:

Additionally, to unblock you for now, please refer below API to fetch the policy ID:
https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Cloud-Backups/operation/getBackupSchedule

Please let us know if you come across any issues.

In the meantime, we are looking into a fix for this issue.

Copy link

github-actions bot commented Jul 8, 2024

This issue has gone 30 days without any activity and meets the project’s definition of "stale". This will be auto-closed if there is no new activity over the next 30 days. If the issue is still relevant and active, you can simply comment with a "bump" to keep it open, or add the label "not_stale". Thanks for keeping our repository healthy!

@github-actions github-actions bot added the stale label Jul 8, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants