1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. storage
  5. DefaultObjectACL
Google Cloud Classic v7.20.0 published on Wednesday, Apr 24, 2024 by Pulumi

gcp.storage.DefaultObjectACL

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.20.0 published on Wednesday, Apr 24, 2024 by Pulumi

    Authoritatively manages the default object ACLs for a Google Cloud Storage bucket without managing the bucket itself.

    Note that for each object, its creator will have the "OWNER" role in addition to the default ACL that has been defined.

    For more information see the official documentation and API.

    Want fine-grained control over default object ACLs? Use gcp.storage.DefaultObjectAccessControl to control individual role entity pairs.

    Example Usage

    Example creating a default object ACL on a bucket with one owner, and one reader.

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const image_store = new gcp.storage.Bucket("image-store", {
        name: "image-store-bucket",
        location: "EU",
    });
    const image_store_default_acl = new gcp.storage.DefaultObjectACL("image-store-default-acl", {
        bucket: image_store.name,
        roleEntities: [
            "OWNER:user-my.email@gmail.com",
            "READER:group-mygroup",
        ],
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    image_store = gcp.storage.Bucket("image-store",
        name="image-store-bucket",
        location="EU")
    image_store_default_acl = gcp.storage.DefaultObjectACL("image-store-default-acl",
        bucket=image_store.name,
        role_entities=[
            "OWNER:user-my.email@gmail.com",
            "READER:group-mygroup",
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/storage"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := storage.NewBucket(ctx, "image-store", &storage.BucketArgs{
    			Name:     pulumi.String("image-store-bucket"),
    			Location: pulumi.String("EU"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = storage.NewDefaultObjectACL(ctx, "image-store-default-acl", &storage.DefaultObjectACLArgs{
    			Bucket: image_store.Name,
    			RoleEntities: pulumi.StringArray{
    				pulumi.String("OWNER:user-my.email@gmail.com"),
    				pulumi.String("READER:group-mygroup"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var image_store = new Gcp.Storage.Bucket("image-store", new()
        {
            Name = "image-store-bucket",
            Location = "EU",
        });
    
        var image_store_default_acl = new Gcp.Storage.DefaultObjectACL("image-store-default-acl", new()
        {
            Bucket = image_store.Name,
            RoleEntities = new[]
            {
                "OWNER:user-my.email@gmail.com",
                "READER:group-mygroup",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.storage.Bucket;
    import com.pulumi.gcp.storage.BucketArgs;
    import com.pulumi.gcp.storage.DefaultObjectACL;
    import com.pulumi.gcp.storage.DefaultObjectACLArgs;
    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 image_store = new Bucket("image-store", BucketArgs.builder()        
                .name("image-store-bucket")
                .location("EU")
                .build());
    
            var image_store_default_acl = new DefaultObjectACL("image-store-default-acl", DefaultObjectACLArgs.builder()        
                .bucket(image_store.name())
                .roleEntities(            
                    "OWNER:user-my.email@gmail.com",
                    "READER:group-mygroup")
                .build());
    
        }
    }
    
    resources:
      image-store:
        type: gcp:storage:Bucket
        properties:
          name: image-store-bucket
          location: EU
      image-store-default-acl:
        type: gcp:storage:DefaultObjectACL
        properties:
          bucket: ${["image-store"].name}
          roleEntities:
            - OWNER:user-my.email@gmail.com
            - READER:group-mygroup
    

    Create DefaultObjectACL Resource

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

    Constructor syntax

    new DefaultObjectACL(name: string, args: DefaultObjectACLArgs, opts?: CustomResourceOptions);
    @overload
    def DefaultObjectACL(resource_name: str,
                         args: DefaultObjectACLArgs,
                         opts: Optional[ResourceOptions] = None)
    
    @overload
    def DefaultObjectACL(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         bucket: Optional[str] = None,
                         role_entities: Optional[Sequence[str]] = None)
    func NewDefaultObjectACL(ctx *Context, name string, args DefaultObjectACLArgs, opts ...ResourceOption) (*DefaultObjectACL, error)
    public DefaultObjectACL(string name, DefaultObjectACLArgs args, CustomResourceOptions? opts = null)
    public DefaultObjectACL(String name, DefaultObjectACLArgs args)
    public DefaultObjectACL(String name, DefaultObjectACLArgs args, CustomResourceOptions options)
    
    type: gcp:storage:DefaultObjectACL
    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 DefaultObjectACLArgs
    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 DefaultObjectACLArgs
    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 DefaultObjectACLArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DefaultObjectACLArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DefaultObjectACLArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

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

    var defaultObjectACLResource = new Gcp.Storage.DefaultObjectACL("defaultObjectACLResource", new()
    {
        Bucket = "string",
        RoleEntities = new[]
        {
            "string",
        },
    });
    
    example, err := storage.NewDefaultObjectACL(ctx, "defaultObjectACLResource", &storage.DefaultObjectACLArgs{
    	Bucket: pulumi.String("string"),
    	RoleEntities: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    })
    
    var defaultObjectACLResource = new DefaultObjectACL("defaultObjectACLResource", DefaultObjectACLArgs.builder()        
        .bucket("string")
        .roleEntities("string")
        .build());
    
    default_object_acl_resource = gcp.storage.DefaultObjectACL("defaultObjectACLResource",
        bucket="string",
        role_entities=["string"])
    
    const defaultObjectACLResource = new gcp.storage.DefaultObjectACL("defaultObjectACLResource", {
        bucket: "string",
        roleEntities: ["string"],
    });
    
    type: gcp:storage:DefaultObjectACL
    properties:
        bucket: string
        roleEntities:
            - string
    

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

    Bucket string
    The name of the bucket it applies to.
    RoleEntities List<string>
    List of role/entity pairs in the form ROLE:entity. See GCS Object ACL documentation for more details. Omitting the field is the same as providing an empty list.
    Bucket string
    The name of the bucket it applies to.
    RoleEntities []string
    List of role/entity pairs in the form ROLE:entity. See GCS Object ACL documentation for more details. Omitting the field is the same as providing an empty list.
    bucket String
    The name of the bucket it applies to.
    roleEntities List<String>
    List of role/entity pairs in the form ROLE:entity. See GCS Object ACL documentation for more details. Omitting the field is the same as providing an empty list.
    bucket string
    The name of the bucket it applies to.
    roleEntities string[]
    List of role/entity pairs in the form ROLE:entity. See GCS Object ACL documentation for more details. Omitting the field is the same as providing an empty list.
    bucket str
    The name of the bucket it applies to.
    role_entities Sequence[str]
    List of role/entity pairs in the form ROLE:entity. See GCS Object ACL documentation for more details. Omitting the field is the same as providing an empty list.
    bucket String
    The name of the bucket it applies to.
    roleEntities List<String>
    List of role/entity pairs in the form ROLE:entity. See GCS Object ACL documentation for more details. Omitting the field is the same as providing an empty list.

    Outputs

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

    Get an existing DefaultObjectACL 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?: DefaultObjectACLState, opts?: CustomResourceOptions): DefaultObjectACL
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            bucket: Optional[str] = None,
            role_entities: Optional[Sequence[str]] = None) -> DefaultObjectACL
    func GetDefaultObjectACL(ctx *Context, name string, id IDInput, state *DefaultObjectACLState, opts ...ResourceOption) (*DefaultObjectACL, error)
    public static DefaultObjectACL Get(string name, Input<string> id, DefaultObjectACLState? state, CustomResourceOptions? opts = null)
    public static DefaultObjectACL get(String name, Output<String> id, DefaultObjectACLState 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:
    Bucket string
    The name of the bucket it applies to.
    RoleEntities List<string>
    List of role/entity pairs in the form ROLE:entity. See GCS Object ACL documentation for more details. Omitting the field is the same as providing an empty list.
    Bucket string
    The name of the bucket it applies to.
    RoleEntities []string
    List of role/entity pairs in the form ROLE:entity. See GCS Object ACL documentation for more details. Omitting the field is the same as providing an empty list.
    bucket String
    The name of the bucket it applies to.
    roleEntities List<String>
    List of role/entity pairs in the form ROLE:entity. See GCS Object ACL documentation for more details. Omitting the field is the same as providing an empty list.
    bucket string
    The name of the bucket it applies to.
    roleEntities string[]
    List of role/entity pairs in the form ROLE:entity. See GCS Object ACL documentation for more details. Omitting the field is the same as providing an empty list.
    bucket str
    The name of the bucket it applies to.
    role_entities Sequence[str]
    List of role/entity pairs in the form ROLE:entity. See GCS Object ACL documentation for more details. Omitting the field is the same as providing an empty list.
    bucket String
    The name of the bucket it applies to.
    roleEntities List<String>
    List of role/entity pairs in the form ROLE:entity. See GCS Object ACL documentation for more details. Omitting the field is the same as providing an empty list.

    Import

    This resource does not support import.

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

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v7.20.0 published on Wednesday, Apr 24, 2024 by Pulumi