1. Packages
  2. Oracle Cloud Infrastructure
  3. API Docs
  4. Identity
  5. getTags
Oracle Cloud Infrastructure v2.30.0 published on Monday, Apr 14, 2025 by Pulumi

oci.Identity.getTags

Explore with Pulumi AI

Oracle Cloud Infrastructure v2.30.0 published on Monday, Apr 14, 2025 by Pulumi

This data source provides the list of Tags in Oracle Cloud Infrastructure Identity service.

Lists the tag definitions in the specified tag namespace.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as oci from "@pulumi/oci";

const testTags = oci.Identity.getTags({
    tagNamespaceId: testTagNamespace.id,
    state: tagState,
});
Copy
import pulumi
import pulumi_oci as oci

test_tags = oci.Identity.get_tags(tag_namespace_id=test_tag_namespace["id"],
    state=tag_state)
Copy
package main

import (
	"github.com/pulumi/pulumi-oci/sdk/v2/go/oci/identity"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := identity.GetTags(ctx, &identity.GetTagsArgs{
			TagNamespaceId: testTagNamespace.Id,
			State:          pulumi.StringRef(tagState),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Oci = Pulumi.Oci;

return await Deployment.RunAsync(() => 
{
    var testTags = Oci.Identity.GetTags.Invoke(new()
    {
        TagNamespaceId = testTagNamespace.Id,
        State = tagState,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.oci.Identity.IdentityFunctions;
import com.pulumi.oci.Identity.inputs.GetTagsArgs;
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 testTags = IdentityFunctions.getTags(GetTagsArgs.builder()
            .tagNamespaceId(testTagNamespace.id())
            .state(tagState)
            .build());

    }
}
Copy
variables:
  testTags:
    fn::invoke:
      function: oci:Identity:getTags
      arguments:
        tagNamespaceId: ${testTagNamespace.id}
        state: ${tagState}
Copy

Using getTags

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 getTags(args: GetTagsArgs, opts?: InvokeOptions): Promise<GetTagsResult>
function getTagsOutput(args: GetTagsOutputArgs, opts?: InvokeOptions): Output<GetTagsResult>
Copy
def get_tags(filters: Optional[Sequence[_identity.GetTagsFilter]] = None,
             state: Optional[str] = None,
             tag_namespace_id: Optional[str] = None,
             opts: Optional[InvokeOptions] = None) -> GetTagsResult
def get_tags_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[_identity.GetTagsFilterArgs]]]] = None,
             state: Optional[pulumi.Input[str]] = None,
             tag_namespace_id: Optional[pulumi.Input[str]] = None,
             opts: Optional[InvokeOptions] = None) -> Output[GetTagsResult]
Copy
func GetTags(ctx *Context, args *GetTagsArgs, opts ...InvokeOption) (*GetTagsResult, error)
func GetTagsOutput(ctx *Context, args *GetTagsOutputArgs, opts ...InvokeOption) GetTagsResultOutput
Copy

> Note: This function is named GetTags in the Go SDK.

public static class GetTags 
{
    public static Task<GetTagsResult> InvokeAsync(GetTagsArgs args, InvokeOptions? opts = null)
    public static Output<GetTagsResult> Invoke(GetTagsInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetTagsResult> getTags(GetTagsArgs args, InvokeOptions options)
public static Output<GetTagsResult> getTags(GetTagsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: oci:Identity/getTags:getTags
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

TagNamespaceId This property is required. string
The OCID of the tag namespace.
Filters Changes to this property will trigger replacement. List<GetTagsFilter>
State string
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
TagNamespaceId This property is required. string
The OCID of the tag namespace.
Filters Changes to this property will trigger replacement. []GetTagsFilter
State string
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
tagNamespaceId This property is required. String
The OCID of the tag namespace.
filters Changes to this property will trigger replacement. List<GetTagsFilter>
state String
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
tagNamespaceId This property is required. string
The OCID of the tag namespace.
filters Changes to this property will trigger replacement. GetTagsFilter[]
state string
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
tag_namespace_id This property is required. str
The OCID of the tag namespace.
filters Changes to this property will trigger replacement. Sequence[identity.GetTagsFilter]
state str
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
tagNamespaceId This property is required. String
The OCID of the tag namespace.
filters Changes to this property will trigger replacement. List<Property Map>
state String
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.

getTags Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
TagNamespaceId string
The OCID of the namespace that contains the tag definition.
Tags List<GetTagsTag>
The list of tags.
Filters List<GetTagsFilter>
State string
The tag's current state. After creating a tag, make sure its lifecycleState is ACTIVE before using it. After retiring a tag, make sure its lifecycleState is INACTIVE before using it. If you delete a tag, you cannot delete another tag until the deleted tag's lifecycleState changes from DELETING to DELETED.
Id string
The provider-assigned unique ID for this managed resource.
TagNamespaceId string
The OCID of the namespace that contains the tag definition.
Tags []GetTagsTag
The list of tags.
Filters []GetTagsFilter
State string
The tag's current state. After creating a tag, make sure its lifecycleState is ACTIVE before using it. After retiring a tag, make sure its lifecycleState is INACTIVE before using it. If you delete a tag, you cannot delete another tag until the deleted tag's lifecycleState changes from DELETING to DELETED.
id String
The provider-assigned unique ID for this managed resource.
tagNamespaceId String
The OCID of the namespace that contains the tag definition.
tags List<GetTagsTag>
The list of tags.
filters List<GetTagsFilter>
state String
The tag's current state. After creating a tag, make sure its lifecycleState is ACTIVE before using it. After retiring a tag, make sure its lifecycleState is INACTIVE before using it. If you delete a tag, you cannot delete another tag until the deleted tag's lifecycleState changes from DELETING to DELETED.
id string
The provider-assigned unique ID for this managed resource.
tagNamespaceId string
The OCID of the namespace that contains the tag definition.
tags GetTagsTag[]
The list of tags.
filters GetTagsFilter[]
state string
The tag's current state. After creating a tag, make sure its lifecycleState is ACTIVE before using it. After retiring a tag, make sure its lifecycleState is INACTIVE before using it. If you delete a tag, you cannot delete another tag until the deleted tag's lifecycleState changes from DELETING to DELETED.
id str
The provider-assigned unique ID for this managed resource.
tag_namespace_id str
The OCID of the namespace that contains the tag definition.
tags Sequence[identity.GetTagsTag]
The list of tags.
filters Sequence[identity.GetTagsFilter]
state str
The tag's current state. After creating a tag, make sure its lifecycleState is ACTIVE before using it. After retiring a tag, make sure its lifecycleState is INACTIVE before using it. If you delete a tag, you cannot delete another tag until the deleted tag's lifecycleState changes from DELETING to DELETED.
id String
The provider-assigned unique ID for this managed resource.
tagNamespaceId String
The OCID of the namespace that contains the tag definition.
tags List<Property Map>
The list of tags.
filters List<Property Map>
state String
The tag's current state. After creating a tag, make sure its lifecycleState is ACTIVE before using it. After retiring a tag, make sure its lifecycleState is INACTIVE before using it. If you delete a tag, you cannot delete another tag until the deleted tag's lifecycleState changes from DELETING to DELETED.

Supporting Types

GetTagsFilter

Name This property is required. string
The name assigned to the tag during creation. This is the tag key definition. The name must be unique within the tag namespace and cannot be changed.
Values This property is required. List<string>
The list of allowed values for a definedTag value.
Regex bool
Name This property is required. string
The name assigned to the tag during creation. This is the tag key definition. The name must be unique within the tag namespace and cannot be changed.
Values This property is required. []string
The list of allowed values for a definedTag value.
Regex bool
name This property is required. String
The name assigned to the tag during creation. This is the tag key definition. The name must be unique within the tag namespace and cannot be changed.
values This property is required. List<String>
The list of allowed values for a definedTag value.
regex Boolean
name This property is required. string
The name assigned to the tag during creation. This is the tag key definition. The name must be unique within the tag namespace and cannot be changed.
values This property is required. string[]
The list of allowed values for a definedTag value.
regex boolean
name This property is required. str
The name assigned to the tag during creation. This is the tag key definition. The name must be unique within the tag namespace and cannot be changed.
values This property is required. Sequence[str]
The list of allowed values for a definedTag value.
regex bool
name This property is required. String
The name assigned to the tag during creation. This is the tag key definition. The name must be unique within the tag namespace and cannot be changed.
values This property is required. List<String>
The list of allowed values for a definedTag value.
regex Boolean

GetTagsTag

DefinedTags This property is required. Dictionary<string, string>
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
Description This property is required. string
The description you assign to the tag.
FreeformTags This property is required. Dictionary<string, string>
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
Id This property is required. string
The OCID of the tag definition.
IsCostTracking This property is required. bool
Indicates whether the tag is enabled for cost tracking.
IsRetired This property is required. bool
Indicates whether the tag is retired. See Retiring Key Definitions and Namespace Definitions.
Name This property is required. string
The name assigned to the tag during creation. This is the tag key definition. The name must be unique within the tag namespace and cannot be changed.
State This property is required. string
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
TagNamespaceId This property is required. string
The OCID of the tag namespace.
TimeCreated This property is required. string
Date and time the tag was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
Validators This property is required. List<GetTagsTagValidator>
Validates a definedTag value. Each validator performs validation steps in addition to the standard validation for definedTag values. For more information, see Limits on Tags.
DefinedTags This property is required. map[string]string
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
Description This property is required. string
The description you assign to the tag.
FreeformTags This property is required. map[string]string
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
Id This property is required. string
The OCID of the tag definition.
IsCostTracking This property is required. bool
Indicates whether the tag is enabled for cost tracking.
IsRetired This property is required. bool
Indicates whether the tag is retired. See Retiring Key Definitions and Namespace Definitions.
Name This property is required. string
The name assigned to the tag during creation. This is the tag key definition. The name must be unique within the tag namespace and cannot be changed.
State This property is required. string
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
TagNamespaceId This property is required. string
The OCID of the tag namespace.
TimeCreated This property is required. string
Date and time the tag was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
Validators This property is required. []GetTagsTagValidator
Validates a definedTag value. Each validator performs validation steps in addition to the standard validation for definedTag values. For more information, see Limits on Tags.
definedTags This property is required. Map<String,String>
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
description This property is required. String
The description you assign to the tag.
freeformTags This property is required. Map<String,String>
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
id This property is required. String
The OCID of the tag definition.
isCostTracking This property is required. Boolean
Indicates whether the tag is enabled for cost tracking.
isRetired This property is required. Boolean
Indicates whether the tag is retired. See Retiring Key Definitions and Namespace Definitions.
name This property is required. String
The name assigned to the tag during creation. This is the tag key definition. The name must be unique within the tag namespace and cannot be changed.
state This property is required. String
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
tagNamespaceId This property is required. String
The OCID of the tag namespace.
timeCreated This property is required. String
Date and time the tag was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
validators This property is required. List<GetTagsTagValidator>
Validates a definedTag value. Each validator performs validation steps in addition to the standard validation for definedTag values. For more information, see Limits on Tags.
definedTags This property is required. {[key: string]: string}
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
description This property is required. string
The description you assign to the tag.
freeformTags This property is required. {[key: string]: string}
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
id This property is required. string
The OCID of the tag definition.
isCostTracking This property is required. boolean
Indicates whether the tag is enabled for cost tracking.
isRetired This property is required. boolean
Indicates whether the tag is retired. See Retiring Key Definitions and Namespace Definitions.
name This property is required. string
The name assigned to the tag during creation. This is the tag key definition. The name must be unique within the tag namespace and cannot be changed.
state This property is required. string
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
tagNamespaceId This property is required. string
The OCID of the tag namespace.
timeCreated This property is required. string
Date and time the tag was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
validators This property is required. GetTagsTagValidator[]
Validates a definedTag value. Each validator performs validation steps in addition to the standard validation for definedTag values. For more information, see Limits on Tags.
defined_tags This property is required. Mapping[str, str]
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
description This property is required. str
The description you assign to the tag.
freeform_tags This property is required. Mapping[str, str]
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
id This property is required. str
The OCID of the tag definition.
is_cost_tracking This property is required. bool
Indicates whether the tag is enabled for cost tracking.
is_retired This property is required. bool
Indicates whether the tag is retired. See Retiring Key Definitions and Namespace Definitions.
name This property is required. str
The name assigned to the tag during creation. This is the tag key definition. The name must be unique within the tag namespace and cannot be changed.
state This property is required. str
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
tag_namespace_id This property is required. str
The OCID of the tag namespace.
time_created This property is required. str
Date and time the tag was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
validators This property is required. Sequence[identity.GetTagsTagValidator]
Validates a definedTag value. Each validator performs validation steps in addition to the standard validation for definedTag values. For more information, see Limits on Tags.
definedTags This property is required. Map<String>
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
description This property is required. String
The description you assign to the tag.
freeformTags This property is required. Map<String>
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
id This property is required. String
The OCID of the tag definition.
isCostTracking This property is required. Boolean
Indicates whether the tag is enabled for cost tracking.
isRetired This property is required. Boolean
Indicates whether the tag is retired. See Retiring Key Definitions and Namespace Definitions.
name This property is required. String
The name assigned to the tag during creation. This is the tag key definition. The name must be unique within the tag namespace and cannot be changed.
state This property is required. String
A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
tagNamespaceId This property is required. String
The OCID of the tag namespace.
timeCreated This property is required. String
Date and time the tag was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
validators This property is required. List<Property Map>
Validates a definedTag value. Each validator performs validation steps in addition to the standard validation for definedTag values. For more information, see Limits on Tags.

GetTagsTagValidator

ValidatorType This property is required. string
Specifies the type of validation: a static value (no validation) or a list.
Values This property is required. List<string>
The list of allowed values for a definedTag value.
ValidatorType This property is required. string
Specifies the type of validation: a static value (no validation) or a list.
Values This property is required. []string
The list of allowed values for a definedTag value.
validatorType This property is required. String
Specifies the type of validation: a static value (no validation) or a list.
values This property is required. List<String>
The list of allowed values for a definedTag value.
validatorType This property is required. string
Specifies the type of validation: a static value (no validation) or a list.
values This property is required. string[]
The list of allowed values for a definedTag value.
validator_type This property is required. str
Specifies the type of validation: a static value (no validation) or a list.
values This property is required. Sequence[str]
The list of allowed values for a definedTag value.
validatorType This property is required. String
Specifies the type of validation: a static value (no validation) or a list.
values This property is required. List<String>
The list of allowed values for a definedTag value.

Package Details

Repository
oci pulumi/pulumi-oci
License
Apache-2.0
Notes
This Pulumi package is based on the oci Terraform Provider.
Oracle Cloud Infrastructure v2.30.0 published on Monday, Apr 14, 2025 by Pulumi