I am trying to create a S3 bucket using CDK. Bucket has created fine. However, when I trying to add the following IAM policy, I am getting create failed - API: s3:PutBucketPolicy Access Denied
TestBucket.addToResourcePolicy(new iam.PolicyStatement({
actions: [ 's3:*'],
effect: iam.Effect.DENY,
principals: [ new iam.AnyPrincipal],
resources: [TestBucket.bucketArn+'/*'],
conditions: {
"Bool": {
"aws:SecureTransport": "false"
}
},
The user I am running this code as has admin privs. What could be the issue ?