Google Cloud v8.21.0 published on Wednesday, Mar 5, 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<GetTag 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
[]GetTag 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<GetTag 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
GetTag 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[GetTag 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   
- 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
- User-assigned description of the TagKey.
- Name string
- an identifier for the resource with format tagKeys/{{name}}
- NamespacedName 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.
- PurposeData 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.
- ShortName string
- The user friendly name for a TagKey. The short name should be unique for TagKeys wihting the same tag namespace.
- 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
- User-assigned description of the TagKey.
- Name string
- an identifier for the resource with format tagKeys/{{name}}
- NamespacedName 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.
- PurposeData 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.
- ShortName string
- The user friendly name for a TagKey. The short name should be unique for TagKeys wihting the same tag namespace.
- 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
- User-assigned description of the TagKey.
- name String
- an identifier for the resource with format tagKeys/{{name}}
- namespacedName 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.
- purposeData 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.
- shortName String
- The user friendly name for a TagKey. The short name should be unique for TagKeys wihting the same tag namespace.
- 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
- User-assigned description of the TagKey.
- name string
- an identifier for the resource with format tagKeys/{{name}}
- namespacedName 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.
- purposeData {[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.
- shortName string
- The user friendly name for a TagKey. The short name should be unique for TagKeys wihting the same tag namespace.
- 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
- 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".
- 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
- User-assigned description of the TagKey.
- name String
- an identifier for the resource with format tagKeys/{{name}}
- namespacedName 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.
- purposeData Map<String>
- Purpose data corresponds to the policy system that the tag is intended for. See documentation for Purpose for formatting of this field.
- shortName String
- The user friendly name for a TagKey. The short name should be unique for TagKeys wihting the same tag namespace.
- 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.