Google Cloud (GCP) Classic

v6.39.0 published on Wednesday, Sep 28, 2022 by Pulumi

DefaultObjectACL

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

using System.Collections.Generic;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var image_store = new Gcp.Storage.Bucket("image-store", new()
    {
        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 main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/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{
			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
	})
}
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()        
            .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());

    }
}
import pulumi
import pulumi_gcp as gcp

image_store = gcp.storage.Bucket("image-store", 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",
    ])
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const image_store = new gcp.storage.Bucket("image-store", {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",
    ],
});
resources:
  image-store:
    type: gcp:storage:Bucket
    properties:
      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 a DefaultObjectACL Resource

new DefaultObjectACL(name: string, args: DefaultObjectACLArgs, opts?: CustomResourceOptions);
@overload
def DefaultObjectACL(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     bucket: Optional[str] = None,
                     role_entities: Optional[Sequence[str]] = None)
@overload
def DefaultObjectACL(resource_name: str,
                     args: DefaultObjectACLArgs,
                     opts: Optional[ResourceOptions] = 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.

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.

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 an 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.

Package Details

Repository
https://github.com/pulumi/pulumi-gcp
License
Apache-2.0
Notes

This Pulumi package is based on the google-beta Terraform Provider.