This message was deleted.
# java
s
This message was deleted.
t
Not sure I understand the question. Yes, they are… Could you show a code snippet that is problematic for you?
There’s no Input<T> type if that’s your question
a
Copy code
var bucket = new Bucket("my-bucket",
                BucketArgs.builder()
                        .publicAccessBlockConfiguration(bucketPublicAccessBlockConfiguration) <--- Not compiling
                .build()
☝️ not sure how to go from here…
Copy code
var bucketPublicAccessBlockConfiguration = new BucketPublicAccessBlockConfiguration(true,true,true,true);
☝️ BucketPublicAccessBlockConfiguration has private access…
how can I assign bucket resource properties to a bucket, is what I am a little lost…
t
Okay, so your docs point to AWS Native - which is confusingly not supported yet despite the docs suggesting otherwise. Are you actually using the AWS (classic) provider?
a
Thanks @tall-librarian-49374. So this was my yesterday and didn’t go anywhere and I thought I should be using aws-native 😞
How should I be able to block public ACLs on buckets? Which API will help me do this and later assign it to Bucket object?
Copy code
var bucket = new Bucket("my-bucket", BucketArgs.builder()
                .acl("private")
                .policy("{\n" +
                        "      \"PublicAccessBlockConfiguration\":{\n" +
                        "         \"BlockPublicAcls\":true,\n" +
                        "         \"IgnorePublicAcls\":false,\n" +
                        "         \"BlockPublicPolicy\":true,\n" +
                        "         \"RestrictPublicBuckets\":true\n" +
                        "      }\n" +
                        "}")
                .build());
I get below error
Copy code
* creating urn:pulumi:dev::s3_provisioning::aws:s3/bucket:Bucket::my-bucket: 1 error occurred:
    	* Error putting S3 policy: MalformedPolicy: Unknown field PublicAccessBlockConfiguration
Am I on the right track of assigning Block policy through JSON?
t
Sorry I don’t know this part of AWS… Are you looking for this resource https://www.pulumi.com/registry/packages/aws/api-docs/s3/bucketpublicaccessblock/?
a
t
So go ahead and use it
a
Basically be able to do this thru pulumi
t
You should be able to do that with the resource that I linked
a
Trying to use it in
Copy code
var bucket = new Bucket("my-bucket", BucketArgs.builder()
                .acl("private")
                .policy("{\n" +
                        "      \"PublicAccessBlockConfiguration\":{\n" +
                        "         \"BlockPublicAcls\":true,\n" +
                        "         \"BlockPublicPolicy\":true,\n" +
                        "         \"RestrictPublicBuckets\":true\n" +
                        "      }\n" +
                        "}")
                .build());
t
That’s
Bucket
you need to add
new BucketPublicAccessBlock
as a separate resource
a
ok … Thanks 🙂
So, this is what is deployed successfully
Copy code
var exampleBucketV2 = new BucketV2("exampleBucketV2");

        var exampleBucketPublicAccessBlock = new BucketPublicAccessBlock("exampleBucketPublicAccessBlock", BucketPublicAccessBlockArgs.builder()
                .bucket(exampleBucketV2.getId())
                .blockPublicAcls(true)
                //.restrictPublicBuckets(true)
                .blockPublicPolicy(true)
                .build());
However, I still don’t see Block public access enabled.. on aws console…
How can I make sure, I am dealing with the right property (Pulumi API?)
Tried https://www.pulumi.com/registry/packages/aws/api-docs/s3/bucketpublicaccessblock/ with Java and Python. Couldn’t get it working… I will appreciate if someone else tries, to make sure I am not going blind 🤣 . Thanks!