1. Packages
  2. AWS
  3. API Docs
  4. resourcegroupstaggingapi
  5. getResources
AWS v6.75.0 published on Wednesday, Apr 2, 2025 by Pulumi

aws.resourcegroupstaggingapi.getResources

Explore with Pulumi AI

Provides details about resource tagging.

Example Usage

Get All Resource Tag Mappings

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

const test = aws.resourcegroupstaggingapi.getResources({});
Copy
import pulumi
import pulumi_aws as aws

test = aws.resourcegroupstaggingapi.get_resources()
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/resourcegroupstaggingapi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := resourcegroupstaggingapi.GetResources(ctx, &resourcegroupstaggingapi.GetResourcesArgs{}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var test = Aws.ResourceGroupsTaggingApi.GetResources.Invoke();

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.resourcegroupstaggingapi.ResourcegroupstaggingapiFunctions;
import com.pulumi.aws.resourcegroupstaggingapi.inputs.GetResourcesArgs;
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 test = ResourcegroupstaggingapiFunctions.getResources();

    }
}
Copy
variables:
  test:
    fn::invoke:
      function: aws:resourcegroupstaggingapi:getResources
      arguments: {}
Copy

Filter By Tag Key and Value

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

const test = aws.resourcegroupstaggingapi.getResources({
    tagFilters: [{
        key: "tag-key",
        values: [
            "tag-value-1",
            "tag-value-2",
        ],
    }],
});
Copy
import pulumi
import pulumi_aws as aws

