You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I try to import the resource like Table I cant access some methodos like addGlobalSecondaryIndex because its part of Table and not TableBase, the same for S3 Bucket but with addEventNotification
Reproduction Steps
this.bucket = new Bucket(this, name, {
bucketName: 'name',
removalPolicy: RemovalPolicy.RETAIN
})
this.bucket.addEventNotification(EventType.OBJECT_CREATED, new SnsDestination(topic))
deploy and destroy this stack. Then you can try to redeploy without success because you already have the resource, then you change your stack to
this.bucket = Bucket.fromBucketName(this, id, 'name') as Bucket;
this.bucket.addEventNotification(EventType.OBJECT_CREATED, new SnsDestination(topic))
but method does not exists error
Error Log
TypeError: this.bucket.addEventNotification is not a function
Environment
**CLI Version :aws-cli/2.0.3 Python/3.7.5 Windows/10 botocore/2.0.0dev7
I not sure if this is a bug, but this is the only way I had found in the cdk documentation to use an existent resouce.
If this is not a BUG how can I reuse the resource left by the removalPolicy: RemovalPolicy.RETAIN and reattach it to the stack?
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered:
The ability to adopt a resource into the stack is being tracked in aws/aws-cdk-rfcs#52
As you've gone through the exercise, you're right that existing resources that you're referencing using the fromXyZ methods which represent an object that can be used in your stack. In this case it's an IBucket. You can use methods to add grants and metrics on it.
The resource (table) itself is not governed by a stack (and therefore CDK).
When I try to import the resource like Table I cant access some methodos like addGlobalSecondaryIndex because its part of Table and not TableBase, the same for S3 Bucket but with addEventNotification
Reproduction Steps
this.bucket = new Bucket(this, name, {
bucketName: 'name',
removalPolicy: RemovalPolicy.RETAIN
})
this.bucket.addEventNotification(EventType.OBJECT_CREATED, new SnsDestination(topic))
deploy and destroy this stack. Then you can try to redeploy without success because you already have the resource, then you change your stack to
this.bucket = Bucket.fromBucketName(this, id, 'name') as Bucket;
this.bucket.addEventNotification(EventType.OBJECT_CREATED, new SnsDestination(topic))
but method does not exists error
Error Log
TypeError: this.bucket.addEventNotification is not a function
Environment
Other
I not sure if this is a bug, but this is the only way I had found in the cdk documentation to use an existent resouce.
If this is not a BUG how can I reuse the resource left by the removalPolicy: RemovalPolicy.RETAIN and reattach it to the stack?
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: