Google Cloud v8.21.0 published on Wednesday, Mar 5, 2025 by Pulumi
gcp.tags.getTagValue
Explore with Pulumi AI
Get a tag value by parent key and short_name.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const environmentProdTagValue = gcp.tags.getTagValue({
    parent: "tagKeys/56789",
    shortName: "production",
});
import pulumi
import pulumi_gcp as gcp
environment_prod_tag_value = gcp.tags.get_tag_value(parent="tagKeys/56789",
    short_name="production")
package main
import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/tags"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := tags.LookupTagValue(ctx, &tags.LookupTagValueArgs{
			Parent:    "tagKeys/56789",
			ShortName: "production",
		}, nil)
		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 environmentProdTagValue = Gcp.Tags.GetTagValue.Invoke(new()
    {
        Parent = "tagKeys/56789",
        ShortName = "production",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.tags.TagsFunctions;
import com.pulumi.gcp.tags.inputs.GetTagValueArgs;
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) {
        final var environmentProdTagValue = TagsFunctions.getTagValue(GetTagValueArgs.builder()
            .parent("tagKeys/56789")
            .shortName("production")
            .build());
    }
}
variables:
  environmentProdTagValue:
    fn::invoke:
      function: gcp:tags:getTagValue
      arguments:
        parent: tagKeys/56789
        shortName: production
Using getTagValue
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getTagValue(args: GetTagValueArgs, opts?: InvokeOptions): Promise<GetTagValueResult>
function getTagValueOutput(args: GetTagValueOutputArgs, opts?: InvokeOptions): Output<GetTagValueResult>def get_tag_value(parent: Optional[str] = None,
                  short_name: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetTagValueResult
def get_tag_value_output(parent: Optional[pulumi.Input[str]] = None,
                  short_name: Optional[pulumi.Input[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetTagValueResult]func LookupTagValue(ctx *Context, args *LookupTagValueArgs, opts ...InvokeOption) (*LookupTagValueResult, error)
func LookupTagValueOutput(ctx *Context, args *LookupTagValueOutputArgs, opts ...InvokeOption) LookupTagValueResultOutput> Note: This function is named LookupTagValue in the Go SDK.
public static class GetTagValue 
{
    public static Task<GetTagValueResult> InvokeAsync(GetTagValueArgs args, InvokeOptions? opts = null)
    public static Output<GetTagValueResult> Invoke(GetTagValueInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetTagValueResult> getTagValue(GetTagValueArgs args, InvokeOptions options)
public static Output<GetTagValueResult> getTagValue(GetTagValueArgs args, InvokeOptions options)
fn::invoke:
  function: gcp:tags/getTagValue:getTagValue
  arguments:
    # arguments dictionaryThe following arguments are supported:
- parent str
- The resource name of the parent tagKey in format tagKey/{name}.
- short_name str
- The tag value's short_name.
getTagValue Result
The following output properties are available:
- CreateTime string
- 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
- Id string
- an identifier for the resource with format tagValues/{{name}}
- Name string
- The generated numeric id for the TagValue.
- NamespacedName string
- Namespaced name of the TagValue.
- Parent string
- ShortName string
- UpdateTime string
- 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".
- CreateTime string
- 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
- Id string
- an identifier for the resource with format tagValues/{{name}}
- Name string
- The generated numeric id for the TagValue.
- NamespacedName string
- Namespaced name of the TagValue.
- Parent string
- ShortName string
- UpdateTime string
- 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".
- createTime String
- 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
- id String
- an identifier for the resource with format tagValues/{{name}}
- name String
- The generated numeric id for the TagValue.
- namespacedName String
- Namespaced name of the TagValue.
- parent String
- shortName String
- updateTime String
- 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".
- createTime string
- 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
- id string
- an identifier for the resource with format tagValues/{{name}}
- name string
- The generated numeric id for the TagValue.
- namespacedName string
- Namespaced name of the TagValue.
- parent string
- shortName string
- updateTime string
- 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
- 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
- id str
- an identifier for the resource with format tagValues/{{name}}
- name str
- The generated numeric id for the TagValue.
- namespaced_name str
- Namespaced name of the TagValue.
- parent str
- short_name str
- update_time str
- 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".
- createTime String
- 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
- id String
- an identifier for the resource with format tagValues/{{name}}
- name String
- The generated numeric id for the TagValue.
- namespacedName String
- Namespaced name of the TagValue.
- parent String
- shortName String
- updateTime String
- 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".
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the google-betaTerraform Provider.