aws.s3.BucketAclV2
Provides an S3 bucket ACL resource.
Note: destroy does not delete the S3 Bucket ACL but does remove the resource from state.
Example Usage
With ACL
using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.S3.BucketV2("example");
var exampleBucketAcl = new Aws.S3.BucketAclV2("exampleBucketAcl", new()
{
Bucket = example.Id,
Acl = "private",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/s3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := s3.NewBucketV2(ctx, "example", nil)
if err != nil {
return err
}
_, err = s3.NewBucketAclV2(ctx, "exampleBucketAcl", &s3.BucketAclV2Args{
Bucket: example.ID(),
Acl: pulumi.String("private"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.s3.BucketV2;
import com.pulumi.aws.s3.BucketAclV2;
import com.pulumi.aws.s3.BucketAclV2Args;
import java.util.List;
import java.util.ArrayList;
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 BucketV2("example");
var exampleBucketAcl = new BucketAclV2("exampleBucketAcl", BucketAclV2Args.builder()
.bucket(example.id())
.acl("private")
.build());
}
}
import pulumi
import pulumi_aws as aws
example = aws.s3.BucketV2("example")
example_bucket_acl = aws.s3.BucketAclV2("exampleBucketAcl",
bucket=example.id,
acl="private")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.s3.BucketV2("example", {});
const exampleBucketAcl = new aws.s3.BucketAclV2("exampleBucketAcl", {
bucket: example.id,
acl: "private",
});
resources:
example:
type: aws:s3:BucketV2
exampleBucketAcl:
type: aws:s3:BucketAclV2
properties:
bucket: ${example.id}
acl: private
With Grants
using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var current = Aws.S3.GetCanonicalUserId.Invoke();
var exampleBucketV2 = new Aws.S3.BucketV2("exampleBucketV2");
var exampleBucketAclV2 = new Aws.S3.BucketAclV2("exampleBucketAclV2", new()
{
Bucket = exampleBucketV2.Id,
AccessControlPolicy = new Aws.S3.Inputs.BucketAclV2AccessControlPolicyArgs
{
Grants = new[]
{
new Aws.S3.Inputs.BucketAclV2AccessControlPolicyGrantArgs
{
Grantee = new Aws.S3.Inputs.BucketAclV2AccessControlPolicyGrantGranteeArgs
{
Id = current.Apply(getCanonicalUserIdResult => getCanonicalUserIdResult.Id),
Type = "CanonicalUser",
},
Permission = "READ",
},
new Aws.S3.Inputs.BucketAclV2AccessControlPolicyGrantArgs
{
Grantee = new Aws.S3.Inputs.BucketAclV2AccessControlPolicyGrantGranteeArgs
{
Type = "Group",
Uri = "http://acs.amazonaws.com/groups/s3/LogDelivery",
},
Permission = "READ_ACP",
},
},
Owner = new Aws.S3.Inputs.BucketAclV2AccessControlPolicyOwnerArgs
{
Id = current.Apply(getCanonicalUserIdResult => getCanonicalUserIdResult.Id),
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/s3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
current, err := s3.GetCanonicalUserId(ctx, nil, nil)
if err != nil {
return err
}
exampleBucketV2, err := s3.NewBucketV2(ctx, "exampleBucketV2", nil)
if err != nil {
return err
}
_, err = s3.NewBucketAclV2(ctx, "exampleBucketAclV2", &s3.BucketAclV2Args{
Bucket: exampleBucketV2.ID(),
AccessControlPolicy: &s3.BucketAclV2AccessControlPolicyArgs{
Grants: s3.BucketAclV2AccessControlPolicyGrantArray{
&s3.BucketAclV2AccessControlPolicyGrantArgs{
Grantee: &s3.BucketAclV2AccessControlPolicyGrantGranteeArgs{
Id: *pulumi.String(current.Id),
Type: pulumi.String("CanonicalUser"),
},
Permission: pulumi.String("READ"),
},
&s3.BucketAclV2AccessControlPolicyGrantArgs{
Grantee: &s3.BucketAclV2AccessControlPolicyGrantGranteeArgs{
Type: pulumi.String("Group"),
Uri: pulumi.String("http://acs.amazonaws.com/groups/s3/LogDelivery"),
},
Permission: pulumi.String("READ_ACP"),
},
},
Owner: &s3.BucketAclV2AccessControlPolicyOwnerArgs{
Id: *pulumi.String(current.Id),
},
},
})
if err != nil {
return err
}
return nil
})
}
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.BucketV2;
import com.pulumi.aws.s3.BucketAclV2;
import com.pulumi.aws.s3.BucketAclV2Args;
import com.pulumi.aws.s3.inputs.BucketAclV2AccessControlPolicyArgs;
import com.pulumi.aws.s3.inputs.BucketAclV2AccessControlPolicyOwnerArgs;
import java.util.List;
import java.util.ArrayList;
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();
var exampleBucketV2 = new BucketV2("exampleBucketV2");
var exampleBucketAclV2 = new BucketAclV2("exampleBucketAclV2", BucketAclV2Args.builder()
.bucket(exampleBucketV2.id())
.accessControlPolicy(BucketAclV2AccessControlPolicyArgs.builder()
.grants(
BucketAclV2AccessControlPolicyGrantArgs.builder()
.grantee(BucketAclV2AccessControlPolicyGrantGranteeArgs.builder()
.id(current.applyValue(getCanonicalUserIdResult -> getCanonicalUserIdResult.id()))
.type("CanonicalUser")
.build())
.permission("READ")
.build(),
BucketAclV2AccessControlPolicyGrantArgs.builder()
.grantee(BucketAclV2AccessControlPolicyGrantGranteeArgs.builder()
.type("Group")
.uri("http://acs.amazonaws.com/groups/s3/LogDelivery")
.build())
.permission("READ_ACP")
.build())
.owner(BucketAclV2AccessControlPolicyOwnerArgs.builder()
.id(current.applyValue(getCanonicalUserIdResult -> getCanonicalUserIdResult.id()))
.build())
.build())
.build());
}
}
import pulumi
import pulumi_aws as aws
current = aws.s3.get_canonical_user_id()
example_bucket_v2 = aws.s3.BucketV2("exampleBucketV2")
example_bucket_acl_v2 = aws.s3.BucketAclV2("exampleBucketAclV2",
bucket=example_bucket_v2.id,
access_control_policy=aws.s3.BucketAclV2AccessControlPolicyArgs(
grants=[
aws.s3.BucketAclV2AccessControlPolicyGrantArgs(
grantee=aws.s3.BucketAclV2AccessControlPolicyGrantGranteeArgs(
id=current.id,
type="CanonicalUser",
),
permission="READ",
),
aws.s3.BucketAclV2AccessControlPolicyGrantArgs(
grantee=aws.s3.BucketAclV2AccessControlPolicyGrantGranteeArgs(
type="Group",
uri="http://acs.amazonaws.com/groups/s3/LogDelivery",
),
permission="READ_ACP",
),
],
owner=aws.s3.BucketAclV2AccessControlPolicyOwnerArgs(
id=current.id,
),
))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const current = aws.s3.getCanonicalUserId({});
const exampleBucketV2 = new aws.s3.BucketV2("exampleBucketV2", {});
const exampleBucketAclV2 = new aws.s3.BucketAclV2("exampleBucketAclV2", {
bucket: exampleBucketV2.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),
},
},
});
resources:
exampleBucketV2:
type: aws:s3:BucketV2
exampleBucketAclV2:
type: aws:s3:BucketAclV2
properties:
bucket: ${exampleBucketV2.id}
accessControlPolicy:
grants:
- grantee:
id: ${current.id}
type: CanonicalUser
permission: READ
- grantee:
type: Group
uri: http://acs.amazonaws.com/groups/s3/LogDelivery
permission: READ_ACP
owner:
id: ${current.id}
variables:
current:
fn::invoke:
Function: aws:s3:getCanonicalUserId
Arguments: {}
Create BucketAclV2 Resource
new BucketAclV2(name: string, args: BucketAclV2Args, opts?: CustomResourceOptions);
@overload
def BucketAclV2(resource_name: str,
opts: Optional[ResourceOptions] = None,
access_control_policy: Optional[BucketAclV2AccessControlPolicyArgs] = None,
acl: Optional[str] = None,
bucket: Optional[str] = None,
expected_bucket_owner: Optional[str] = None)
@overload
def BucketAclV2(resource_name: str,
args: BucketAclV2Args,
opts: Optional[ResourceOptions] = None)
func NewBucketAclV2(ctx *Context, name string, args BucketAclV2Args, opts ...ResourceOption) (*BucketAclV2, error)
public BucketAclV2(string name, BucketAclV2Args args, CustomResourceOptions? opts = null)
public BucketAclV2(String name, BucketAclV2Args args)
public BucketAclV2(String name, BucketAclV2Args args, CustomResourceOptions options)
type: aws:s3:BucketAclV2
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args BucketAclV2Args
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args BucketAclV2Args
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args BucketAclV2Args
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args BucketAclV2Args
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args BucketAclV2Args
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
BucketAclV2 Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The BucketAclV2 resource accepts the following input properties:
- Bucket string
The name of the bucket.
- Access
Control BucketPolicy Acl V2Access Control Policy Args A configuration block that sets the ACL permissions for an object per grantee documented below.
- Acl string
The canned ACL to apply to the bucket.
- Expected
Bucket stringOwner The account ID of the expected bucket owner.
- Bucket string
The name of the bucket.
- Access
Control BucketPolicy Acl V2Access Control Policy Args A configuration block that sets the ACL permissions for an object per grantee documented below.
- Acl string
The canned ACL to apply to the bucket.
- Expected
Bucket stringOwner The account ID of the expected bucket owner.
- bucket String
The name of the bucket.
- access
Control BucketPolicy Acl V2Access Control Policy Args A configuration block that sets the ACL permissions for an object per grantee documented below.
- acl String
The canned ACL to apply to the bucket.
- expected
Bucket StringOwner The account ID of the expected bucket owner.
- bucket string
The name of the bucket.
- access
Control BucketPolicy Acl V2Access Control Policy Args A configuration block that sets the ACL permissions for an object per grantee documented below.
- acl string
The canned ACL to apply to the bucket.
- expected
Bucket stringOwner The account ID of the expected bucket owner.
- bucket str
The name of the bucket.
- access_
control_ Bucketpolicy Acl V2Access Control Policy Args A configuration block that sets the ACL permissions for an object per grantee documented below.
- acl str
The canned ACL to apply to the bucket.
- expected_
bucket_ strowner The account ID of the expected bucket owner.
- bucket String
The name of the bucket.
- access
Control Property MapPolicy A configuration block that sets the ACL permissions for an object per grantee documented below.
- acl String
The canned ACL to apply to the bucket.
- expected
Bucket StringOwner The account ID of the expected bucket owner.
Outputs
All input properties are implicitly available as output properties. Additionally, the BucketAclV2 resource produces the following output properties:
- Id string
The provider-assigned unique ID for this managed resource.
- Id string
The provider-assigned unique ID for this managed resource.
- id String
The provider-assigned unique ID for this managed resource.
- id string
The provider-assigned unique ID for this managed resource.
- id str
The provider-assigned unique ID for this managed resource.
- id String
The provider-assigned unique ID for this managed resource.
Look up Existing BucketAclV2 Resource
Get an existing BucketAclV2 resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: BucketAclV2State, opts?: CustomResourceOptions): BucketAclV2
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
access_control_policy: Optional[BucketAclV2AccessControlPolicyArgs] = None,
acl: Optional[str] = None,
bucket: Optional[str] = None,
expected_bucket_owner: Optional[str] = None) -> BucketAclV2
func GetBucketAclV2(ctx *Context, name string, id IDInput, state *BucketAclV2State, opts ...ResourceOption) (*BucketAclV2, error)
public static BucketAclV2 Get(string name, Input<string> id, BucketAclV2State? state, CustomResourceOptions? opts = null)
public static BucketAclV2 get(String name, Output<String> id, BucketAclV2State state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Access
Control BucketPolicy Acl V2Access Control Policy Args A configuration block that sets the ACL permissions for an object per grantee documented below.
- Acl string
The canned ACL to apply to the bucket.
- Bucket string
The name of the bucket.
- Expected
Bucket stringOwner The account ID of the expected bucket owner.
- Access
Control BucketPolicy Acl V2Access Control Policy Args A configuration block that sets the ACL permissions for an object per grantee documented below.
- Acl string
The canned ACL to apply to the bucket.
- Bucket string
The name of the bucket.
- Expected
Bucket stringOwner The account ID of the expected bucket owner.
- access
Control BucketPolicy Acl V2Access Control Policy Args A configuration block that sets the ACL permissions for an object per grantee documented below.
- acl String
The canned ACL to apply to the bucket.
- bucket String
The name of the bucket.
- expected
Bucket StringOwner The account ID of the expected bucket owner.
- access
Control BucketPolicy Acl V2Access Control Policy Args A configuration block that sets the ACL permissions for an object per grantee documented below.
- acl string
The canned ACL to apply to the bucket.
- bucket string
The name of the bucket.
- expected
Bucket stringOwner The account ID of the expected bucket owner.
- access_
control_ Bucketpolicy Acl V2Access Control Policy Args A configuration block that sets the ACL permissions for an object per grantee documented below.
- acl str
The canned ACL to apply to the bucket.
- bucket str
The name of the bucket.
- expected_
bucket_ strowner The account ID of the expected bucket owner.
- access
Control Property MapPolicy A configuration block that sets the ACL permissions for an object per grantee documented below.
- acl String
The canned ACL to apply to the bucket.
- bucket String
The name of the bucket.
- expected
Bucket StringOwner The account ID of the expected bucket owner.
Supporting Types
BucketAclV2AccessControlPolicy
- Owner
Bucket
Acl V2Access Control Policy Owner Configuration block of the bucket owner's display name and ID documented below.
- Grants
List<Bucket
Acl V2Access Control Policy Grant> Set of
grant
configuration blocks documented below.
- Owner
Bucket
Acl V2Access Control Policy Owner Configuration block of the bucket owner's display name and ID documented below.
- Grants
[]Bucket
Acl V2Access Control Policy Grant Set of
grant
configuration blocks documented below.
- owner
Bucket
Acl V2Access Control Policy Owner Configuration block of the bucket owner's display name and ID documented below.
- grants
List<Bucket
Acl V2Access Control Policy Grant> Set of
grant
configuration blocks documented below.
- owner
Bucket
Acl V2Access Control Policy Owner Configuration block of the bucket owner's display name and ID documented below.
- grants
Bucket
Acl V2Access Control Policy Grant[] Set of
grant
configuration blocks documented below.
- owner
Bucket
Acl V2Access Control Policy Owner Configuration block of the bucket owner's display name and ID documented below.
- grants
Sequence[Bucket
Acl V2Access Control Policy Grant] Set of
grant
configuration blocks documented below.
- owner Property Map
Configuration block of the bucket owner's display name and ID documented below.
- grants List<Property Map>
Set of
grant
configuration blocks documented below.
BucketAclV2AccessControlPolicyGrant
- Permission string
Logging permissions assigned to the grantee for the bucket.
- Grantee
Bucket
Acl V2Access Control Policy Grant Grantee Configuration block for the person being granted permissions documented below.
- Permission string
Logging permissions assigned to the grantee for the bucket.
- Grantee
Bucket
Acl V2Access Control Policy Grant Grantee Configuration block for the person being granted permissions documented below.
- permission String
Logging permissions assigned to the grantee for the bucket.
- grantee
Bucket
Acl V2Access Control Policy Grant Grantee Configuration block for the person being granted permissions documented below.
- permission string
Logging permissions assigned to the grantee for the bucket.
- grantee
Bucket
Acl V2Access Control Policy Grant Grantee Configuration block for the person being granted permissions documented below.
- permission str
Logging permissions assigned to the grantee for the bucket.
- grantee
Bucket
Acl V2Access Control Policy Grant Grantee Configuration block for the person being granted permissions documented below.
- permission String
Logging permissions assigned to the grantee for the bucket.
- grantee Property Map
Configuration block for the person being granted permissions documented below.
BucketAclV2AccessControlPolicyGrantGrantee
- Type string
Type of grantee. Valid values:
CanonicalUser
,AmazonCustomerByEmail
,Group
.- Display
Name string The display name of the owner.
- Email
Address string Email address of the grantee. See Regions and Endpoints for supported AWS regions where this argument can be specified.
- Id string
The canonical user ID of the grantee.
- Uri string
URI of the grantee group.
- Type string
Type of grantee. Valid values:
CanonicalUser
,AmazonCustomerByEmail
,Group
.- Display
Name string The display name of the owner.
- Email
Address string Email address of the grantee. See Regions and Endpoints for supported AWS regions where this argument can be specified.
- Id string
The canonical user ID of the grantee.
- Uri string
URI of the grantee group.
- type String
Type of grantee. Valid values:
CanonicalUser
,AmazonCustomerByEmail
,Group
.- display
Name String The display name of the owner.
- email
Address String Email address of the grantee. See Regions and Endpoints for supported AWS regions where this argument can be specified.
- id String
The canonical user ID of the grantee.
- uri String
URI of the grantee group.
- type string
Type of grantee. Valid values:
CanonicalUser
,AmazonCustomerByEmail
,Group
.- display
Name string The display name of the owner.
- email
Address string Email address of the grantee. See Regions and Endpoints for supported AWS regions where this argument can be specified.
- id string
The canonical user ID of the grantee.
- uri string
URI of the grantee group.
- type str
Type of grantee. Valid values:
CanonicalUser
,AmazonCustomerByEmail
,Group
.- display_
name str The display name of the owner.
- email_
address str Email address of the grantee. See Regions and Endpoints for supported AWS regions where this argument can be specified.
- id str
The canonical user ID of the grantee.
- uri str
URI of the grantee group.
- type String
Type of grantee. Valid values:
CanonicalUser
,AmazonCustomerByEmail
,Group
.- display
Name String The display name of the owner.
- email
Address String Email address of the grantee. See Regions and Endpoints for supported AWS regions where this argument can be specified.
- id String
The canonical user ID of the grantee.
- uri String
URI of the grantee group.
BucketAclV2AccessControlPolicyOwner
- Id string
The ID of the owner.
- Display
Name string The display name of the owner.
- Id string
The ID of the owner.
- Display
Name string The display name of the owner.
- id String
The ID of the owner.
- display
Name String The display name of the owner.
- id string
The ID of the owner.
- display
Name string The display name of the owner.
- id str
The ID of the owner.
- display_
name str The display name of the owner.
- id String
The ID of the owner.
- display
Name String The display name of the owner.
Import
S3 bucket ACL can be imported in one of four ways. 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][1] (i.e. predefined grant), the S3 bucket ACL resource should be imported using the bucket
e.g.,
$ 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][1] (i.e. predefined grant), the S3 bucket ACL resource should be imported using the bucket
and acl
separated by a comma (,
), e.g.
$ 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][1] (i.e. predefined grant), the S3 bucket ACL resource should be imported using the bucket
and expected_bucket_owner
separated by a comma (,
) e.g.,
$ 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][1] (i.e. predefined grant), the S3 bucket ACL resource should be imported using the bucket
, expected_bucket_owner
, and acl
separated by commas (,
), e.g.,
$ pulumi import aws:s3/bucketAclV2:BucketAclV2 example bucket-name,123456789012,private
[1]https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html#canned-acl
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
aws
Terraform Provider.