@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
219 lines • 9.08 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
/**
* A LocationTagBinding represents a connection between a TagValue and a non-global target such as a Cloud Run Service or Compute Instance. Once a LocationTagBinding is created, the TagValue is applied to all the descendants of the cloud resource.
*
* To get more information about LocationTagBinding, see:
*
* * [API documentation](https://docs.cloud.google.com/resource-manager/reference/rest/v3/tagBindings)
* * How-to Guides
* * [Official Documentation](https://docs.cloud.google.com/resource-manager/docs/tags/tags-creating-and-managing)
*
* ## Example Usage
*
* ### Cloud Run Service
*
* To bind a tag to a Cloud Run service:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const project = new gcp.organizations.Project("project", {
* projectId: "project_id",
* name: "project_id",
* orgId: "123456789",
* });
* const key = new gcp.tags.TagKey("key", {
* parent: "organizations/123456789",
* shortName: "keyname",
* description: "For keyname resources.",
* });
* const value = new gcp.tags.TagValue("value", {
* parent: key.id,
* shortName: "valuename",
* description: "For valuename resources.",
* });
* const binding = new gcp.tags.LocationTagBinding("binding", {
* parent: `//run.googleapis.com/projects/${projectGoogleProject.number}/locations/${_default.location}/services/${_default.name}`,
* tagValue: value.id,
* location: "us-central1",
* });
* ```
*
* ### Compute Instance
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const project = new gcp.organizations.Project("project", {
* projectId: "project_id",
* name: "project_id",
* orgId: "123456789",
* });
* const key = new gcp.tags.TagKey("key", {
* parent: "organizations/123456789",
* shortName: "keyname",
* description: "For keyname resources.",
* });
* const value = new gcp.tags.TagValue("value", {
* parent: key.id,
* shortName: "valuename",
* description: "For valuename resources.",
* });
* const binding = new gcp.tags.LocationTagBinding("binding", {
* parent: pulumi.interpolate`//compute.googleapis.com/projects/${project.number}/zones/us-central1-a/instances/${instance.instanceId}`,
* tagValue: value.id,
* location: "us-central1-a",
* });
* ```
*
* ### Compute Instance With Dynamic Tag Value
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const project = new gcp.organizations.Project("project", {
* projectId: "project_id",
* name: "project_id",
* orgId: "123456789",
* });
* const key = new gcp.tags.TagKey("key", {
* parent: "organizations/123456789",
* shortName: "keyname",
* description: "For keyname resources.",
* allowedValuesRegex: "^[a-z]+$",
* });
* const binding = new gcp.tags.LocationTagBinding("binding", {
* parent: pulumi.interpolate`//compute.googleapis.com/projects/${project.number}/zones/us-central1-a/instances/${instance.instanceId}`,
* tagValue: pulumi.interpolate`${key.namespacedName}/test-value`,
* location: "us-central1-a",
* });
* ```
*
* ## Import
*
* LocationTagBinding can be imported using any of these accepted formats:
*
* * `{{location}}/{{name}}`
*
* When using the `pulumi import` command, TagBinding can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:tags/locationTagBinding:LocationTagBinding default {{location}}/{{name}}
* ```
*/
export declare class LocationTagBinding extends pulumi.CustomResource {
/**
* Get an existing LocationTagBinding resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name: string, id: pulumi.Input<pulumi.ID>, state?: LocationTagBindingState, opts?: pulumi.CustomResourceOptions): LocationTagBinding;
/**
* Returns true if the given object is an instance of LocationTagBinding. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is LocationTagBinding;
/**
* Whether Terraform will be prevented from destroying the resource. Defaults to "DELETE".
* When a 'terraform destroy' or 'pulumi up' would delete the resource,
* the command will fail if this field is set to "PREVENT" in Terraform state.
* When set to "ABANDON", the command will remove the resource from Terraform
* management without updating or deleting the resource in the API.
* When set to "DELETE", deleting the resource is allowed.
*
* - - -
*/
readonly deletionPolicy: pulumi.Output<string>;
/**
* Location of the target resource.
*/
readonly location: pulumi.Output<string | undefined>;
/**
* The generated id for the TagBinding. This is a string of the form `tagBindings/{full-resource-name}/{tag-value-name}` or `tagBindings/{full-resource-name}/{tag-key-name}`
*/
readonly name: pulumi.Output<string>;
/**
* The full resource name of the resource the TagValue is bound to. E.g. //cloudresourcemanager.googleapis.com/projects/123
*/
readonly parent: pulumi.Output<string>;
/**
* The TagValue of the TagBinding. Must be either in id format `tagValues/{tag-value-id}`, or namespaced format `{parent-id}/{tag-key-short-name}/{tag-value-short-name}`.
*/
readonly tagValue: pulumi.Output<string>;
/**
* Create a LocationTagBinding resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: LocationTagBindingArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering LocationTagBinding resources.
*/
export interface LocationTagBindingState {
/**
* Whether Terraform will be prevented from destroying the resource. Defaults to "DELETE".
* When a 'terraform destroy' or 'pulumi up' would delete the resource,
* the command will fail if this field is set to "PREVENT" in Terraform state.
* When set to "ABANDON", the command will remove the resource from Terraform
* management without updating or deleting the resource in the API.
* When set to "DELETE", deleting the resource is allowed.
*
* - - -
*/
deletionPolicy?: pulumi.Input<string | undefined>;
/**
* Location of the target resource.
*/
location?: pulumi.Input<string | undefined>;
/**
* The generated id for the TagBinding. This is a string of the form `tagBindings/{full-resource-name}/{tag-value-name}` or `tagBindings/{full-resource-name}/{tag-key-name}`
*/
name?: pulumi.Input<string | undefined>;
/**
* The full resource name of the resource the TagValue is bound to. E.g. //cloudresourcemanager.googleapis.com/projects/123
*/
parent?: pulumi.Input<string | undefined>;
/**
* The TagValue of the TagBinding. Must be either in id format `tagValues/{tag-value-id}`, or namespaced format `{parent-id}/{tag-key-short-name}/{tag-value-short-name}`.
*/
tagValue?: pulumi.Input<string | undefined>;
}
/**
* The set of arguments for constructing a LocationTagBinding resource.
*/
export interface LocationTagBindingArgs {
/**
* Whether Terraform will be prevented from destroying the resource. Defaults to "DELETE".
* When a 'terraform destroy' or 'pulumi up' would delete the resource,
* the command will fail if this field is set to "PREVENT" in Terraform state.
* When set to "ABANDON", the command will remove the resource from Terraform
* management without updating or deleting the resource in the API.
* When set to "DELETE", deleting the resource is allowed.
*
* - - -
*/
deletionPolicy?: pulumi.Input<string | undefined>;
/**
* Location of the target resource.
*/
location?: pulumi.Input<string | undefined>;
/**
* The full resource name of the resource the TagValue is bound to. E.g. //cloudresourcemanager.googleapis.com/projects/123
*/
parent: pulumi.Input<string>;
/**
* The TagValue of the TagBinding. Must be either in id format `tagValues/{tag-value-id}`, or namespaced format `{parent-id}/{tag-key-short-name}/{tag-value-short-name}`.
*/
tagValue: pulumi.Input<string>;
}
//# sourceMappingURL=locationTagBinding.d.ts.map