test = aws.resourcegroupstaggingapi.get_resources(tag_filters=[{
    "key": "tag-key",
    "values": [
        "tag-value-1",
        "tag-value-2",
    ],
}])
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/resourcegroupstaggingapi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := resourcegroupstaggingapi.GetResources(ctx, &resourcegroupstaggingapi.GetResourcesArgs{
			TagFilters: []resourcegroupstaggingapi.GetResourcesTagFilter{
				{
					Key: "tag-key",
					Values: []string{
						"tag-value-1",
						"tag-value-2",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var test = Aws.ResourceGroupsTaggingApi.GetResources.Invoke(new()
    {
        TagFilters = new[]
        {
            new Aws.ResourceGroupsTaggingApi.Inputs.GetResourcesTagFilterInputArgs
            {
                Key = "tag-key",
                Values = new[]
                {
                    "tag-value-1",
                    "tag-value-2",
                },
            },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.resourcegroupstaggingapi.ResourcegroupstaggingapiFunctions;
import com.pulumi.aws.resourcegroupstaggingapi.inputs.GetResourcesArgs;
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 test = ResourcegroupstaggingapiFunctions.getResources(GetResourcesArgs.builder()
            .tagFilters(GetResourcesTagFilterArgs.builder()
                .key("tag-key")
                .values(                
                    "tag-value-1",
                    "tag-value-2")
                .build())
            .build());

    }
}
Copy
variables:
  test:
    fn::invoke:
      function: aws:resourcegroupstaggingapi:getResources
      arguments:
        tagFilters:
          - key: tag-key
            values:
              - tag-value-1
              - tag-value-2
Copy

Filter By Resource Type

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

const test = aws.resourcegroupstaggingapi.getResources({
    resourceTypeFilters: ["ec2:instance"],
});
Copy
import pulumi
import pulumi_aws as aws

test = aws.resourcegroupstaggingapi.get_resources(resource_type_filters=["ec2:instance"])
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/resourcegroupstaggingapi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := resourcegroupstaggingapi.GetResources(ctx, &resourcegroupstaggingapi.GetResourcesArgs{
			ResourceTypeFilters: []string{
				"ec2:instance",
			},
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var test = Aws.ResourceGroupsTaggingApi.GetResources.Invoke(new()
    {
        ResourceTypeFilters = new[]
        {
            "ec2:instance",
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.resourcegroupstaggingapi.ResourcegroupstaggingapiFunctions;
import com.pulumi.aws.resourcegroupstaggingapi.inputs.GetResourcesArgs;
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 test = ResourcegroupstaggingapiFunctions.getResources(GetResourcesArgs.builder()
            .resourceTypeFilters("ec2:instance")
            .build());

    }
}
Copy
variables:
  test:
    fn::invoke:
      function: aws:resourcegroupstaggingapi:getResources
      arguments:
        resourceTypeFilters:
          - ec2:instance
Copy

Using getResources

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 getResources(args: GetResourcesArgs, opts?: InvokeOptions): Promise<GetResourcesResult>
function getResourcesOutput(args: GetResourcesOutputArgs, opts?: InvokeOptions): Output<GetResourcesResult>
Copy
def get_resources(exclude_compliant_resources: Optional[bool] = None,
                  include_compliance_details: Optional[bool] = None,
                  resource_arn_lists: Optional[Sequence[str]] = None,
                  resource_type_filters: Optional[Sequence[str]] = None,
                  tag_filters: Optional[Sequence[GetResourcesTagFilter]] = None,
                  opts: Optional[InvokeOptions] = None) -> GetResourcesResult
def get_resources_output(exclude_compliant_resources: Optional[pulumi.Input[bool]] = None,
                  include_compliance_details: Optional[pulumi.Input[bool]] = None,
                  resource_arn_lists: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                  resource_type_filters: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                  tag_filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetResourcesTagFilterArgs]]]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetResourcesResult]
Copy
func GetResources(ctx *Context, args *GetResourcesArgs, opts ...InvokeOption) (*GetResourcesResult, error)
func GetResourcesOutput(ctx *Context, args *GetResourcesOutputArgs, opts ...InvokeOption) GetResourcesResultOutput
Copy

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

public static class GetResources 
{
    public static Task<GetResourcesResult> InvokeAsync(GetResourcesArgs args, InvokeOptions? opts = null)
    public static Output<GetResourcesResult> Invoke(GetResourcesInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetResourcesResult> getResources(GetResourcesArgs args, InvokeOptions options)
public static Output<GetResourcesResult> getResources(GetResourcesArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: aws:resourcegroupstaggingapi/getResources:getResources
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

ExcludeCompliantResources bool
Specifies whether to exclude resources that are compliant with the tag policy. You can use this parameter only if the include_compliance_details argument is also set to true.
IncludeComplianceDetails bool
Specifies whether to include details regarding the compliance with the effective tag policy.
ResourceArnLists List<string>
Specifies a list of ARNs of resources for which you want to retrieve tag data. Conflicts with filter.
ResourceTypeFilters List<string>
Constraints on the resources that you want returned. The format of each resource type is service:resourceType. For example, specifying a resource type of ec2 returns all Amazon EC2 resources (which includes EC2 instances). Specifying a resource type of ec2:instance returns only EC2 instances.
TagFilters List<GetResourcesTagFilter>
Specifies a list of Tag Filters (keys and values) to restrict the output to only those resources that have the specified tag and, if included, the specified value. See Tag Filter below. Conflicts with resource_arn_list.
ExcludeCompliantResources bool
Specifies whether to exclude resources that are compliant with the tag policy. You can use this parameter only if the include_compliance_details argument is also set to true.
IncludeComplianceDetails bool
Specifies whether to include details regarding the compliance with the effective tag policy.
ResourceArnLists []string
Specifies a list of ARNs of resources for which you want to retrieve tag data. Conflicts with filter.
ResourceTypeFilters []string
Constraints on the resources that you want returned. The format of each resource type is service:resourceType. For example, specifying a resource type of ec2 returns all Amazon EC2 resources (which includes EC2 instances). Specifying a resource type of ec2:instance returns only EC2 instances.
TagFilters []GetResourcesTagFilter
Specifies a list of Tag Filters (keys and values) to restrict the output to only those resources that have the specified tag and, if included, the specified value. See Tag Filter below. Conflicts with resource_arn_list.
excludeCompliantResources Boolean
Specifies whether to exclude resources that are compliant with the tag policy. You can use this parameter only if the include_compliance_details argument is also set to true.
includeComplianceDetails Boolean
Specifies whether to include details regarding the compliance with the effective tag policy.
resourceArnLists List<String>
Specifies a list of ARNs of resources for which you want to retrieve tag data. Conflicts with filter.
resourceTypeFilters List<String>
Constraints on the resources that you want returned. The format of each resource type is service:resourceType. For example, specifying a resource type of ec2 returns all Amazon EC2 resources (which includes EC2 instances). Specifying a resource type of ec2:instance returns only EC2 instances.
tagFilters List<GetResourcesTagFilter>
Specifies a list of Tag Filters (keys and values) to restrict the output to only those resources that have the specified tag and, if included, the specified value. See Tag Filter below. Conflicts with resource_arn_list.
excludeCompliantResources boolean
Specifies whether to exclude resources that are compliant with the tag policy. You can use this parameter only if the include_compliance_details argument is also set to true.
includeComplianceDetails boolean
Specifies whether to include details regarding the compliance with the effective tag policy.
resourceArnLists string[]
Specifies a list of ARNs of resources for which you want to retrieve tag data. Conflicts with filter.
resourceTypeFilters string[]
Constraints on the resources that you want returned. The format of each resource type is service:resourceType. For example, specifying a resource type of ec2 returns all Amazon EC2 resources (which includes EC2 instances). Specifying a resource type of ec2:instance returns only EC2 instances.
tagFilters GetResourcesTagFilter[]
Specifies a list of Tag Filters (keys and values) to restrict the output to only those resources that have the specified tag and, if included, the specified value. See Tag Filter below. Conflicts with resource_arn_list.
exclude_compliant_resources bool
Specifies whether to exclude resources that are compliant with the tag policy. You can use this parameter only if the include_compliance_details argument is also set to true.
include_compliance_details bool
Specifies whether to include details regarding the compliance with the effective tag policy.
resource_arn_lists Sequence[str]
Specifies a list of ARNs of resources for which you want to retrieve tag data. Conflicts with filter.
resource_type_filters Sequence[str]
Constraints on the resources that you want returned. The format of each resource type is service:resourceType. For example, specifying a resource type of ec2 returns all Amazon EC2 resources (which includes EC2 instances). Specifying a resource type of ec2:instance returns only EC2 instances.
tag_filters Sequence[GetResourcesTagFilter]
Specifies a list of Tag Filters (keys and values) to restrict the output to only those resources that have the specified tag and, if included, the specified value. See Tag Filter below. Conflicts with resource_arn_list.
excludeCompliantResources Boolean
Specifies whether to exclude resources that are compliant with the tag policy. You can use this parameter only if the include_compliance_details argument is also set to true.
includeComplianceDetails Boolean
Specifies whether to include details regarding the compliance with the effective tag policy.
resourceArnLists List<String>
Specifies a list of ARNs of resources for which you want to retrieve tag data. Conflicts with filter.
resourceTypeFilters List<String>
Constraints on the resources that you want returned. The format of each resource type is service:resourceType. For example, specifying a resource type of ec2 returns all Amazon EC2 resources (which includes EC2 instances). Specifying a resource type of ec2:instance returns only EC2 instances.
tagFilters List<Property Map>
Specifies a list of Tag Filters (keys and values) to restrict the output to only those resources that have the specified tag and, if included, the specified value. See Tag Filter below. Conflicts with resource_arn_list.

getResources Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
ResourceTagMappingLists List<GetResourcesResourceTagMappingList>
List of objects matching the search criteria.
ExcludeCompliantResources bool
IncludeComplianceDetails bool
ResourceArnLists List<string>
ResourceTypeFilters List<string>
TagFilters List<GetResourcesTagFilter>
Id string
The provider-assigned unique ID for this managed resource.
ResourceTagMappingLists []GetResourcesResourceTagMappingList
List of objects matching the search criteria.
ExcludeCompliantResources bool
IncludeComplianceDetails bool
ResourceArnLists []string
ResourceTypeFilters []string
TagFilters []GetResourcesTagFilter
id String
The provider-assigned unique ID for this managed resource.
resourceTagMappingLists List<GetResourcesResourceTagMappingList>
List of objects matching the search criteria.
excludeCompliantResources Boolean
includeComplianceDetails Boolean
resourceArnLists List<String>
resourceTypeFilters List<String>
tagFilters List<GetResourcesTagFilter>
id string
The provider-assigned unique ID for this managed resource.
resourceTagMappingLists GetResourcesResourceTagMappingList[]
List of objects matching the search criteria.
excludeCompliantResources boolean
includeComplianceDetails boolean
resourceArnLists string[]
resourceTypeFilters string[]
tagFilters GetResourcesTagFilter[]
id str
The provider-assigned unique ID for this managed resource.
resource_tag_mapping_lists Sequence[GetResourcesResourceTagMappingList]
List of objects matching the search criteria.
exclude_compliant_resources bool
include_compliance_details bool
resource_arn_lists Sequence[str]
resource_type_filters Sequence[str]
tag_filters Sequence[GetResourcesTagFilter]
id String
The provider-assigned unique ID for this managed resource.
resourceTagMappingLists List<Property Map>
List of objects matching the search criteria.
excludeCompliantResources Boolean
includeComplianceDetails Boolean
resourceArnLists List<String>
resourceTypeFilters List<String>
tagFilters List<Property Map>

Supporting Types

GetResourcesResourceTagMappingList

ComplianceDetails This property is required. List<GetResourcesResourceTagMappingListComplianceDetail>
List of objects with information that shows whether a resource is compliant with the effective tag policy, including details on any noncompliant tag keys.
ResourceArn This property is required. string
ARN of the resource.
Tags This property is required. Dictionary<string, string>
Map of tags assigned to the resource.
ComplianceDetails This property is required. []GetResourcesResourceTagMappingListComplianceDetail
List of objects with information that shows whether a resource is compliant with the effective tag policy, including details on any noncompliant tag keys.
ResourceArn This property is required. string
ARN of the resource.
Tags This property is required. map[string]string
Map of tags assigned to the resource.
complianceDetails This property is required. List<GetResourcesResourceTagMappingListComplianceDetail>
List of objects with information that shows whether a resource is compliant with the effective tag policy, including details on any noncompliant tag keys.
resourceArn This property is required. String
ARN of the resource.
tags This property is required. Map<String,String>
Map of tags assigned to the resource.
complianceDetails This property is required. GetResourcesResourceTagMappingListComplianceDetail[]
List of objects with information that shows whether a resource is compliant with the effective tag policy, including details on any noncompliant tag keys.
resourceArn This property is required. string
ARN of the resource.
tags This property is required. {[key: string]: string}
Map of tags assigned to the resource.
compliance_details This property is required. Sequence[GetResourcesResourceTagMappingListComplianceDetail]
List of objects with information that shows whether a resource is compliant with the effective tag policy, including details on any noncompliant tag keys.
resource_arn This property is required. str
ARN of the resource.
tags This property is required. Mapping[str, str]
Map of tags assigned to the resource.
complianceDetails This property is required. List<Property Map>
List of objects with information that shows whether a resource is compliant with the effective tag policy, including details on any noncompliant tag keys.
resourceArn This property is required. String
ARN of the resource.
tags This property is required. Map<String>
Map of tags assigned to the resource.

GetResourcesResourceTagMappingListComplianceDetail

ComplianceStatus This property is required. bool
Whether the resource is compliant.

  • keys_with_noncompliant_values - Set of tag keys with non-compliant tag values.
  • non_compliant_keys - Set of non-compliant tag keys.
KeysWithNoncompliantValues This property is required. List<string>
NonCompliantKeys This property is required. List<string>
ComplianceStatus This property is required. bool
Whether the resource is compliant.

  • keys_with_noncompliant_values - Set of tag keys with non-compliant tag values.
  • non_compliant_keys - Set of non-compliant tag keys.
KeysWithNoncompliantValues This property is required. []string
NonCompliantKeys This property is required. []string
complianceStatus This property is required. Boolean
Whether the resource is compliant.

  • keys_with_noncompliant_values - Set of tag keys with non-compliant tag values.
  • non_compliant_keys - Set of non-compliant tag keys.
keysWithNoncompliantValues This property is required. List<String>
nonCompliantKeys This property is required. List<String>
complianceStatus This property is required. boolean
Whether the resource is compliant.

  • keys_with_noncompliant_values - Set of tag keys with non-compliant tag values.
  • non_compliant_keys - Set of non-compliant tag keys.
keysWithNoncompliantValues This property is required. string[]
nonCompliantKeys This property is required. string[]
compliance_status This property is required. bool
Whether the resource is compliant.

  • keys_with_noncompliant_values - Set of tag keys with non-compliant tag values.
  • non_compliant_keys - Set of non-compliant tag keys.
keys_with_noncompliant_values This property is required. Sequence[str]
non_compliant_keys This property is required. Sequence[str]
complianceStatus This property is required. Boolean
Whether the resource is compliant.

  • keys_with_noncompliant_values - Set of tag keys with non-compliant tag values.
  • non_compliant_keys - Set of non-compliant tag keys.
keysWithNoncompliantValues This property is required. List<String>
nonCompliantKeys This property is required. List<String>

GetResourcesTagFilter

Key This property is required. string
One part of a key-value pair that makes up a tag.
Values List<string>
Optional part of a key-value pair that make up a tag.
Key This property is required. string
One part of a key-value pair that makes up a tag.
Values []string
Optional part of a key-value pair that make up a tag.
key This property is required. String
One part of a key-value pair that makes up a tag.
values List<String>
Optional part of a key-value pair that make up a tag.
key This property is required. string
One part of a key-value pair that makes up a tag.
values string[]
Optional part of a key-value pair that make up a tag.
key This property is required. str
One part of a key-value pair that makes up a tag.
values Sequence[str]
Optional part of a key-value pair that make up a tag.
key This property is required. String
One part of a key-value pair that makes up a tag.
values List<String>
Optional part of a key-value pair that make up a tag.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.