gcp.projects.UsageExportBucket
Explore with Pulumi AI
Allows creation and management of a Google Cloud Platform project.
Projects created with this resource must be associated with an Organization. See the Organization documentation for more details.
The user or service account that is running this provider when creating a gcp.organizations.Project
resource must have roles/resourcemanager.projectCreator
on the specified organization. See the
Access Control for Organizations Using IAM
doc for more information.
This resource reads the specified billing account on every pulumi up and plan operation so you must have permissions on the specified billing account.
It is recommended to use the
constraints/compute.skipDefaultNetworkCreation
constraint to remove the default network instead of settingauto_create_network
to false, when possible.
It may take a while for the attached tag bindings to be deleted after the project is scheduled to be deleted.
To get more information about projects, see:
- API documentation
- How-to Guides
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const myProject = new gcp.organizations.Project("my_project", {
name: "My Project",
projectId: "your-project-id",
orgId: "1234567",
});
import pulumi
import pulumi_gcp as gcp
my_project = gcp.organizations.Project("my_project",
name="My Project",
project_id="your-project-id",
org_id="1234567")
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/organizations"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := organizations.NewProject(ctx, "my_project", &organizations.ProjectArgs{
Name: pulumi.String("My Project"),
ProjectId: pulumi.String("your-project-id"),
OrgId: pulumi.String("1234567"),
})
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 myProject = new Gcp.Organizations.Project("my_project", new()
{
Name = "My Project",
ProjectId = "your-project-id",
OrgId = "1234567",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.Project;
import com.pulumi.gcp.organizations.ProjectArgs;
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 myProject = new Project("myProject", ProjectArgs.builder()
.name("My Project")
.projectId("your-project-id")
.orgId("1234567")
.build());
}
}
resources:
myProject:
type: gcp:organizations:Project
name: my_project
properties:
name: My Project
projectId: your-project-id
orgId: '1234567'
To create a project under a specific folder
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const department1 = new gcp.organizations.Folder("department1", {
displayName: "Department 1",
parent: "organizations/1234567",
});
const myProject_in_a_folder = new gcp.organizations.Project("my_project-in-a-folder", {
name: "My Project",
projectId: "your-project-id",
folderId: department1.name,
});
import pulumi
import pulumi_gcp as gcp
department1 = gcp.organizations.Folder("department1",
display_name="Department 1",
parent="organizations/1234567")
my_project_in_a_folder = gcp.organizations.Project("my_project-in-a-folder",
name="My Project",
project_id="your-project-id",
folder_id=department1.name)
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/organizations"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
department1, err := organizations.NewFolder(ctx, "department1", &organizations.FolderArgs{
DisplayName: pulumi.String("Department 1"),
Parent: pulumi.String("organizations/1234567"),
})
if err != nil {
return err
}
_, err = organizations.NewProject(ctx, "my_project-in-a-folder", &organizations.ProjectArgs{
Name: pulumi.String("My Project"),
ProjectId: pulumi.String("your-project-id"),
FolderId: department1.Name,
})
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 department1 = new Gcp.Organizations.Folder("department1", new()
{
DisplayName = "Department 1",
Parent = "organizations/1234567",
});
var myProject_in_a_folder = new Gcp.Organizations.Project("my_project-in-a-folder", new()
{
Name = "My Project",
ProjectId = "your-project-id",
FolderId = department1.Name,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.Folder;
import com.pulumi.gcp.organizations.FolderArgs;
import com.pulumi.gcp.organizations.Project;
import com.pulumi.gcp.organizations.ProjectArgs;
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 department1 = new Folder("department1", FolderArgs.builder()
.displayName("Department 1")
.parent("organizations/1234567")
.build());
var myProject_in_a_folder = new Project("myProject-in-a-folder", ProjectArgs.builder()
.name("My Project")
.projectId("your-project-id")
.folderId(department1.name())
.build());
}
}
resources:
myProject-in-a-folder:
type: gcp:organizations:Project
name: my_project-in-a-folder
properties:
name: My Project
projectId: your-project-id
folderId: ${department1.name}
department1:
type: gcp:organizations:Folder
properties:
displayName: Department 1
parent: organizations/1234567
To create a project with a tag
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const myProject = new gcp.organizations.Project("my_project", {
name: "My Project",
projectId: "your-project-id",
orgId: "1234567",
tags: {
"1234567/env": "staging",
},
});
import pulumi
import pulumi_gcp as gcp
my_project = gcp.organizations.Project("my_project",
name="My Project",
project_id="your-project-id",
org_id="1234567",
tags={
"1234567/env": "staging",
})
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/organizations"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := organizations.NewProject(ctx, "my_project", &organizations.ProjectArgs{
Name: pulumi.String("My Project"),
ProjectId: pulumi.String("your-project-id"),
OrgId: pulumi.String("1234567"),
Tags: pulumi.StringMap{
"1234567/env": pulumi.String("staging"),
},
})
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 myProject = new Gcp.Organizations.Project("my_project", new()
{
Name = "My Project",
ProjectId = "your-project-id",
OrgId = "1234567",
Tags =
{
{ "1234567/env", "staging" },
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.Project;
import com.pulumi.gcp.organizations.ProjectArgs;
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 myProject = new Project("myProject", ProjectArgs.builder()
.name("My Project")
.projectId("your-project-id")
.orgId("1234567")
.tags(Map.of("1234567/env", "staging"))
.build());
}
}
resources:
myProject:
type: gcp:organizations:Project
name: my_project
properties:
name: My Project
projectId: your-project-id
orgId: '1234567'
tags:
1234567/env: staging
Create UsageExportBucket Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new UsageExportBucket(name: string, args: UsageExportBucketArgs, opts?: CustomResourceOptions);
@overload
def UsageExportBucket(resource_name: str,
args: UsageExportBucketArgs,
opts: Optional[ResourceOptions] = None)
@overload
def UsageExportBucket(resource_name: str,
opts: Optional[ResourceOptions] = None,
bucket_name: Optional[str] = None,
prefix: Optional[str] = None,
project: Optional[str] = None)
func NewUsageExportBucket(ctx *Context, name string, args UsageExportBucketArgs, opts ...ResourceOption) (*UsageExportBucket, error)
public UsageExportBucket(string name, UsageExportBucketArgs args, CustomResourceOptions? opts = null)
public UsageExportBucket(String name, UsageExportBucketArgs args)
public UsageExportBucket(String name, UsageExportBucketArgs args, CustomResourceOptions options)
type: gcp:projects:UsageExportBucket
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 UsageExportBucketArgs
- 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 UsageExportBucketArgs
- 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 UsageExportBucketArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args UsageExportBucketArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args UsageExportBucketArgs
- 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 usageExportBucketResource = new Gcp.Projects.UsageExportBucket("usageExportBucketResource", new()
{
BucketName = "string",
Prefix = "string",
Project = "string",
});
example, err := projects.NewUsageExportBucket(ctx, "usageExportBucketResource", &projects.UsageExportBucketArgs{
BucketName: pulumi.String("string"),
Prefix: pulumi.String("string"),
Project: pulumi.String("string"),
})
var usageExportBucketResource = new UsageExportBucket("usageExportBucketResource", UsageExportBucketArgs.builder()
.bucketName("string")
.prefix("string")
.project("string")
.build());
usage_export_bucket_resource = gcp.projects.UsageExportBucket("usageExportBucketResource",
bucket_name="string",
prefix="string",
project="string")
const usageExportBucketResource = new gcp.projects.UsageExportBucket("usageExportBucketResource", {
bucketName: "string",
prefix: "string",
project: "string",
});
type: gcp:projects:UsageExportBucket
properties:
bucketName: string
prefix: string
project: string
UsageExportBucket 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 UsageExportBucket resource accepts the following input properties:
- Bucket
Name string - The bucket to store reports in.
- Prefix string
- A prefix for the reports, for instance, the project name.
- Project string
- The project to set the export bucket on. If it is not provided, the provider project is used.
- Bucket
Name string - The bucket to store reports in.
- Prefix string
- A prefix for the reports, for instance, the project name.
- Project string
- The project to set the export bucket on. If it is not provided, the provider project is used.
- bucket
Name String - The bucket to store reports in.
- prefix String
- A prefix for the reports, for instance, the project name.
- project String
- The project to set the export bucket on. If it is not provided, the provider project is used.
- bucket
Name string - The bucket to store reports in.
- prefix string
- A prefix for the reports, for instance, the project name.
- project string
- The project to set the export bucket on. If it is not provided, the provider project is used.
- bucket_
name str - The bucket to store reports in.
- prefix str
- A prefix for the reports, for instance, the project name.
- project str
- The project to set the export bucket on. If it is not provided, the provider project is used.
- bucket
Name String - The bucket to store reports in.
- prefix String
- A prefix for the reports, for instance, the project name.
- project String
- The project to set the export bucket on. If it is not provided, the provider project is used.
Outputs
All input properties are implicitly available as output properties. Additionally, the UsageExportBucket 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 UsageExportBucket Resource
Get an existing UsageExportBucket 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?: UsageExportBucketState, opts?: CustomResourceOptions): UsageExportBucket
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
bucket_name: Optional[str] = None,
prefix: Optional[str] = None,
project: Optional[str] = None) -> UsageExportBucket
func GetUsageExportBucket(ctx *Context, name string, id IDInput, state *UsageExportBucketState, opts ...ResourceOption) (*UsageExportBucket, error)
public static UsageExportBucket Get(string name, Input<string> id, UsageExportBucketState? state, CustomResourceOptions? opts = null)
public static UsageExportBucket get(String name, Output<String> id, UsageExportBucketState 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
Name string - The bucket to store reports in.
- Prefix string
- A prefix for the reports, for instance, the project name.
- Project string
- The project to set the export bucket on. If it is not provided, the provider project is used.
- Bucket
Name string - The bucket to store reports in.
- Prefix string
- A prefix for the reports, for instance, the project name.
- Project string
- The project to set the export bucket on. If it is not provided, the provider project is used.
- bucket
Name String - The bucket to store reports in.
- prefix String
- A prefix for the reports, for instance, the project name.
- project String
- The project to set the export bucket on. If it is not provided, the provider project is used.
- bucket
Name string - The bucket to store reports in.
- prefix string
- A prefix for the reports, for instance, the project name.
- project string
- The project to set the export bucket on. If it is not provided, the provider project is used.
- bucket_
name str - The bucket to store reports in.
- prefix str
- A prefix for the reports, for instance, the project name.
- project str
- The project to set the export bucket on. If it is not provided, the provider project is used.
- bucket
Name String - The bucket to store reports in.
- prefix String
- A prefix for the reports, for instance, the project name.
- project String
- The project to set the export bucket on. If it is not provided, the provider project is used.
Import
Projects can be imported using the project_id
, e.g.
{{project_id}}
When using the pulumi import
command, Projects can be imported using one of the formats above. For example:
$ pulumi import gcp:projects/usageExportBucket:UsageExportBucket default {{project_id}}
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.