Comments (9)
That would be great - I'll assign the issue to you.
The simulator implementation of the Table
class uses DynamoDB local (a version of DynamoDB you can run on a container), which ought to support most of the same props as the AWS Terraform provider. For any of the props that expect an enum like BillingMode
or RemovalPolicy
, I might suggest defining them as new enums in https://github.com/winglang/winglibs/blob/23d298a87242f793eaa2203f3e39fe1c3048dcc5/dynamodb/dynamodb-types.w to avoid taking on a dependency on aws-cdk-lib
.
Happy to help provide any more pointers as needed 👍
from wing.
Ah - RemovalPolicy is an idiom specific to AWS CDK because it's related to CloudFormation specific behavior. See here: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html.
I'm not sure there's a clear way to map this into the Terraform implementation. Terraform has a "lifecycle" hook that lets you specify that a resource shouldn't be destroyed, but it's not as full featured:
resource "aws_s3_bucket" "MyPreciousBucket" {
lifecycle {
prevent_destroy = true
}
}
One option could be to say that if deletionProtection
is enabled, then we should also add that to your Terraform. It could be added like this:
new tfaws.dynamodbTable.DynamodbTable({
...
lifecycle: {
preventDestroy: true,
}
});
Deletion protection should be available (I see it listed in the Terraform Provider [here](https://registry.terraform.io/providers/hashicorp/aws/latest/doc. It's not available in the cdktf-aws-cdk
repo you linked but it is in the cdktf-provider-aws
repo - see here: https://github.com/cdktf/cdktf-provider-aws/blob/main/docs/dynamodbTable.typescript.md#dynamodbtableconfig-
from wing.
Yeah, that's a good question. I think the best option on the cloud side would be if we could just make some assertions about the configuration that's generated, similar to https://developer.hashicorp.com/terraform/cdktf/test/unit-tests#write-assertions. I'm not sure if it's possible to reuse these utilities in Wing at the moment though.
On the sim side maybe you can call the DescribeTable API inflight to confirm that the properties are set?
from wing.
Thanks for bringing this to our attention @thoroc! I think the ideal fix would be to add these missing properties to the TableProps
type in @winglibs/dynamodb
here and handle the new props in the implementation accordingly.
Pull requests are welcome!
from wing.
@Chriscbr I am open to create a PR for that, but I might need some guidance for the implementation.
from wing.
Just to confirm, I cannot see RemovalPolicy
or the DeletionProtection
in the cdktf-aws
: https://github.com/hashicorp/cdktf-aws-cdk/blob/main/docs/dynamodbTable.md. Am I looking at the wrong place?
from wing.
Just opened a draft PR, but I need to investigate a bit more terraform to see if the options are available: winglang/winglibs#272
from wing.
Deletion protection should be available (I see it listed in the Terraform Provider
I was just playing with cdktf locally and I can confirm there is a props that seems to map to the same in aws cdk: deletionProtectionEnabled
I'll have a look at the solution you've suggested for removalPolicy
.
from wing.
Just a question about testing. I am unsure how I would go about unit testing the new properties here.
For the tf side of things, should I expect a synthesised tf template?
For the sim side of things, I need to think about it.
from wing.
Related Issues (20)
- Remove `newInstance` method from Platform APIs
- New page to filter examples and demos of Wing
- Improved handling of CloudWatch logs for remote tests
- compilation error Maximum call stack size exceeded
- `cloud.Service` Cannot Stop Service That Runs Continuous Loop HOT 3
- Allow consuming Winglibs from JSII-supported languages
- Generate API documentation for Wing libraries
- `containers.Workload` replicas field has no effect in simulator
- `fs.chmod`
- unable to use `util.exec` in preflight
- Wing to generate image outputs HOT 2
- Download required packages for wing users if they are missing on compile
- Add ability to open all nodes through the playground URL HOT 1
- Missing `MutJson.copy()` and `Json.copyMut()`
- "{x}" prints strings with quotes if the value is `Json` HOT 1
- @inflight lifts are ignored if arguments are passed inside braces
- `@winglibs/python` does not work in Wing 0.79.0 and above
- `@winglibs/cognito` does not work in Wing 0.79.0 and above
- Output via JavaScript integration broken in Wing 0.77.16 HOT 3
- Missing basic capabilities to work with arrays in json
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wing.