Google Cloud Classic v8.3.1 published on Wednesday, Sep 25, 2024 by Pulumi
gcp.tags.getTagKey
Explore with Pulumi AI
Get a tag key by org or project parent
and short_name
.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const environmentTagKey = gcp.tags.getTagKey({
parent: "organizations/12345",
shortName: "environment",
});
import pulumi
import pulumi_gcp as gcp
environment_tag_key = gcp.tags.get_tag_key(parent="organizations/12345",
short_name="environment")
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.LookupTagKey(ctx, &tags.LookupTagKeyArgs{
Parent: "organizations/12345",
ShortName: "environment",
}, 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 environmentTagKey = Gcp.Tags.GetTagKey.Invoke(new()
{
Parent = "organizations/12345",
ShortName = "environment",
});
});
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.GetTagKeyArgs;
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 environmentTagKey = TagsFunctions.getTagKey(GetTagKeyArgs.builder()
.parent("organizations/12345")
.shortName("environment")
.build());
}
}
variables:
environmentTagKey:
fn::invoke:
Function: gcp:tags:getTagKey
Arguments:
parent: organizations/12345
shortName: environment
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const environmentTagKey = gcp.tags.getTagKey({
parent: "projects/abc",
shortName: "environment",
});
import pulumi
import pulumi_gcp as gcp
environment_tag_key = gcp.tags.get_tag_key(parent="projects/abc",
short_name="environment")
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.LookupTagKey(ctx, &tags.LookupTagKeyArgs{
Parent: "projects/abc",
ShortName: "environment",
}, 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 environmentTagKey = Gcp.Tags.GetTagKey.Invoke(new()
{
Parent = "projects/abc",
ShortName = "environment",
});
});
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.GetTagKeyArgs;
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 environmentTagKey = TagsFunctions.getTagKey(GetTagKeyArgs.builder()
.parent("projects/abc")
.shortName("environment")
.build());
}
}
variables:
environmentTagKey:
fn::invoke:
Function: gcp:tags:getTagKey
Arguments:
parent: projects/abc
shortName: environment
Using getTagKey
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 getTagKey(args: GetTagKeyArgs, opts?: InvokeOptions): Promise<GetTagKeyResult>
function getTagKeyOutput(args: GetTagKeyOutputArgs, opts?: InvokeOptions): Output<GetTagKeyResult>
def get_tag_key(parent: Optional[str] = None,
short_name: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetTagKeyResult
def get_tag_key_output(parent: Optional[pulumi.Input[str]] = None,
short_name: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetTagKeyResult]
func LookupTagKey(ctx *Context, args *LookupTagKeyArgs, opts ...InvokeOption) (*LookupTagKeyResult, error)
func LookupTagKeyOutput(ctx *Context, args *LookupTagKeyOutputArgs, opts ...InvokeOption) LookupTagKeyResultOutput
> Note: This function is named LookupTagKey
in the Go SDK.
public static class GetTagKey
{
public static Task<GetTagKeyResult> InvokeAsync(GetTagKeyArgs args, InvokeOptions? opts = null)
public static Output<GetTagKeyResult> Invoke(GetTagKeyInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetTagKeyResult> getTagKey(GetTagKeyArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: gcp:tags/getTagKey:getTagKey
arguments:
# arguments dictionary
The following arguments are supported:
- parent str
- The resource name of the parent organization or project. It can be in format
organizations/{org_id}
orprojects/{project_id_or_number}
. - short_
name str - The tag key's short_name.
getTagKey Result
The following output properties are available:
- Create
Time 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
tagKeys/{{name}}
- Name string
- The generated numeric id for the TagKey.
- Namespaced
Name string - Namespaced name of the TagKey which is in the format
{parentNamespace}/{shortName}
. - Parent string
- Short
Name string - Update
Time 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 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
tagKeys/{{name}}
- Name string
- The generated numeric id for the TagKey.
- Namespaced
Name string - Namespaced name of the TagKey which is in the format
{parentNamespace}/{shortName}
. - Parent string
- Short
Name string - Update
Time 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 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
tagKeys/{{name}}
- name String
- The generated numeric id for the TagKey.
- namespaced
Name String - Namespaced name of the TagKey which is in the format
{parentNamespace}/{shortName}
. - parent String
- short
Name String - update
Time 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 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
tagKeys/{{name}}
- name string
- The generated numeric id for the TagKey.
- namespaced
Name string - Namespaced name of the TagKey which is in the format
{parentNamespace}/{shortName}
. - parent string
- short
Name string - update
Time 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
tagKeys/{{name}}
- name str
- The generated numeric id for the TagKey.
- namespaced_
name str - Namespaced name of the TagKey which is in the format
{parentNamespace}/{shortName}
. - 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".
- create
Time 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
tagKeys/{{name}}
- name String
- The generated numeric id for the TagKey.
- namespaced
Name String - Namespaced name of the TagKey which is in the format
{parentNamespace}/{shortName}
. - parent String
- short
Name String - update
Time 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-beta
Terraform Provider.