-
Notifications
You must be signed in to change notification settings - Fork 11
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
feat(dynamodb): add billingMode, deletionProtection props #272
base: main
Are you sure you want to change the base?
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @thoroc! A few small comments but otherwise I'm cool merging it
deletionProtectionEnabled: props.deletionProtection ?? false, | ||
lifecycle: { | ||
preventDestroy: props.deletionProtection ?? true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these fields default to the same value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh that's a good catch. Yes that would make sense. I actually was wondering if there has been a wider discussion about having a system wide sensible default for those things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there's any built-in mechanisms at the moment -- perhaps we can add deletionProtection
as a prop for more resources and eventually establish it as a convention of some sort.
let tableWithBillingModeProvisioned = new dynamodb.Table({ | ||
billingMode: dynamodb_types.BillingMode.PROVISIONED, | ||
attributes: [ | ||
{ name: "id", type: "S" }, | ||
], | ||
hashKey: "id", | ||
}); | ||
|
||
let simClient = dynamodb_sim.Util.createClient({ | ||
endpoint: "http:https://localhost:8000", | ||
region: "us-west", | ||
credentials: { | ||
accessKeyId: "accessKeyId", | ||
secretAccessKey: "secretAccessKey", | ||
}, | ||
}); | ||
|
||
test "Sim: table with billing mode `provisioned`" { | ||
|
||
let tableDescription = simClient.describeTable({ | ||
TableName: tableWithBillingModeProvisioned.tableName, | ||
}); | ||
|
||
expect.equal( | ||
tableDescription.billingMode, | ||
dynamodb_types.BillingMode.PROVISIONED | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this test will fail if you try running it on the tf-aws
platform since it's directly calling into the dynamodb_sim
implementation. If we want to scope this test just to run on the simulator, you can wrap all of it in a block like:
bring util;
if util.env("WING_TARGET") == "sim" {
// resources...
// tests ...
}
Trying to address the missing properties coming from AWS CDK for DynamoDB Table.
Closes: #6753