When creating a basic s3 resource with the following code
export class Test1Stack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
new s3.Bucket(this, 'sampleBucket', {
versioned: true,
removalPolicy: cdk.RemovalPolicy.DESTROY,
autoDeleteObjects: true
});
}
}
Cdk creates the following resources:
- AWS::S3::Bucket
- AWS::S3::BucketPolicy
- Custom::S3AutoDeleteObjects
- AWS::IAM::Role
- AWS::Lambda::Function
- AWS::CDK::Metadata
I can access AWS::S3::Bucket AWS::S3::BucketPolicy properties by using
const s3 = new s3.Bucket(.......)
What object would give me access to the rest of the resources, for example if I'd like to overwrite the logical id for AWS::IAM::Role.
I imagine that I could create my own AWS::IAM::Role, AWS::Lambda::Function, AWS::CDK::Metadata and in this way I could use the same mechanism I am using for s3 to manipulate & override properties, but it is not what I am looking for.
I just want to be able to access the other resources at run time.
I have tried the properties from the constructor with no success.
I also understand that CDK does not recommend overriding resources.