1. Packages
  2. AWS Classic
  3. API Docs
  4. s3control
  5. AccessGrantsInstanceResourcePolicy

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

aws.s3control.AccessGrantsInstanceResourcePolicy

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

    Provides a resource to manage an S3 Access Grants instance resource policy. Use a resource policy to manage cross-account access to your S3 Access Grants instance.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.s3control.AccessGrantsInstance("example", {});
    const exampleAccessGrantsInstanceResourcePolicy = new aws.s3control.AccessGrantsInstanceResourcePolicy("example", {policy: pulumi.interpolate`{
      "Version": "2012-10-17",
      "Id": "S3AccessGrantsPolicy",
      "Statement": [{
        "Sid": "AllowAccessToS3AccessGrants",
        "Effect": "Allow",
        "Principal": {
          "AWS": "123456789456"
        },
        "Action": [
          "s3:ListAccessGrants",
          "s3:ListAccessGrantsLocations",
          "s3:GetDataAccess"
        ],
        "Resource": "${example.accessGrantsInstanceArn}"
      }]
    }
    `});
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.s3control.AccessGrantsInstance("example")
    example_access_grants_instance_resource_policy = aws.s3control.AccessGrantsInstanceResourcePolicy("example", policy=example.access_grants_instance_arn.apply(lambda access_grants_instance_arn: f"""{{
      "Version": "2012-10-17",
      "Id": "S3AccessGrantsPolicy",
      "Statement": [{{
        "Sid": "AllowAccessToS3AccessGrants",
        "Effect": "Allow",
        "Principal": {{
          "AWS": "123456789456"
        }},
        "Action": [
          "s3:ListAccessGrants",
          "s3:ListAccessGrantsLocations",
          "s3:GetDataAccess"
        ],
        "Resource": "{access_grants_instance_arn}"
      }}]
    }}
    """))
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-aws/sdk/v6/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
    		}
    		_, err = s3control.NewAccessGrantsInstanceResourcePolicy(ctx, "example", &s3control.AccessGrantsInstanceResourcePolicyArgs{
    			Policy: example.AccessGrantsInstanceArn.ApplyT(func(accessGrantsInstanceArn string) (string, error) {
    				return fmt.Sprintf(`{
      "Version": "2012-10-17",
      "Id": "S3AccessGrantsPolicy",
      "Statement": [{
        "Sid": "AllowAccessToS3AccessGrants",
        "Effect": "Allow",
        "Principal": {
          "AWS": "123456789456"
        },
        "Action": [
          "s3:ListAccessGrants",
          "s3:ListAccessGrantsLocations",
          "s3:GetDataAccess"
        ],
        "Resource": "%v"
      }]
    }
    `, accessGrantsInstanceArn), nil
    			}).(pulumi.StringOutput),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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 exampleAccessGrantsInstanceResourcePolicy = new Aws.S3Control.AccessGrantsInstanceResourcePolicy("example", new()
        {
            Policy = example.AccessGrantsInstanceArn.Apply(accessGrantsInstanceArn => @$"{{
      ""Version"": ""2012-10-17"",
      ""Id"": ""S3AccessGrantsPolicy"",
      ""Statement"": [{{
        ""Sid"": ""AllowAccessToS3AccessGrants"",
        ""Effect"": ""Allow"",
        ""Principal"": {{
          ""AWS"": ""123456789456""
        }},
        ""Action"": [
          ""s3:ListAccessGrants"",
          ""s3:ListAccessGrantsLocations"",
          ""s3:GetDataAccess""
        ],
        ""Resource"": ""{accessGrantsInstanceArn}""
      }}]
    }}
    "),
        });
    
    });
    
    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.AccessGrantsInstanceResourcePolicy;
    import com.pulumi.aws.s3control.AccessGrantsInstanceResourcePolicyArgs;
    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 AccessGrantsInstance("example");
    
            var exampleAccessGrantsInstanceResourcePolicy = new AccessGrantsInstanceResourcePolicy("exampleAccessGrantsInstanceResourcePolicy", AccessGrantsInstanceResourcePolicyArgs.builder()
                .policy(example.accessGrantsInstanceArn().applyValue(accessGrantsInstanceArn -> """
    {
      "Version": "2012-10-17",
      "Id": "S3AccessGrantsPolicy",
      "Statement": [{
        "Sid": "AllowAccessToS3AccessGrants",
        "Effect": "Allow",
        "Principal": {
          "AWS": "123456789456"
        },
        "Action": [
          "s3:ListAccessGrants",
          "s3:ListAccessGrantsLocations",
          "s3:GetDataAccess"
        ],
        "Resource": "%s"
      }]
    }
    ", accessGrantsInstanceArn)))
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:s3control:AccessGrantsInstance
      exampleAccessGrantsInstanceResourcePolicy:
        type: aws:s3control:AccessGrantsInstanceResourcePolicy
        name: example
        properties:
          policy: |
            {
              "Version": "2012-10-17",
              "Id": "S3AccessGrantsPolicy",
              "Statement": [{
                "Sid": "AllowAccessToS3AccessGrants",
                "Effect": "Allow",
                "Principal": {
                  "AWS": "123456789456"
                },
                "Action": [
                  "s3:ListAccessGrants",
                  "s3:ListAccessGrantsLocations",
                  "s3:GetDataAccess"
                ],
                "Resource": "${example.accessGrantsInstanceArn}"
              }]
            }        
    

    Create AccessGrantsInstanceResourcePolicy Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new AccessGrantsInstanceResourcePolicy(name: string, args: AccessGrantsInstanceResourcePolicyArgs, opts?: CustomResourceOptions);
    @overload
    def AccessGrantsInstanceResourcePolicy(resource_name: str,
                                           args: AccessGrantsInstanceResourcePolicyArgs,
                                           opts: Optional[ResourceOptions] = None)
    
    @overload
    def AccessGrantsInstanceResourcePolicy(resource_name: str,
                                           opts: Optional[ResourceOptions] = None,
                                           policy: Optional[str] = None,
                                           account_id: Optional[str] = None)
    func NewAccessGrantsInstanceResourcePolicy(ctx *Context, name string, args AccessGrantsInstanceResourcePolicyArgs, opts ...ResourceOption) (*AccessGrantsInstanceResourcePolicy, error)
    public AccessGrantsInstanceResourcePolicy(string name, AccessGrantsInstanceResourcePolicyArgs args, CustomResourceOptions? opts = null)
    public AccessGrantsInstanceResourcePolicy(String name, AccessGrantsInstanceResourcePolicyArgs args)
    public AccessGrantsInstanceResourcePolicy(String name, AccessGrantsInstanceResourcePolicyArgs args, CustomResourceOptions options)
    
    type: aws:s3control:AccessGrantsInstanceResourcePolicy
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args AccessGrantsInstanceResourcePolicyArgs
    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 AccessGrantsInstanceResourcePolicyArgs
    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 AccessGrantsInstanceResourcePolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AccessGrantsInstanceResourcePolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AccessGrantsInstanceResourcePolicyArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var accessGrantsInstanceResourcePolicyResource = new Aws.S3Control.AccessGrantsInstanceResourcePolicy("accessGrantsInstanceResourcePolicyResource", new()
    {
        Policy = "string",
        AccountId = "string",
    });
    
    example, err := s3control.NewAccessGrantsInstanceResourcePolicy(ctx, "accessGrantsInstanceResourcePolicyResource", &s3control.AccessGrantsInstanceResourcePolicyArgs{
    	Policy:    pulumi.String("string"),
    	AccountId: pulumi.String("string"),
    })
    
    var accessGrantsInstanceResourcePolicyResource = new AccessGrantsInstanceResourcePolicy("accessGrantsInstanceResourcePolicyResource", AccessGrantsInstanceResourcePolicyArgs.builder()
        .policy("string")
        .accountId("string")
        .build());
    
    access_grants_instance_resource_policy_resource = aws.s3control.AccessGrantsInstanceResourcePolicy("accessGrantsInstanceResourcePolicyResource",
        policy="string",
        account_id="string")
    
    const accessGrantsInstanceResourcePolicyResource = new aws.s3control.AccessGrantsInstanceResourcePolicy("accessGrantsInstanceResourcePolicyResource", {
        policy: "string",
        accountId: "string",
    });
    
    type: aws:s3control:AccessGrantsInstanceResourcePolicy
    properties:
        accountId: string
        policy: string
    

    AccessGrantsInstanceResourcePolicy 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 AccessGrantsInstanceResourcePolicy resource accepts the following input properties:

    Policy string
    The policy document.
    AccountId string
    Policy string
    The policy document.
    AccountId string
    policy String
    The policy document.
    accountId String
    policy string
    The policy document.
    accountId string
    policy str
    The policy document.
    account_id str
    policy String
    The policy document.
    accountId String

    Outputs

    All input properties are implicitly available as output properties. Additionally, the AccessGrantsInstanceResourcePolicy 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 AccessGrantsInstanceResourcePolicy Resource

    Get an existing AccessGrantsInstanceResourcePolicy 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?: AccessGrantsInstanceResourcePolicyState, opts?: CustomResourceOptions): AccessGrantsInstanceResourcePolicy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            account_id: Optional[str] = None,
            policy: Optional[str] = None) -> AccessGrantsInstanceResourcePolicy
    func GetAccessGrantsInstanceResourcePolicy(ctx *Context, name string, id IDInput, state *AccessGrantsInstanceResourcePolicyState, opts ...ResourceOption) (*AccessGrantsInstanceResourcePolicy, error)
    public static AccessGrantsInstanceResourcePolicy Get(string name, Input<string> id, AccessGrantsInstanceResourcePolicyState? state, CustomResourceOptions? opts = null)
    public static AccessGrantsInstanceResourcePolicy get(String name, Output<String> id, AccessGrantsInstanceResourcePolicyState 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.
    The following state arguments are supported:
    AccountId string
    Policy string
    The policy document.
    AccountId string
    Policy string
    The policy document.
    accountId String
    policy String
    The policy document.
    accountId string
    policy string
    The policy document.
    account_id str
    policy str
    The policy document.
    accountId String
    policy String
    The policy document.

    Import

    Using pulumi import, import S3 Access Grants instance resource policies using the account_id. For example:

    $ pulumi import aws:s3control/accessGrantsInstanceResourcePolicy:AccessGrantsInstanceResourcePolicy example 123456789012
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi