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

(aws-docdb): unsupported snapshot policy although documentation says it should be #28861

Closed
kornicameister opened this issue Jan 25, 2024 · 8 comments · Fixed by #28798
Closed
Assignees
Labels
@aws-cdk/aws-docdb Related to Amazon DocumentDB @aws-cdk/aws-iam Related to AWS Identity and Access Management bug This issue is a bug. effort/medium Medium work item – several days of effort p1

Comments

@kornicameister
Copy link
Contributor

Describe the bug

#28773 addressed the fact that it is impossible to spin up L2 DocumentDbCluster with retention policy said to Snaphost.
Although that is correct for security group inside (there's an escape hatch in DocumentDbCluster that sets cluster's retention policy onto the group) it turned out that cdk synth against DocumentDbCluster with a policy == Snaphost and seperately created security group also fails with an error that this time snaphost policy is not possible for DocumentDbCluster even though documentation says so

Expected Behavior

It is possible to configure DocumentDBCluster with Snapshot removal policy.

Current Behavior

It is not possible to configure said cluster with Snapshot removal policy.

Reproduction Steps

#!/usr/bin/env node

import 'source-map-support/register';

import * as cdk from 'aws-cdk-lib';
import * as docdb from 'aws-cdk-lib/aws-docdb';
import * as ec2 from 'aws-cdk-lib/aws-ec2';

const app = new cdk.App();
const stack = new cdk.Stack(app, 'Stack');

const vpc = new ec2.Vpc(stack, 'VPC');
const securityGroup = new ec2.SecurityGroup(stack, 'SG', {
  vpc,
});
new docdb.DatabaseCluster(stack, 'Cluster', {
  vpc,
  removalPolicy: cdk.RemovalPolicy.SNAPSHOT,
  securityGroup,
  instanceType: ec2.InstanceType.of(
    ec2.InstanceClass.A1,
    ec2.InstanceSize.SMALL,
  ),
  masterUser: {
    username: 'admin',
    password: cdk.SecretValue.unsafePlainText('password'),
  },
});

app.synth();

Possible Solution

@lpizzinidev mentioned that there might some sort of a list that needs to be updated to allow sscce to synthetize but I have no idea what that is and where that is.

Additional Information/Context

No response

CDK CLI Version

2.121.1

Framework Version

No response

Node.js Version

20.8

OS

MacOS sierra

Language

TypeScript

Language Version

5.3

Other information

No response

@kornicameister kornicameister added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 25, 2024
@github-actions github-actions bot added the @aws-cdk/aws-iam Related to AWS Identity and Access Management label Jan 25, 2024
@kornicameister kornicameister changed the title (aws-docb): unsupported snapshot policy although documentation says it should be (aws-docdb): unsupported snapshot policy although documentation says it should be Jan 25, 2024
@github-actions github-actions bot added the @aws-cdk/aws-docdb Related to Amazon DocumentDB label Jan 25, 2024
@GavinZZ GavinZZ self-assigned this Jan 25, 2024
@GavinZZ
Copy link
Contributor

GavinZZ commented Jan 25, 2024

I believe the issue is that the list here is missing AWS::DocDB::DBCluster. Going to draft a PR to add it.

@kornicameister
Copy link
Contributor Author

Wonderful @GavinZZ , thx a lot.
I kinda though this list is something that happens in CloudFormation native code.
Good that was not the case.

@lpizzinidev
Copy link
Contributor

@GavinZZ
I already opened a PR for the fix.

@GavinZZ
Copy link
Contributor

GavinZZ commented Jan 26, 2024

@lpizzinidev Noted, I will close my PR. Please in the future assign your self to the issue or linked the issue in your PR to avoid wasted effort. Thank you!

@tim-finnigan tim-finnigan added p1 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Jan 26, 2024
@lpizzinidev
Copy link
Contributor

@GavinZZ
I did as you can see in my PR description.
This issue is a duplicate that was opened after my PR.
Thanks for pointing out 👍

@kornicameister
Copy link
Contributor Author

It is a bit of my fault. I did not notice @lpizzinidev has included the change.

@lpizzinidev
Copy link
Contributor

@kornicameister
No worries. It's better to have two open issues for a bug than none 😉

GavinZZ added a commit that referenced this issue Feb 29, 2024
Adds support for `removalPolicy: RemovalPolicy.SNAPSHOT` for DocumentDB
clusters as specified in the
[documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html).

To allow users to specify custom policies for the cluster's instances
and security group the following properties have been added:
* `instanceRemovalPolicy`
* `securityGroupRemovalPolicy`

Closes #28773.
Closes #28861

----

*By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache-2.0 license*
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-docdb Related to Amazon DocumentDB @aws-cdk/aws-iam Related to AWS Identity and Access Management bug This issue is a bug. effort/medium Medium work item – several days of effort p1
Projects
None yet
4 participants