Package com.pulumi.aws.s3
Class BucketAclV2
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.s3.BucketAclV2
-
@Deprecated public class BucketAclV2 extends com.pulumi.resources.CustomResourceDeprecated.aws.s3/bucketaclv2.BucketAclV2 has been deprecated in favor of aws.s3/bucketacl.BucketAclProvides an S3 bucket ACL resource. > **Note:** destroy does not delete the S3 Bucket ACL but does remove the resource from state. > This resource cannot be used with S3 directory buckets. ## Example Usage ### With `private` ACL
### With `public-read` ACL > This example explicitly disables the default S3 bucket security settings. This should be done with caution, as all bucket objects become publicly exposed.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.BucketOwnershipControls; import com.pulumi.aws.s3.BucketOwnershipControlsArgs; import com.pulumi.aws.s3.inputs.BucketOwnershipControlsRuleArgs; import com.pulumi.aws.s3.BucketAcl; import com.pulumi.aws.s3.BucketAclArgs; import com.pulumi.resources.CustomResourceOptions; 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("my-tf-example-bucket") .build()); var exampleBucketOwnershipControls = new BucketOwnershipControls("exampleBucketOwnershipControls", BucketOwnershipControlsArgs.builder() .rule(BucketOwnershipControlsRuleArgs.builder() .objectOwnership("BucketOwnerPreferred") .build()) .bucket(example.id()) .build()); var exampleBucketAcl = new BucketAcl("exampleBucketAcl", BucketAclArgs.builder() .bucket(example.id()) .acl("private") .build(), CustomResourceOptions.builder() .dependsOn(exampleBucketOwnershipControls) .build()); } }
### With Grantspackage 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.BucketOwnershipControls; import com.pulumi.aws.s3.BucketOwnershipControlsArgs; import com.pulumi.aws.s3.inputs.BucketOwnershipControlsRuleArgs; import com.pulumi.aws.s3.BucketPublicAccessBlock; import com.pulumi.aws.s3.BucketPublicAccessBlockArgs; import com.pulumi.aws.s3.BucketAcl; import com.pulumi.aws.s3.BucketAclArgs; import com.pulumi.resources.CustomResourceOptions; 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("my-tf-example-bucket") .build()); var exampleBucketOwnershipControls = new BucketOwnershipControls("exampleBucketOwnershipControls", BucketOwnershipControlsArgs.builder() .rule(BucketOwnershipControlsRuleArgs.builder() .objectOwnership("BucketOwnerPreferred") .build()) .bucket(example.id()) .build()); var exampleBucketPublicAccessBlock = new BucketPublicAccessBlock("exampleBucketPublicAccessBlock", BucketPublicAccessBlockArgs.builder() .bucket(example.id()) .blockPublicAcls(false) .blockPublicPolicy(false) .ignorePublicAcls(false) .restrictPublicBuckets(false) .build()); var exampleBucketAcl = new BucketAcl("exampleBucketAcl", BucketAclArgs.builder() .bucket(example.id()) .acl("public-read") .build(), CustomResourceOptions.builder() .dependsOn( exampleBucketOwnershipControls, exampleBucketPublicAccessBlock) .build()); } }
## Import ### Identity Schema #### Required * `bucket` (String) S3 bucket name. #### Optional * `accountId` (String) AWS Account where this resource is managed. * `region` (String) Region where this resource is managed. If the owner (account ID) of the source bucket is the _same_ account used to configure the AWS Provider, and the source bucket is **configured** with a [canned ACL](https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html#canned-acl) (i.e. predefined grant), import using the `bucket` and `acl` separated by a comma (`,`): If the owner (account ID) of the source bucket _differs_ from the account used to configure the AWS Provider, and the source bucket is **not configured** with a [canned ACL](https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html#canned-acl) (i.e. predefined grant), imported using the `bucket` and `expectedBucketOwner` separated by a comma (`,`): If the owner (account ID) of the source bucket _differs_ from the account used to configure the AWS Provider, and the source bucket is **configured** with a [canned ACL](https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html#canned-acl) (i.e. predefined grant), imported using the `bucket`, `expectedBucketOwner`, and `acl` separated by commas (`,`): **Using `pulumi import` to import** using `bucket`, `expectedBucketOwner`, and/or `acl`, depending on your situation. For example: If the owner (account ID) of the source bucket is the _same_ account used to configure the AWS Provider, and the source bucket is **not configured** with a [canned ACL](https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html#canned-acl) (i.e. predefined grant), import using the `bucket`: ```sh $ pulumi import aws:s3/bucketAclV2:BucketAclV2 example bucket-name ``` If the owner (account ID) of the source bucket is the _same_ account used to configure the AWS Provider, and the source bucket is **configured** with a [canned ACL](https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html#canned-acl) (i.e. predefined grant), import using the `bucket` and `acl` separated by a comma (`,`): ```sh $ pulumi import aws:s3/bucketAclV2:BucketAclV2 example bucket-name,private ``` If the owner (account ID) of the source bucket _differs_ from the account used to configure the AWS Provider, and the source bucket is **not configured** with a [canned ACL](https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html#canned-acl) (i.e. predefined grant), imported using the `bucket` and `expectedBucketOwner` separated by a comma (`,`): ```sh $ pulumi import aws:s3/bucketAclV2:BucketAclV2 example bucket-name,123456789012 ``` If the owner (account ID) of the source bucket _differs_ from the account used to configure the AWS Provider, and the source bucket is **configured** with a [canned ACL](https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html#canned-acl) (i.e. predefined grant), imported using the `bucket`, `expectedBucketOwner`, and `acl` separated by commas (`,`): ```sh $ pulumi import aws:s3/bucketAclV2:BucketAclV2 example bucket-name,123456789012,private ```package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.s3.S3Functions; import com.pulumi.aws.s3.Bucket; import com.pulumi.aws.s3.BucketArgs; import com.pulumi.aws.s3.BucketOwnershipControls; import com.pulumi.aws.s3.BucketOwnershipControlsArgs; import com.pulumi.aws.s3.inputs.BucketOwnershipControlsRuleArgs; import com.pulumi.aws.s3.BucketAcl; import com.pulumi.aws.s3.BucketAclArgs; import com.pulumi.aws.s3.inputs.BucketAclAccessControlPolicyArgs; import com.pulumi.aws.s3.inputs.BucketAclAccessControlPolicyOwnerArgs; import com.pulumi.aws.s3.inputs.BucketAclAccessControlPolicyGrantArgs; import com.pulumi.aws.s3.inputs.BucketAclAccessControlPolicyGrantGranteeArgs; import com.pulumi.resources.CustomResourceOptions; 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) { final var current = S3Functions.getCanonicalUserId(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference); var example = new Bucket("example", BucketArgs.builder() .bucket("my-tf-example-bucket") .build()); var exampleBucketOwnershipControls = new BucketOwnershipControls("exampleBucketOwnershipControls", BucketOwnershipControlsArgs.builder() .rule(BucketOwnershipControlsRuleArgs.builder() .objectOwnership("BucketOwnerPreferred") .build()) .bucket(example.id()) .build()); var exampleBucketAcl = new BucketAcl("exampleBucketAcl", BucketAclArgs.builder() .accessControlPolicy(BucketAclAccessControlPolicyArgs.builder() .owner(BucketAclAccessControlPolicyOwnerArgs.builder() .id(current.id()) .build()) .grants( BucketAclAccessControlPolicyGrantArgs.builder() .grantee(BucketAclAccessControlPolicyGrantGranteeArgs.builder() .id(current.id()) .type("CanonicalUser") .build()) .permission("READ") .build(), BucketAclAccessControlPolicyGrantArgs.builder() .grantee(BucketAclAccessControlPolicyGrantGranteeArgs.builder() .type("Group") .uri("http://acs.amazonaws.com/groups/s3/LogDelivery") .build()) .permission("READ_ACP") .build()) .build()) .bucket(example.id()) .build(), CustomResourceOptions.builder() .dependsOn(exampleBucketOwnershipControls) .build()); } }
-
-
Constructor Summary
Constructors Constructor Description BucketAclV2(java.lang.String name)Deprecated.BucketAclV2(java.lang.String name, BucketAclV2Args args)Deprecated.BucketAclV2(java.lang.String name, BucketAclV2Args args, com.pulumi.resources.CustomResourceOptions options)Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description com.pulumi.core.Output<BucketAclV2AccessControlPolicy>accessControlPolicy()Deprecated.com.pulumi.core.Output<java.util.Optional<java.lang.String>>acl()Deprecated.com.pulumi.core.Output<java.lang.String>bucket()Deprecated.com.pulumi.core.Output<java.util.Optional<java.lang.String>>expectedBucketOwner()Deprecated.static BucketAclV2get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, BucketAclV2State state, com.pulumi.resources.CustomResourceOptions options)Deprecated.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.lang.String>region()Deprecated.
-
-
-
Constructor Detail
-
BucketAclV2
public BucketAclV2(java.lang.String name)
Deprecated.- Parameters:
name- The _unique_ name of the resulting resource.
-
BucketAclV2
public BucketAclV2(java.lang.String name, BucketAclV2Args args)Deprecated.- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.
-
BucketAclV2
public BucketAclV2(java.lang.String name, BucketAclV2Args args, @Nullable com.pulumi.resources.CustomResourceOptions options)Deprecated.- 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
-
accessControlPolicy
public com.pulumi.core.Output<BucketAclV2AccessControlPolicy> accessControlPolicy()
Deprecated.- Returns:
- Configuration block that sets the ACL permissions for an object per grantee. See below.
-
acl
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> acl()
Deprecated.- Returns:
- Canned ACL to apply to the bucket. Valid values: `private`, `public-read`, `public-read-write`, `aws-exec-read`, `authenticated-read`, `bucket-owner-read`, `bucket-owner-full-control`, `log-delivery-write`. Full details are available on the [AWS documentation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html#canned-acl).
-
bucket
public com.pulumi.core.Output<java.lang.String> bucket()
Deprecated.- Returns:
- Bucket to which to apply the ACL.
-
expectedBucketOwner
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> expectedBucketOwner()
Deprecated.- Returns:
- Account ID of the expected bucket owner.
-
region
public com.pulumi.core.Output<java.lang.String> region()
Deprecated.- 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.
-
get
public static BucketAclV2 get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable BucketAclV2State state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Deprecated.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.
-
-