Google Cloud v8.27.0 published on Thursday, Apr 17, 2025 by Pulumi
gcp.tags.getTagKeys
Explore with Pulumi AI
Get tag keys by org or project parent.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const environmentTagKey = gcp.tags.getTagKeys({
    parent: "organizations/12345",
});
import pulumi
import pulumi_gcp as gcp
environment_tag_key = gcp.tags.get_tag_keys(parent="organizations/12345")
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.GetTagKeys(ctx, &tags.GetTagKeysArgs{
			Parent: "organizations/12345",
		}, 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.GetTagKeys.Invoke(new()
    {
        Parent = "organizations/12345",
    });
});
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.GetTagKeysArgs;
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.getTagKeys(GetTagKeysArgs.builder()
            .parent("organizations/12345")
            .build());
    }
}
variables:
  environmentTagKey:
    fn::invoke:
      function: gcp:tags:getTagKeys
      arguments:
        parent: organizations/12345
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const environmentTagKey = gcp.tags.getTagKeys({
    parent: "projects/abc",
});
import pulumi
import pulumi_gcp as gcp
environment_tag_key = gcp.tags.get_tag_keys(parent="projects/abc")
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.GetTagKeys(ctx, &tags.GetTagKeysArgs{
			Parent: "projects/abc",
		}, 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.GetTagKeys.Invoke(new()
    {
        Parent = "projects/abc",
    });
});
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.GetTagKeysArgs;
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.getTagKeys(GetTagKeysArgs.builder()
            .parent("projects/abc")
            .build());
    }
}
variables:
  environmentTagKey:
    fn::invoke:
      function: gcp:tags:getTagKeys
      arguments:
        parent: projects/abc
