Package com.pulumi.aws.s3
Class BucketPublicAccessBlock
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.s3.BucketPublicAccessBlock
-
public class BucketPublicAccessBlock extends com.pulumi.resources.CustomResourceManages S3 bucket-level Public Access Block configuration. For more information about these settings, see the [AWS S3 Block Public Access documentation](https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html). > This resource cannot be used with S3 directory buckets. > Setting `skipDestroy` to `true` means that the AWS Provider will not destroy a public access block, even when running `terraform destroy`. The configuration is thus an intentional dangling resource that is not managed by Terraform and will remain in-place in your AWS account. ## Example Usage
## Import ### Identity Schema #### Required * `bucket` (String) Name of the bucket. #### Optional * `accountId` (String) Account ID where this resource is managed. * `region` (String) Region where this resource is managed. Using `pulumi import`, import `aws.s3.BucketPublicAccessBlock` using the bucket name. For example: ```sh $ pulumi import aws:s3/bucketPublicAccessBlock:BucketPublicAccessBlock example my-bucket ```package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.s3.Bucket; import com.pulumi.aws.s3.BucketArgs; import com.pulumi.aws.s3.BucketPublicAccessBlock; import com.pulumi.aws.s3.BucketPublicAccessBlockArgs; import java.util.ArrayList; import java.util.Arrays; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var example = new Bucket("example", BucketArgs.builder() .bucket("example") .build()); var exampleBucketPublicAccessBlock = new BucketPublicAccessBlock("exampleBucketPublicAccessBlock", BucketPublicAccessBlockArgs.builder() .bucket(example.id()) .blockPublicAcls(true) .blockPublicPolicy(true) .ignorePublicAcls(true) .restrictPublicBuckets(true) .build()); } }
-
-
Constructor Summary
Constructors Constructor Description BucketPublicAccessBlock(java.lang.String name)BucketPublicAccessBlock(java.lang.String name, BucketPublicAccessBlockArgs args)BucketPublicAccessBlock(java.lang.String name, BucketPublicAccessBlockArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>>blockPublicAcls()com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>>blockPublicPolicy()com.pulumi.core.Output<java.lang.String>bucket()static BucketPublicAccessBlockget(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, BucketPublicAccessBlockState state, com.pulumi.resources.CustomResourceOptions options)Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>>ignorePublicAcls()com.pulumi.core.Output<java.lang.String>region()com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>>restrictPublicBuckets()com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>>skipDestroy()
-
-
-
Constructor Detail
-
BucketPublicAccessBlock
public BucketPublicAccessBlock(java.lang.String name)
- Parameters:
name- The _unique_ name of the resulting resource.
-
BucketPublicAccessBlock
public BucketPublicAccessBlock(java.lang.String name, BucketPublicAccessBlockArgs args)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.
-
BucketPublicAccessBlock
public BucketPublicAccessBlock(java.lang.String name, BucketPublicAccessBlockArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.options- A bag of options that control this resource's behavior.
-
-
Method Detail
-
blockPublicAcls
public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> blockPublicAcls()
- Returns:
- Whether Amazon S3 should block public ACLs for this bucket. Defaults to `false`. Enabling this setting does not affect existing policies or ACLs. When set to `true`, PUT Bucket ACL and PUT Object ACL calls fail if the specified ACL allows public access, and PUT Object calls fail if the request includes an object ACL.
-
blockPublicPolicy
public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> blockPublicPolicy()
- Returns:
- Whether Amazon S3 should block public bucket policies for this bucket. Defaults to `false`. Enabling this setting does not affect the existing bucket policy. When set to `true`, Amazon S3 rejects calls to PUT Bucket policy if the specified bucket policy allows public access.
-
bucket
public com.pulumi.core.Output<java.lang.String> bucket()
- Returns:
- S3 Bucket to which this Public Access Block configuration should be applied.
-
ignorePublicAcls
public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> ignorePublicAcls()
- Returns:
- Whether Amazon S3 should ignore public ACLs for this bucket. Defaults to `false`. Enabling this setting does not affect the persistence of any existing ACLs and doesn't prevent new public ACLs from being set. When set to `true`, Amazon S3 ignores public ACLs on this bucket and any objects that it contains.
-
region
public com.pulumi.core.Output<java.lang.String> region()
- Returns:
- Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
-
restrictPublicBuckets
public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> restrictPublicBuckets()
- Returns:
- Whether Amazon S3 should restrict public bucket policies for this bucket. Defaults to `false`. Enabling this setting does not affect the previously stored bucket policy, except that public and cross-account access within the public bucket policy, including non-public delegation to specific accounts, is blocked. When set to `true`, only the bucket owner and AWS services can access this bucket if it has a public policy.
-
skipDestroy
public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> skipDestroy()
- Returns:
- Whether to retain the public access block upon destruction. If set to `true`, the resource is simply removed from state instead. This may be desirable in certain scenarios to prevent the removal of a public access block before deletion of the associated bucket.
-
get
public static BucketPublicAccessBlock get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable BucketPublicAccessBlockState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name- The _unique_ name of the resulting resource.id- The _unique_ provider ID of the resource to lookup.state-options- Optional settings to control the behavior of the CustomResource.
-
-