TagValue class

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:

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: key.id,
    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.id,
    short_name="valuename",
    description="For valuename resources.")
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.Id,
        ShortName = "valuename",
        Description = "For valuename resources.",
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/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.ID().ToIDOutput().ToStringOutput(),
			ShortName:   pulumi.String("valuename"),
			Description: pulumi.String("For valuename resources."),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

resource "gcp_tags_tagkey" "key" {
  parent      = "organizations/123456789"
  short_name  = "keyname"
  description = "For keyname resources."
}
resource "gcp_tags_tagvalue" "value" {
  parent      = gcp_tags_tagkey.key.id
  short_name  = "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.ArrayList;
import java.util.Arrays;
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.id())
            .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: ${key.id}
      shortName: valuename
      description: For valuename resources.

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}}

Constructors

TagValue(String name, {TagValueArgs? args, CustomResourceOptions? options})
Creates a new TagValue. name The Pulumi resource name. args Arguments used to configure this TagValue. The set of arguments for TagValue. options Resource options controlling this resource's behavior.
TagValue.reference(String urn)
Creates a typed reference to an existing TagValue resource.

Properties

childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
createTime ↔ Output<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".
latefinal
deletionPolicy ↔ Output<String>
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.
latefinal
description ↔ Output<String?>
User-assigned description of the TagValue. Must not exceed 256 characters.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
name ↔ Output<String>
The generated numeric id for the TagValue.
latefinal
namespacedName ↔ Output<String>
Output only. Namespaced name of the TagValue. Will be in the format {parentNamespace}/{tagKeyShortName}/{shortName}.
latefinal
parent ↔ Output<String>
Input only. The resource name of the new TagValue's parent. Must be of the form tagKeys/{tag_key_id}.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
shortName ↔ Output<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 can have a maximum length of 256 characters. The permitted character set for the shortName includes all UTF-8 encoded Unicode characters except single quotes ('), double quotes ("), backslashes (\), and forward slashes (/).
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
updateTime ↔ Output<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".
latefinal
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {TagValueState? state, CustomResourceOptions? options}) → TagValue
Gets an existing TagValue resource's state with the given name and id.