Using getTagKeys
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 getTagKeys(args: GetTagKeysArgs, opts?: InvokeOptions): Promise<GetTagKeysResult>
function getTagKeysOutput(args: GetTagKeysOutputArgs, opts?: InvokeOptions): Output<GetTagKeysResult>def get_tag_keys(parent: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetTagKeysResult
def get_tag_keys_output(parent: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetTagKeysResult]func GetTagKeys(ctx *Context, args *GetTagKeysArgs, opts ...InvokeOption) (*GetTagKeysResult, error)
func GetTagKeysOutput(ctx *Context, args *GetTagKeysOutputArgs, opts ...InvokeOption) GetTagKeysResultOutput> Note: This function is named GetTagKeys in the Go SDK.
public static class GetTagKeys 
{
    public static Task<GetTagKeysResult> InvokeAsync(GetTagKeysArgs args, InvokeOptions? opts = null)
    public static Output<GetTagKeysResult> Invoke(GetTagKeysInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetTagKeysResult> getTagKeys(GetTagKeysArgs args, InvokeOptions options)
public static Output<GetTagKeysResult> getTagKeys(GetTagKeysArgs args, InvokeOptions options)
fn::invoke:
  function: gcp:tags/getTagKeys:getTagKeys
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Parent string
 - The resource name of the parent organization or project. It can be in format 
organizations/{org_id}orprojects/{project_id_or_number}. 
- Parent string
 - The resource name of the parent organization or project. It can be in format 
organizations/{org_id}orprojects/{project_id_or_number}. 
- parent String
 - The resource name of the parent organization or project. It can be in format 
organizations/{org_id}orprojects/{project_id_or_number}. 
- parent string
 - The resource name of the parent organization or project. It can be in format 
organizations/{org_id}orprojects/{project_id_or_number}. 
- parent str
 - The resource name of the parent organization or project. It can be in format 
organizations/{org_id}orprojects/{project_id_or_number}. 
- parent String
 - The resource name of the parent organization or project. It can be in format 
organizations/{org_id}orprojects/{project_id_or_number}. 
getTagKeys Result
The following output properties are available:
- Id string
 - The provider-assigned unique ID for this managed resource.
 - Keys
List<Get
Tag Keys Key>  - Parent string
 - The resource name of the TagKey's parent. A TagKey can be parented by an Orgination or a Project.
 
- Id string
 - The provider-assigned unique ID for this managed resource.
 - Keys
[]Get
Tag Keys Key  - Parent string
 - The resource name of the TagKey's parent. A TagKey can be parented by an Orgination or a Project.
 
- id String
 - The provider-assigned unique ID for this managed resource.
 - keys
List<Get
Tag Keys Key>  - parent String
 - The resource name of the TagKey's parent. A TagKey can be parented by an Orgination or a Project.
 
- id string
 - The provider-assigned unique ID for this managed resource.
 - keys
Get
Tag Keys Key[]  - parent string
 - The resource name of the TagKey's parent. A TagKey can be parented by an Orgination or a Project.
 
- id str
 - The provider-assigned unique ID for this managed resource.
 - keys
Sequence[Get
Tag Keys Key]  - parent str
 - The resource name of the TagKey's parent. A TagKey can be parented by an Orgination or a Project.
 
- id String
 - The provider-assigned unique ID for this managed resource.
 - keys List<Property Map>
 - parent String
 - The resource name of the TagKey's parent. A TagKey can be parented by an Orgination or a Project.
 
Supporting Types
GetTagKeysKey   
- 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
 - User-assigned description of the TagKey.
 - Name string
 - an identifier for the resource with format 
tagKeys/{{name}} - Namespaced
Name string - Namespaced name of the TagKey which is in the format 
{parentNamespace}/{shortName}. - Parent string
 - The resource name of the parent organization or project. It can be in format 
organizations/{org_id}orprojects/{project_id_or_number}. - Purpose string
 - A purpose denotes that this Tag is intended for use in policies of a specific policy engine, and will involve that policy engine in management operations involving this Tag. A purpose does not grant a policy engine exclusive rights to the Tag, and it may be referenced by other policy engines.
 - Purpose
Data Dictionary<string, string> - Purpose data corresponds to the policy system that the tag is intended for. See documentation for Purpose for formatting of this field.
 - Short
Name string - The user friendly name for a TagKey. The short name should be unique for TagKeys wihting the same tag namespace.
 - 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
 - User-assigned description of the TagKey.
 - Name string
 - an identifier for the resource with format 
tagKeys/{{name}} - Namespaced
Name string - Namespaced name of the TagKey which is in the format 
{parentNamespace}/{shortName}. - Parent string
 - The resource name of the parent organization or project. It can be in format 
organizations/{org_id}orprojects/{project_id_or_number}. - Purpose string
 - A purpose denotes that this Tag is intended for use in policies of a specific policy engine, and will involve that policy engine in management operations involving this Tag. A purpose does not grant a policy engine exclusive rights to the Tag, and it may be referenced by other policy engines.
 - Purpose
Data map[string]string - Purpose data corresponds to the policy system that the tag is intended for. See documentation for Purpose for formatting of this field.
 - Short
Name string - The user friendly name for a TagKey. The short name should be unique for TagKeys wihting the same tag namespace.
 - 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
 - User-assigned description of the TagKey.
 - name String
 - an identifier for the resource with format 
tagKeys/{{name}} - namespaced
Name String - Namespaced name of the TagKey which is in the format 
{parentNamespace}/{shortName}. - parent String
 - The resource name of the parent organization or project. It can be in format 
organizations/{org_id}orprojects/{project_id_or_number}. - purpose String
 - A purpose denotes that this Tag is intended for use in policies of a specific policy engine, and will involve that policy engine in management operations involving this Tag. A purpose does not grant a policy engine exclusive rights to the Tag, and it may be referenced by other policy engines.
 - purpose
Data Map<String,String> - Purpose data corresponds to the policy system that the tag is intended for. See documentation for Purpose for formatting of this field.
 - short
Name String - The user friendly name for a TagKey. The short name should be unique for TagKeys wihting the same tag namespace.
 - 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
 - User-assigned description of the TagKey.
 - name string
 - an identifier for the resource with format 
tagKeys/{{name}} - namespaced
Name string - Namespaced name of the TagKey which is in the format 
{parentNamespace}/{shortName}. - parent string
 - The resource name of the parent organization or project. It can be in format 
organizations/{org_id}orprojects/{project_id_or_number}. - purpose string
 - A purpose denotes that this Tag is intended for use in policies of a specific policy engine, and will involve that policy engine in management operations involving this Tag. A purpose does not grant a policy engine exclusive rights to the Tag, and it may be referenced by other policy engines.
 - purpose
Data {[key: string]: string} - Purpose data corresponds to the policy system that the tag is intended for. See documentation for Purpose for formatting of this field.
 - short
Name string - The user friendly name for a TagKey. The short name should be unique for TagKeys wihting the same tag namespace.
 - 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
 - User-assigned description of the TagKey.
 - name str
 - an identifier for the resource with format 
tagKeys/{{name}} - namespaced_
name str - Namespaced name of the TagKey which is in the format 
{parentNamespace}/{shortName}. - parent str
 - The resource name of the parent organization or project. It can be in format 
organizations/{org_id}orprojects/{project_id_or_number}. - purpose str
 - A purpose denotes that this Tag is intended for use in policies of a specific policy engine, and will involve that policy engine in management operations involving this Tag. A purpose does not grant a policy engine exclusive rights to the Tag, and it may be referenced by other policy engines.
 - purpose_
data Mapping[str, str] - Purpose data corresponds to the policy system that the tag is intended for. See documentation for Purpose for formatting of this field.
 - short_
name str - The user friendly name for a TagKey. The short name should be unique for TagKeys wihting the same tag namespace.
 - 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
 - User-assigned description of the TagKey.
 - name String
 - an identifier for the resource with format 
tagKeys/{{name}} - namespaced
Name String - Namespaced name of the TagKey which is in the format 
{parentNamespace}/{shortName}. - parent String
 - The resource name of the parent organization or project. It can be in format 
organizations/{org_id}orprojects/{project_id_or_number}. - purpose String
 - A purpose denotes that this Tag is intended for use in policies of a specific policy engine, and will involve that policy engine in management operations involving this Tag. A purpose does not grant a policy engine exclusive rights to the Tag, and it may be referenced by other policy engines.
 - purpose
Data Map<String> - Purpose data corresponds to the policy system that the tag is intended for. See documentation for Purpose for formatting of this field.
 - short
Name String - The user friendly name for a TagKey. The short name should be unique for TagKeys wihting the same tag namespace.
 - 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-betaTerraform Provider.