AccessGrant class
Provides a resource to manage an S3 Access Grant.
Each access grant has its own ID and gives an IAM user or role or a directory user, or group (the grantee) access to a registered location. You determine the level of access, such as READ or READWRITE.
Before you can create a grant, you must have an S3 Access Grants instance in the same Region as the S3 data.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.s3control.AccessGrantsInstance("example", {});
const exampleAccessGrantsLocation = new aws.s3control.AccessGrantsLocation("example", {
iamRoleArn: exampleAwsIamRole.arn,
locationScope: `s3://${exampleAwsS3Bucket.bucket}/prefixA*`,
}, {
dependsOn: [example],
});
const exampleAccessGrant = new aws.s3control.AccessGrant("example", {
accessGrantsLocationConfiguration: {
s3SubPrefix: "prefixB*",
},
grantee: {
granteeType: "IAM",
granteeIdentifier: exampleAwsIamUser.arn,
},
accessGrantsLocationId: exampleAccessGrantsLocation.accessGrantsLocationId,
permission: "READ",
});
import pulumi
import pulumi_aws as aws
example = aws.s3control.AccessGrantsInstance("example")
example_access_grants_location = aws.s3control.AccessGrantsLocation("example",
iam_role_arn=example_aws_iam_role["arn"],
location_scope=f"s3://{example_aws_s3_bucket['bucket']}/prefixA*",
opts = pulumi.ResourceOptions(depends_on=[example]))
example_access_grant = aws.s3control.AccessGrant("example",
access_grants_location_configuration={
"s3_sub_prefix": "prefixB*",
},
grantee={
"grantee_type": "IAM",
"grantee_identifier": example_aws_iam_user["arn"],
},
access_grants_location_id=example_access_grants_location.access_grants_location_id,
permission="READ")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.S3Control.AccessGrantsInstance("example");
var exampleAccessGrantsLocation = new Aws.S3Control.AccessGrantsLocation("example", new()
{
IamRoleArn = exampleAwsIamRole.Arn,
LocationScope = $"s3://{exampleAwsS3Bucket.Bucket}/prefixA*",
}, new CustomResourceOptions
{
DependsOn =
{
example,
},
});
var exampleAccessGrant = new Aws.S3Control.AccessGrant("example", new()
{
AccessGrantsLocationConfiguration = new Aws.S3Control.Inputs.AccessGrantAccessGrantsLocationConfigurationArgs
{
S3SubPrefix = "prefixB*",
},
Grantee = new Aws.S3Control.Inputs.AccessGrantGranteeArgs
{
GranteeType = "IAM",
GranteeIdentifier = exampleAwsIamUser.Arn,
},
AccessGrantsLocationId = exampleAccessGrantsLocation.AccessGrantsLocationId,
Permission = "READ",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/s3control"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := s3control.NewAccessGrantsInstance(ctx, "example", nil)
if err != nil {
return err
}
exampleAccessGrantsLocation, err := s3control.NewAccessGrantsLocation(ctx, "example", &s3control.AccessGrantsLocationArgs{
IamRoleArn: pulumi.Any(exampleAwsIamRole.Arn),
LocationScope: pulumi.Sprintf("s3://%v/prefixA*", exampleAwsS3Bucket.Bucket),
}, pulumi.DependsOn([]pulumi.Resource{
example,
}))
if err != nil {
return err
}
_, err = s3control.NewAccessGrant(ctx, "example", &s3control.AccessGrantArgs{
AccessGrantsLocationConfiguration: &s3control.AccessGrantAccessGrantsLocationConfigurationArgs{
S3SubPrefix: pulumi.String("prefixB*"),
},
Grantee: &s3control.AccessGrantGranteeArgs{
GranteeType: pulumi.String("IAM"),
GranteeIdentifier: pulumi.Any(exampleAwsIamUser.Arn),
},
AccessGrantsLocationId: exampleAccessGrantsLocation.AccessGrantsLocationId,
Permission: pulumi.String("READ"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_s3control_accessgrantsinstance" "example" {
}
resource "aws_s3control_accessgrantslocation" "example" {
depends_on = [aws_s3control_accessgrantsinstance.example]
iam_role_arn = exampleAwsIamRole.arn
location_scope ="s3://${exampleAwsS3Bucket.bucket}/prefixA*"
}
resource "aws_s3control_accessgrant" "example" {
access_grants_location_configuration = {
s3_sub_prefix = "prefixB*"
}
grantee = {
grantee_type = "IAM"
grantee_identifier = exampleAwsIamUser.arn
}
access_grants_location_id = aws_s3control_accessgrantslocation.example.access_grants_location_id
permission = "READ"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.s3control.AccessGrantsInstance;
import com.pulumi.aws.s3control.AccessGrantsLocation;
import com.pulumi.aws.s3control.AccessGrantsLocationArgs;
import com.pulumi.aws.s3control.AccessGrant;
import com.pulumi.aws.s3control.AccessGrantArgs;
import com.pulumi.aws.s3control.inputs.AccessGrantAccessGrantsLocationConfigurationArgs;
import com.pulumi.aws.s3control.inputs.AccessGrantGranteeArgs;
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 AccessGrantsInstance("example");
var exampleAccessGrantsLocation = new AccessGrantsLocation("exampleAccessGrantsLocation", AccessGrantsLocationArgs.builder()
.iamRoleArn(exampleAwsIamRole.arn())
.locationScope(String.format("s3://%s/prefixA*", exampleAwsS3Bucket.bucket()))
.build(), CustomResourceOptions.builder()
.dependsOn(example)
.build());
var exampleAccessGrant = new AccessGrant("exampleAccessGrant", AccessGrantArgs.builder()
.accessGrantsLocationConfiguration(AccessGrantAccessGrantsLocationConfigurationArgs.builder()
.s3SubPrefix("prefixB*")
.build())
.grantee(AccessGrantGranteeArgs.builder()
.granteeType("IAM")
.granteeIdentifier(exampleAwsIamUser.arn())
.build())
.accessGrantsLocationId(exampleAccessGrantsLocation.accessGrantsLocationId())
.permission("READ")
.build());
}
}
resources:
example:
type: aws:s3control:AccessGrantsInstance
exampleAccessGrantsLocation:
type: aws:s3control:AccessGrantsLocation
name: example
properties:
iamRoleArn: ${exampleAwsIamRole.arn}
locationScope: s3://${exampleAwsS3Bucket.bucket}/prefixA*
options:
dependsOn:
- ${example}
exampleAccessGrant:
type: aws:s3control:AccessGrant
name: example
properties:
accessGrantsLocationConfiguration:
s3SubPrefix: prefixB*
grantee:
granteeType: IAM
granteeIdentifier: ${exampleAwsIamUser.arn}
accessGrantsLocationId: ${exampleAccessGrantsLocation.accessGrantsLocationId}
permission: READ
Import
Using pulumi import, import S3 Access Grants using the accountId and accessGrantId, separated by a comma (,). For example:
$ pulumi import aws:s3control/accessGrant:AccessGrant example 123456789012,04549c5e-2f3c-4a07-824d-2cafe720aa22
Constructors
- AccessGrant(String name, {AccessGrantArgs? args, CustomResourceOptions? options})
-
Creates a new AccessGrant.
nameThe Pulumi resource name.argsArguments used to configure this AccessGrant. The set of arguments for AccessGrant.optionsResource options controlling this resource's behavior. - AccessGrant.reference(String urn)
- Creates a typed reference to an existing AccessGrant resource.
Properties
-
accessGrantArn
↔ Output<
String> -
ARN of the S3 Access Grant.
latefinal
-
accessGrantId
↔ Output<
String> -
Unique ID of the S3 Access Grant.
latefinal
-
accessGrantsLocationConfiguration
↔ Output<
AccessGrantAccessGrantsLocationConfiguration?> -
See
accessGrantsLocationConfigurationBlock below for more details.latefinal -
accessGrantsLocationId
↔ Output<
String> -
ID of the S3 Access Grants location to with the access grant is giving access.
latefinal
-
accountId
↔ Output<
String> -
AWS account ID for the S3 Access Grants location. Defaults to automatically determined account ID of the Terraform AWS provider.
latefinal
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
grantee
↔ Output<
AccessGrantGrantee> -
See
granteeBlock below for more details.latefinal -
grantScope
↔ Output<
String> -
Access grant's scope.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
permission
↔ Output<
String> -
Access grant's level of access. Valid values:
READ,WRITE,READWRITE.latefinal -
region
↔ Output<
String> -
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
s3PrefixType
↔ Output<
String?> -
If you are creating an access grant that grants access to only one object, set this to
Object. Valid values:Object.latefinal -
Key-value map of resource tags. If configured with a provider
defaultTagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.latefinal -
Map of tags assigned to the resource, including those inherited from the provider
defaultTagsconfiguration block.latefinal -
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
get(
String name, Input< String> id, {AccessGrantState? state, CustomResourceOptions? options}) → AccessGrant -
Gets an existing AccessGrant resource's state with the given
nameandid.