gcp.storage.ManagedFolder
Explore with Pulumi AI
A Google Cloud Storage Managed Folder.
You can apply Identity and Access Management (IAM) policies to managed folders to grant principals access only to the objects within the managed folder, which lets you more finely control access for specific data sets and tables within a bucket. You can nest managed folders up to 15 levels deep, including the parent managed folder.
Managed folders can only be created in buckets that have uniform bucket-level access enabled.
To get more information about ManagedFolder, see:
- API documentation
- How-to Guides
Example Usage
Storage Managed Folder Basic
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const bucket = new gcp.storage.Bucket("bucket", {
name: "my-bucket",
location: "EU",
uniformBucketLevelAccess: true,
});
const folder = new gcp.storage.ManagedFolder("folder", {
bucket: bucket.name,
name: "managed/folder/name/",
forceDestroy: true,
});
import pulumi
import pulumi_gcp as gcp
bucket = gcp.storage.Bucket("bucket",
name="my-bucket",
location="EU",
uniform_bucket_level_access=True)
folder = gcp.storage.ManagedFolder("folder",
bucket=bucket.name,
name="managed/folder/name/",
force_destroy=True)
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/storage"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
bucket, err := storage.NewBucket(ctx, "bucket", &storage.BucketArgs{
Name: pulumi.String("my-bucket"),
Location: pulumi.String("EU"),
UniformBucketLevelAccess: pulumi.Bool(true),
})
if err != nil {
return err
}
_, err = storage.NewManagedFolder(ctx, "folder", &storage.ManagedFolderArgs{
Bucket: bucket.Name,
Name: pulumi.String("managed/folder/name/"),
ForceDestroy: pulumi.Bool(true),
})
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 bucket = new Gcp.Storage.Bucket("bucket", new()
{
Name = "my-bucket",
Location = "EU",
UniformBucketLevelAccess = true,
});
var folder = new Gcp.Storage.ManagedFolder("folder", new()
{
Bucket = bucket.Name,
Name = "managed/folder/name/",
ForceDestroy = true,
});
});
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.ManagedFolder;
import com.pulumi.gcp.storage.ManagedFolderArgs;
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 bucket = new Bucket("bucket", BucketArgs.builder()
.name("my-bucket")
.location("EU")
.uniformBucketLevelAccess(true)
.build());
var folder = new ManagedFolder("folder", ManagedFolderArgs.builder()
.bucket(bucket.name())
.name("managed/folder/name/")
.forceDestroy(true)
.build());
}
}
resources:
bucket:
type: gcp:storage:Bucket
properties:
name: my-bucket
location: EU
uniformBucketLevelAccess: true
folder:
type: gcp:storage:ManagedFolder
properties:
bucket: ${bucket.name}
name: managed/folder/name/
forceDestroy: true
Create ManagedFolder Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ManagedFolder(name: string, args: ManagedFolderArgs, opts?: CustomResourceOptions);
@overload
def ManagedFolder(resource_name: str,
args: ManagedFolderArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ManagedFolder(resource_name: str,
opts: Optional[ResourceOptions] = None,
bucket: Optional[str] = None,
force_destroy: Optional[bool] = None,
name: Optional[str] = None)
func NewManagedFolder(ctx *Context, name string, args ManagedFolderArgs, opts ...ResourceOption) (*ManagedFolder, error)
public ManagedFolder(string name, ManagedFolderArgs args, CustomResourceOptions? opts = null)
public ManagedFolder(String name, ManagedFolderArgs args)
public ManagedFolder(String name, ManagedFolderArgs args, CustomResourceOptions options)
type: gcp:storage:ManagedFolder
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 ManagedFolderArgs
- 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 ManagedFolderArgs
- 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 ManagedFolderArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ManagedFolderArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ManagedFolderArgs
- 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 managedFolderResource = new Gcp.Storage.ManagedFolder("managedFolderResource", new()
{
Bucket = "string",
ForceDestroy = false,
Name = "string",
});
example, err := storage.NewManagedFolder(ctx, "managedFolderResource", &storage.ManagedFolderArgs{
Bucket: pulumi.String("string"),
ForceDestroy: pulumi.Bool(false),
Name: pulumi.String("string"),
})
var managedFolderResource = new ManagedFolder("managedFolderResource", ManagedFolderArgs.builder()
.bucket("string")
.forceDestroy(false)
.name("string")
.build());
managed_folder_resource = gcp.storage.ManagedFolder("managedFolderResource",
bucket="string",
force_destroy=False,
name="string")
const managedFolderResource = new gcp.storage.ManagedFolder("managedFolderResource", {
bucket: "string",
forceDestroy: false,
name: "string",
});
type: gcp:storage:ManagedFolder
properties:
bucket: string
forceDestroy: false
name: string
ManagedFolder Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The ManagedFolder resource accepts the following input properties:
- Bucket string
- The name of the bucket that contains the managed folder.
- Force
Destroy bool - Allows the deletion of a managed folder even if contains objects. If a non-empty managed folder is deleted, any objects within the folder will remain in a simulated folder with the same name.
- Name string
- The name of the managed folder expressed as a path. Must include
trailing '/'. For example,
example_dir/example_dir2/
.
- Bucket string
- The name of the bucket that contains the managed folder.
- Force
Destroy bool - Allows the deletion of a managed folder even if contains objects. If a non-empty managed folder is deleted, any objects within the folder will remain in a simulated folder with the same name.
- Name string
- The name of the managed folder expressed as a path. Must include
trailing '/'. For example,
example_dir/example_dir2/
.
- bucket String
- The name of the bucket that contains the managed folder.
- force
Destroy Boolean - Allows the deletion of a managed folder even if contains objects. If a non-empty managed folder is deleted, any objects within the folder will remain in a simulated folder with the same name.
- name String
- The name of the managed folder expressed as a path. Must include
trailing '/'. For example,
example_dir/example_dir2/
.
- bucket string
- The name of the bucket that contains the managed folder.
- force
Destroy boolean - Allows the deletion of a managed folder even if contains objects. If a non-empty managed folder is deleted, any objects within the folder will remain in a simulated folder with the same name.
- name string
- The name of the managed folder expressed as a path. Must include
trailing '/'. For example,
example_dir/example_dir2/
.
- bucket str
- The name of the bucket that contains the managed folder.
- force_
destroy bool - Allows the deletion of a managed folder even if contains objects. If a non-empty managed folder is deleted, any objects within the folder will remain in a simulated folder with the same name.
- name str
- The name of the managed folder expressed as a path. Must include
trailing '/'. For example,
example_dir/example_dir2/
.
- bucket String
- The name of the bucket that contains the managed folder.
- force
Destroy Boolean - Allows the deletion of a managed folder even if contains objects. If a non-empty managed folder is deleted, any objects within the folder will remain in a simulated folder with the same name.
- name String
- The name of the managed folder expressed as a path. Must include
trailing '/'. For example,
example_dir/example_dir2/
.
Outputs
All input properties are implicitly available as output properties. Additionally, the ManagedFolder resource produces the following output properties:
- Create
Time string - The timestamp at which this managed folder was created.
- Id string
- The provider-assigned unique ID for this managed resource.
- Metageneration string
- The metadata generation of the managed folder.
- Self
Link string - The URI of the created resource.
- Update
Time string - The timestamp at which this managed folder was most recently updated.
- Create
Time string - The timestamp at which this managed folder was created.
- Id string
- The provider-assigned unique ID for this managed resource.
- Metageneration string
- The metadata generation of the managed folder.
- Self
Link string - The URI of the created resource.
- Update
Time string - The timestamp at which this managed folder was most recently updated.
- create
Time String - The timestamp at which this managed folder was created.
- id String
- The provider-assigned unique ID for this managed resource.
- metageneration String
- The metadata generation of the managed folder.
- self
Link String - The URI of the created resource.
- update
Time String - The timestamp at which this managed folder was most recently updated.
- create
Time string - The timestamp at which this managed folder was created.
- id string
- The provider-assigned unique ID for this managed resource.
- metageneration string
- The metadata generation of the managed folder.
- self
Link string - The URI of the created resource.
- update
Time string - The timestamp at which this managed folder was most recently updated.
- create_
time str - The timestamp at which this managed folder was created.
- id str
- The provider-assigned unique ID for this managed resource.
- metageneration str
- The metadata generation of the managed folder.
- self_
link str - The URI of the created resource.
- update_
time str - The timestamp at which this managed folder was most recently updated.
- create
Time String - The timestamp at which this managed folder was created.
- id String
- The provider-assigned unique ID for this managed resource.
- metageneration String
- The metadata generation of the managed folder.
- self
Link String - The URI of the created resource.
- update
Time String - The timestamp at which this managed folder was most recently updated.
Look up Existing ManagedFolder Resource
Get an existing ManagedFolder 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?: ManagedFolderState, opts?: CustomResourceOptions): ManagedFolder
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
bucket: Optional[str] = None,
create_time: Optional[str] = None,
force_destroy: Optional[bool] = None,
metageneration: Optional[str] = None,
name: Optional[str] = None,
self_link: Optional[str] = None,
update_time: Optional[str] = None) -> ManagedFolder
func GetManagedFolder(ctx *Context, name string, id IDInput, state *ManagedFolderState, opts ...ResourceOption) (*ManagedFolder, error)
public static ManagedFolder Get(string name, Input<string> id, ManagedFolderState? state, CustomResourceOptions? opts = null)
public static ManagedFolder get(String name, Output<String> id, ManagedFolderState 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.
- Bucket string
- The name of the bucket that contains the managed folder.
- Create
Time string - The timestamp at which this managed folder was created.
- Force
Destroy bool - Allows the deletion of a managed folder even if contains objects. If a non-empty managed folder is deleted, any objects within the folder will remain in a simulated folder with the same name.
- Metageneration string
- The metadata generation of the managed folder.
- Name string
- The name of the managed folder expressed as a path. Must include
trailing '/'. For example,
example_dir/example_dir2/
. - Self
Link string - The URI of the created resource.
- Update
Time string - The timestamp at which this managed folder was most recently updated.
- Bucket string
- The name of the bucket that contains the managed folder.
- Create
Time string - The timestamp at which this managed folder was created.
- Force
Destroy bool - Allows the deletion of a managed folder even if contains objects. If a non-empty managed folder is deleted, any objects within the folder will remain in a simulated folder with the same name.
- Metageneration string
- The metadata generation of the managed folder.
- Name string
- The name of the managed folder expressed as a path. Must include
trailing '/'. For example,
example_dir/example_dir2/
. - Self
Link string - The URI of the created resource.
- Update
Time string - The timestamp at which this managed folder was most recently updated.
- bucket String
- The name of the bucket that contains the managed folder.
- create
Time String - The timestamp at which this managed folder was created.
- force
Destroy Boolean - Allows the deletion of a managed folder even if contains objects. If a non-empty managed folder is deleted, any objects within the folder will remain in a simulated folder with the same name.
- metageneration String
- The metadata generation of the managed folder.
- name String
- The name of the managed folder expressed as a path. Must include
trailing '/'. For example,
example_dir/example_dir2/
. - self
Link String - The URI of the created resource.
- update
Time String - The timestamp at which this managed folder was most recently updated.
- bucket string
- The name of the bucket that contains the managed folder.
- create
Time string - The timestamp at which this managed folder was created.
- force
Destroy boolean - Allows the deletion of a managed folder even if contains objects. If a non-empty managed folder is deleted, any objects within the folder will remain in a simulated folder with the same name.
- metageneration string
- The metadata generation of the managed folder.
- name string
- The name of the managed folder expressed as a path. Must include
trailing '/'. For example,
example_dir/example_dir2/
. - self
Link string - The URI of the created resource.
- update
Time string - The timestamp at which this managed folder was most recently updated.
- bucket str
- The name of the bucket that contains the managed folder.
- create_
time str - The timestamp at which this managed folder was created.
- force_
destroy bool - Allows the deletion of a managed folder even if contains objects. If a non-empty managed folder is deleted, any objects within the folder will remain in a simulated folder with the same name.
- metageneration str
- The metadata generation of the managed folder.
- name str
- The name of the managed folder expressed as a path. Must include
trailing '/'. For example,
example_dir/example_dir2/
. - self_
link str - The URI of the created resource.
- update_
time str - The timestamp at which this managed folder was most recently updated.
- bucket String
- The name of the bucket that contains the managed folder.
- create
Time String - The timestamp at which this managed folder was created.
- force
Destroy Boolean - Allows the deletion of a managed folder even if contains objects. If a non-empty managed folder is deleted, any objects within the folder will remain in a simulated folder with the same name.
- metageneration String
- The metadata generation of the managed folder.
- name String
- The name of the managed folder expressed as a path. Must include
trailing '/'. For example,
example_dir/example_dir2/
. - self
Link String - The URI of the created resource.
- update
Time String - The timestamp at which this managed folder was most recently updated.
Import
ManagedFolder can be imported using any of these accepted formats:
{{bucket}}/managedFolders/{{name}}
{{bucket}}/{{name}}
When using the pulumi import
command, ManagedFolder can be imported using one of the formats above. For example:
$ pulumi import gcp:storage/managedFolder:ManagedFolder default {{bucket}}/managedFolders/{{name}}
$ pulumi import gcp:storage/managedFolder:ManagedFolder default {{bucket}}/{{name}}
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.