gcp.tags.TagValue
Explore with Pulumi AI
A TagValue is a child of a particular TagKey. TagValues are used to group cloud resources for the purpose of controlling them using policies.
To get more information about TagValue, see:
- API documentation
- How-to Guides
Example Usage
Tag Value Basic
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const key = new gcp.tags.TagKey("key", {
parent: "organizations/123456789",
shortName: "keyname",
description: "For keyname resources.",
});
const value = new gcp.tags.TagValue("value", {
parent: pulumi.interpolate`tagKeys/${key.name}`,
shortName: "valuename",
description: "For valuename resources.",
});
import pulumi
import pulumi_gcp as gcp
key = gcp.tags.TagKey("key",
parent="organizations/123456789",
short_name="keyname",
description="For keyname resources.")
value = gcp.tags.TagValue("value",
parent=key.name.apply(lambda name: f"tagKeys/{name}"),
short_name="valuename",
description="For valuename resources.")
package main
import (
"fmt"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/tags"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
key, err := tags.NewTagKey(ctx, "key", &tags.TagKeyArgs{
Parent: pulumi.String("organizations/123456789"),
ShortName: pulumi.String("keyname"),
Description: pulumi.String("For keyname resources."),
})
if err != nil {
return err
}
_, err = tags.NewTagValue(ctx, "value", &tags.TagValueArgs{
Parent: key.Name.ApplyT(func(name string) (string, error) {
return fmt.Sprintf("tagKeys/%v", name), nil
}).(pulumi.StringOutput),
ShortName: pulumi.String("valuename"),
Description: pulumi.String("For valuename resources."),
})
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 key = new Gcp.Tags.TagKey("key", new()
{
Parent = "organizations/123456789",
ShortName = "keyname",
Description = "For keyname resources.",
});
var @value = new Gcp.Tags.TagValue("value", new()
{
Parent = key.Name.Apply(name => $"tagKeys/{name}"),
ShortName = "valuename",
Description = "For valuename resources.",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.tags.TagKey;
import com.pulumi.gcp.tags.TagKeyArgs;
import com.pulumi.gcp.tags.TagValue;
import com.pulumi.gcp.tags.TagValueArgs;
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 key = new TagKey("key", TagKeyArgs.builder()
.parent("organizations/123456789")
.shortName("keyname")
.description("For keyname resources.")
.build());
var value = new TagValue("value", TagValueArgs.builder()
.parent(key.name().applyValue(name -> String.format("tagKeys/%s", name)))
.shortName("valuename")
.description("For valuename resources.")
.build());
}
}
resources:
key:
type: gcp:tags:TagKey
properties:
parent: organizations/123456789
shortName: keyname
description: For keyname resources.
value:
type: gcp:tags:TagValue
properties:
parent: tagKeys/${key.name}
shortName: valuename
description: For valuename resources.
Create TagValue Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new TagValue(name: string, args: TagValueArgs, opts?: CustomResourceOptions);
@overload
def TagValue(resource_name: str,
args: TagValueArgs,
opts: Optional[ResourceOptions] = None)
@overload
def TagValue(resource_name: str,
opts: Optional[ResourceOptions] = None,
parent: Optional[str] = None,
short_name: Optional[str] = None,
description: Optional[str] = None)
func NewTagValue(ctx *Context, name string, args TagValueArgs, opts ...ResourceOption) (*TagValue, error)
public TagValue(string name, TagValueArgs args, CustomResourceOptions? opts = null)
public TagValue(String name, TagValueArgs args)
public TagValue(String name, TagValueArgs args, CustomResourceOptions options)
type: gcp:tags:TagValue
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 TagValueArgs
- 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 TagValueArgs
- 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 TagValueArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args TagValueArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args TagValueArgs
- 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 tagValueResource = new Gcp.Tags.TagValue("tagValueResource", new()
{
Parent = "string",
ShortName = "string",
Description = "string",
});
example, err := tags.NewTagValue(ctx, "tagValueResource", &tags.TagValueArgs{
Parent: pulumi.String("string"),
ShortName: pulumi.String("string"),
Description: pulumi.String("string"),
})
var tagValueResource = new TagValue("tagValueResource", TagValueArgs.builder()
.parent("string")
.shortName("string")
.description("string")
.build());
tag_value_resource = gcp.tags.TagValue("tagValueResource",
parent="string",
short_name="string",
description="string")
const tagValueResource = new gcp.tags.TagValue("tagValueResource", {
parent: "string",
shortName: "string",
description: "string",
});
type: gcp:tags:TagValue
properties:
description: string
parent: string
shortName: string
TagValue 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 TagValue resource accepts the following input properties:
- Parent string
- Input only. The resource name of the new TagValue's parent. Must be of the form tagKeys/{tag_key_id}.
- Short
Name string - Input only. User-assigned short name for TagValue. The short name should be unique for TagValues within the same parent TagKey.
The short name must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between.
- Description string
- User-assigned description of the TagValue. Must not exceed 256 characters.
- Parent string
- Input only. The resource name of the new TagValue's parent. Must be of the form tagKeys/{tag_key_id}.
- Short
Name string - Input only. User-assigned short name for TagValue. The short name should be unique for TagValues within the same parent TagKey.
The short name must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between.
- Description string
- User-assigned description of the TagValue. Must not exceed 256 characters.
- parent String
- Input only. The resource name of the new TagValue's parent. Must be of the form tagKeys/{tag_key_id}.
- short
Name String - Input only. User-assigned short name for TagValue. The short name should be unique for TagValues within the same parent TagKey.
The short name must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between.
- description String
- User-assigned description of the TagValue. Must not exceed 256 characters.
- parent string
- Input only. The resource name of the new TagValue's parent. Must be of the form tagKeys/{tag_key_id}.
- short
Name string - Input only. User-assigned short name for TagValue. The short name should be unique for TagValues within the same parent TagKey.
The short name must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between.
- description string
- User-assigned description of the TagValue. Must not exceed 256 characters.
- parent str
- Input only. The resource name of the new TagValue's parent. Must be of the form tagKeys/{tag_key_id}.
- short_
name str - Input only. User-assigned short name for TagValue. The short name should be unique for TagValues within the same parent TagKey.
The short name must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between.
- description str
- User-assigned description of the TagValue. Must not exceed 256 characters.
- parent String
- Input only. The resource name of the new TagValue's parent. Must be of the form tagKeys/{tag_key_id}.
- short
Name String - Input only. User-assigned short name for TagValue. The short name should be unique for TagValues within the same parent TagKey.
The short name must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between.
- description String
- User-assigned description of the TagValue. Must not exceed 256 characters.
Outputs
All input properties are implicitly available as output properties. Additionally, the TagValue resource produces the following output properties:
- Create
Time string - Output only. Creation time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- The generated numeric id for the TagValue.
- Namespaced
Name string - Output only. Namespaced name of the TagValue. Will be in the format {parentNamespace}/{tagKeyShortName}/{shortName}.
- Update
Time string - Output only. Update time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
- Create
Time string - Output only. Creation time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- The generated numeric id for the TagValue.
- Namespaced
Name string - Output only. Namespaced name of the TagValue. Will be in the format {parentNamespace}/{tagKeyShortName}/{shortName}.
- Update
Time string - Output only. Update time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
- create
Time String - Output only. Creation time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- The generated numeric id for the TagValue.
- namespaced
Name String - Output only. Namespaced name of the TagValue. Will be in the format {parentNamespace}/{tagKeyShortName}/{shortName}.
- update
Time String - Output only. Update time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
- create
Time string - Output only. Creation time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
- id string
- The provider-assigned unique ID for this managed resource.
- name string
- The generated numeric id for the TagValue.
- namespaced
Name string - Output only. Namespaced name of the TagValue. Will be in the format {parentNamespace}/{tagKeyShortName}/{shortName}.
- update
Time string - Output only. Update time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
- create_
time str - Output only. Creation time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
- id str
- The provider-assigned unique ID for this managed resource.
- name str
- The generated numeric id for the TagValue.
- namespaced_
name str - Output only. Namespaced name of the TagValue. Will be in the format {parentNamespace}/{tagKeyShortName}/{shortName}.
- update_
time str - Output only. Update time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
- create
Time String - Output only. Creation time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- The generated numeric id for the TagValue.
- namespaced
Name String - Output only. Namespaced name of the TagValue. Will be in the format {parentNamespace}/{tagKeyShortName}/{shortName}.
- update
Time String - Output only. Update time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
Look up Existing TagValue Resource
Get an existing TagValue 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?: TagValueState, opts?: CustomResourceOptions): TagValue
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
create_time: Optional[str] = None,
description: Optional[str] = None,
name: Optional[str] = None,
namespaced_name: Optional[str] = None,
parent: Optional[str] = None,
short_name: Optional[str] = None,
update_time: Optional[str] = None) -> TagValue
func GetTagValue(ctx *Context, name string, id IDInput, state *TagValueState, opts ...ResourceOption) (*TagValue, error)
public static TagValue Get(string name, Input<string> id, TagValueState? state, CustomResourceOptions? opts = null)
public static TagValue get(String name, Output<String> id, TagValueState 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.
- Create
Time string - Output only. Creation time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
- Description string
- User-assigned description of the TagValue. Must not exceed 256 characters.
- Name string
- The generated numeric id for the TagValue.
- Namespaced
Name string - Output only. Namespaced name of the TagValue. Will be in the format {parentNamespace}/{tagKeyShortName}/{shortName}.
- Parent string
- Input only. The resource name of the new TagValue's parent. Must be of the form tagKeys/{tag_key_id}.
- Short
Name string - Input only. User-assigned short name for TagValue. The short name should be unique for TagValues within the same parent TagKey.
The short name must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between.
- Update
Time string - Output only. Update time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
- Create
Time string - Output only. Creation time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
- Description string
- User-assigned description of the TagValue. Must not exceed 256 characters.
- Name string
- The generated numeric id for the TagValue.
- Namespaced
Name string - Output only. Namespaced name of the TagValue. Will be in the format {parentNamespace}/{tagKeyShortName}/{shortName}.
- Parent string
- Input only. The resource name of the new TagValue's parent. Must be of the form tagKeys/{tag_key_id}.
- Short
Name string - Input only. User-assigned short name for TagValue. The short name should be unique for TagValues within the same parent TagKey.
The short name must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between.
- Update
Time string - Output only. Update time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
- create
Time String - Output only. Creation time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
- description String
- User-assigned description of the TagValue. Must not exceed 256 characters.
- name String
- The generated numeric id for the TagValue.
- namespaced
Name String - Output only. Namespaced name of the TagValue. Will be in the format {parentNamespace}/{tagKeyShortName}/{shortName}.
- parent String
- Input only. The resource name of the new TagValue's parent. Must be of the form tagKeys/{tag_key_id}.
- short
Name String - Input only. User-assigned short name for TagValue. The short name should be unique for TagValues within the same parent TagKey.
The short name must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between.
- update
Time String - Output only. Update time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
- create
Time string - Output only. Creation time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
- description string
- User-assigned description of the TagValue. Must not exceed 256 characters.
- name string
- The generated numeric id for the TagValue.
- namespaced
Name string - Output only. Namespaced name of the TagValue. Will be in the format {parentNamespace}/{tagKeyShortName}/{shortName}.
- parent string
- Input only. The resource name of the new TagValue's parent. Must be of the form tagKeys/{tag_key_id}.
- short
Name string - Input only. User-assigned short name for TagValue. The short name should be unique for TagValues within the same parent TagKey.
The short name must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between.
- update
Time string - Output only. Update time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
- create_
time str - Output only. Creation time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
- description str
- User-assigned description of the TagValue. Must not exceed 256 characters.
- name str
- The generated numeric id for the TagValue.
- namespaced_
name str - Output only. Namespaced name of the TagValue. Will be in the format {parentNamespace}/{tagKeyShortName}/{shortName}.
- parent str
- Input only. The resource name of the new TagValue's parent. Must be of the form tagKeys/{tag_key_id}.
- short_
name str - Input only. User-assigned short name for TagValue. The short name should be unique for TagValues within the same parent TagKey.
The short name must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between.
- update_
time str - Output only. Update time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
- create
Time String - Output only. Creation time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
- description String
- User-assigned description of the TagValue. Must not exceed 256 characters.
- name String
- The generated numeric id for the TagValue.
- namespaced
Name String - Output only. Namespaced name of the TagValue. Will be in the format {parentNamespace}/{tagKeyShortName}/{shortName}.
- parent String
- Input only. The resource name of the new TagValue's parent. Must be of the form tagKeys/{tag_key_id}.
- short
Name String - Input only. User-assigned short name for TagValue. The short name should be unique for TagValues within the same parent TagKey.
The short name must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between.
- update
Time String - Output only. Update time. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
Import
TagValue can be imported using any of these accepted formats:
tagValues/{{name}}
{{name}}
When using the pulumi import
command, TagValue can be imported using one of the formats above. For example:
$ pulumi import gcp:tags/tagValue:TagValue default tagValues/{{name}}
$ pulumi import gcp:tags/tagValue:TagValue default {{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.