UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

207 lines • 9.57 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.BucketAclV2 = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides 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 * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.s3.Bucket("example", {bucket: "my-tf-example-bucket"}); * const exampleBucketOwnershipControls = new aws.s3.BucketOwnershipControls("example", { * bucket: example.id, * rule: { * objectOwnership: "BucketOwnerPreferred", * }, * }); * const exampleBucketAcl = new aws.s3.BucketAcl("example", { * bucket: example.id, * acl: "private", * }, { * dependsOn: [exampleBucketOwnershipControls], * }); * ``` * * ### 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. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.s3.Bucket("example", {bucket: "my-tf-example-bucket"}); * const exampleBucketOwnershipControls = new aws.s3.BucketOwnershipControls("example", { * bucket: example.id, * rule: { * objectOwnership: "BucketOwnerPreferred", * }, * }); * const exampleBucketPublicAccessBlock = new aws.s3.BucketPublicAccessBlock("example", { * bucket: example.id, * blockPublicAcls: false, * blockPublicPolicy: false, * ignorePublicAcls: false, * restrictPublicBuckets: false, * }); * const exampleBucketAcl = new aws.s3.BucketAcl("example", { * bucket: example.id, * acl: "public-read", * }, { * dependsOn: [ * exampleBucketOwnershipControls, * exampleBucketPublicAccessBlock, * ], * }); * ``` * * ### With Grants * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const current = aws.s3.getCanonicalUserId({}); * const example = new aws.s3.Bucket("example", {bucket: "my-tf-example-bucket"}); * const exampleBucketOwnershipControls = new aws.s3.BucketOwnershipControls("example", { * bucket: example.id, * rule: { * objectOwnership: "BucketOwnerPreferred", * }, * }); * const exampleBucketAcl = new aws.s3.BucketAcl("example", { * bucket: example.id, * accessControlPolicy: { * grants: [ * { * grantee: { * id: current.then(current => current.id), * type: "CanonicalUser", * }, * permission: "READ", * }, * { * grantee: { * type: "Group", * uri: "http://acs.amazonaws.com/groups/s3/LogDelivery", * }, * permission: "READ_ACP", * }, * ], * owner: { * id: current.then(current => current.id), * }, * }, * }, { * dependsOn: [exampleBucketOwnershipControls], * }); * ``` * * ## Import * * 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 `expected_bucket_owner` 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`, `expected_bucket_owner`, and `acl` separated by commas (`,`): * * __Using `pulumi import` to import__ using `bucket`, `expected_bucket_owner`, 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 `expected_bucket_owner` 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`, `expected_bucket_owner`, and `acl` separated by commas (`,`): * * ```sh * $ pulumi import aws:s3/bucketAclV2:BucketAclV2 example bucket-name,123456789012,private * ``` * * @deprecated aws.s3/bucketaclv2.BucketAclV2 has been deprecated in favor of aws.s3/bucketacl.BucketAcl */ class BucketAclV2 extends pulumi.CustomResource { /** * Get an existing BucketAclV2 resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { pulumi.log.warn("BucketAclV2 is deprecated: aws.s3/bucketaclv2.BucketAclV2 has been deprecated in favor of aws.s3/bucketacl.BucketAcl"); return new BucketAclV2(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of BucketAclV2. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === BucketAclV2.__pulumiType; } /** @deprecated aws.s3/bucketaclv2.BucketAclV2 has been deprecated in favor of aws.s3/bucketacl.BucketAcl */ constructor(name, argsOrState, opts) { pulumi.log.warn("BucketAclV2 is deprecated: aws.s3/bucketaclv2.BucketAclV2 has been deprecated in favor of aws.s3/bucketacl.BucketAcl"); let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["accessControlPolicy"] = state?.accessControlPolicy; resourceInputs["acl"] = state?.acl; resourceInputs["bucket"] = state?.bucket; resourceInputs["expectedBucketOwner"] = state?.expectedBucketOwner; resourceInputs["region"] = state?.region; } else { const args = argsOrState; if (args?.bucket === undefined && !opts.urn) { throw new Error("Missing required property 'bucket'"); } resourceInputs["accessControlPolicy"] = args?.accessControlPolicy; resourceInputs["acl"] = args?.acl; resourceInputs["bucket"] = args?.bucket; resourceInputs["expectedBucketOwner"] = args?.expectedBucketOwner; resourceInputs["region"] = args?.region; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const aliasOpts = { aliases: [{ type: "aws:s3/bucketAclV2:BucketAclV2" }] }; opts = pulumi.mergeOptions(opts, aliasOpts); super(BucketAclV2.__pulumiType, name, resourceInputs, opts); } } exports.BucketAclV2 = BucketAclV2; /** @internal */ BucketAclV2.__pulumiType = 'aws:s3/bucketAclV2:BucketAclV2'; //# sourceMappingURL=bucketAclV2.js.map