AWS v6.74.0 published on Wednesday, Mar 26, 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({});
import pulumi
import pulumi_aws as aws
test = aws.resourcegroupstaggingapi.get_resources()
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
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() => 
{
    var test = Aws.ResourceGroupsTaggingApi.GetResources.Invoke();
});
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();
    }
}
variables:
  test:
    fn::invoke:
      function: aws:resourcegroupstaggingapi:getResources
      arguments: {}
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",
        ],
    }],
});
import pulumi
import pulumi_aws as aws
test = aws.resourcegroupstaggingapi.get_resources(tag_filters=[{
    "key": "tag-key",
    "values": [
        "tag-value-1",
        "tag-value-2",
    ],
}])
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
	})
}
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",
                },
            },
        },
    });
});
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());
    }
}
variables:
  test:
    fn::invoke:
      function: aws:resourcegroupstaggingapi:getResources
      arguments:
        tagFilters:
          - key: tag-key
            values:
              - tag-value-1
              - tag-value-2
Filter By Resource Type
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const test = aws.resourcegroupstaggingapi.getResources({
    resourceTypeFilters: ["ec2:instance"],
});
import pulumi
import pulumi_aws as aws
test = aws.resourcegroupstaggingapi.get_resources(resource_type_filters=["ec2:instance"])
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
	})
}
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",
        },
    });
});
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());
    }
}
variables:
  test:
    fn::invoke:
      function: aws:resourcegroupstaggingapi:getResources
      arguments:
        resourceTypeFilters:
          - ec2:instance
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>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]func GetResources(ctx *Context, args *GetResourcesArgs, opts ...InvokeOption) (*GetResourcesResult, error)
func GetResourcesOutput(ctx *Context, args *GetResourcesOutputArgs, opts ...InvokeOption) GetResourcesResultOutput> 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)
}public static CompletableFuture<GetResourcesResult> getResources(GetResourcesArgs args, InvokeOptions options)
public static Output<GetResourcesResult> getResources(GetResourcesArgs args, InvokeOptions options)
fn::invoke:
  function: aws:resourcegroupstaggingapi/getResources:getResources
  arguments:
    # arguments dictionaryThe following arguments are supported:
- ExcludeCompliant boolResources 
- Specifies whether to exclude resources that are compliant with the tag policy. You can use this parameter only if the include_compliance_detailsargument is also set totrue.
- IncludeCompliance boolDetails 
- Specifies whether to include details regarding the compliance with the effective tag policy.
- ResourceArn List<string>Lists 
- Specifies a list of ARNs of resources for which you want to retrieve tag data. Conflicts with filter.
- ResourceType List<string>Filters 
- Constraints on the resources that you want returned. The format of each resource type is service:resourceType. For example, specifying a resource type ofec2returns all Amazon EC2 resources (which includes EC2 instances). Specifying a resource type ofec2:instancereturns only EC2 instances.
- TagFilters List<GetResources Tag Filter> 
- 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.
- ExcludeCompliant boolResources 
- Specifies whether to exclude resources that are compliant with the tag policy. You can use this parameter only if the include_compliance_detailsargument is also set totrue.
- IncludeCompliance boolDetails 
- Specifies whether to include details regarding the compliance with the effective tag policy.
- ResourceArn []stringLists 
- Specifies a list of ARNs of resources for which you want to retrieve tag data. Conflicts with filter.
- ResourceType []stringFilters 
- Constraints on the resources that you want returned. The format of each resource type is service:resourceType. For example, specifying a resource type ofec2returns all Amazon EC2 resources (which includes EC2 instances). Specifying a resource type ofec2:instancereturns only EC2 instances.
- TagFilters []GetResources Tag Filter 
- 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.
- excludeCompliant BooleanResources 
- Specifies whether to exclude resources that are compliant with the tag policy. You can use this parameter only if the include_compliance_detailsargument is also set totrue.
- includeCompliance BooleanDetails 
- Specifies whether to include details regarding the compliance with the effective tag policy.
- resourceArn List<String>Lists 
- Specifies a list of ARNs of resources for which you want to retrieve tag data. Conflicts with filter.
- resourceType List<String>Filters 
- Constraints on the resources that you want returned. The format of each resource type is service:resourceType. For example, specifying a resource type ofec2returns all Amazon EC2 resources (which includes EC2 instances). Specifying a resource type ofec2:instancereturns only EC2 instances.
- tagFilters List<GetResources Tag Filter> 
- 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.
- excludeCompliant booleanResources 
- Specifies whether to exclude resources that are compliant with the tag policy. You can use this parameter only if the include_compliance_detailsargument is also set totrue.
- includeCompliance booleanDetails 
- Specifies whether to include details regarding the compliance with the effective tag policy.
- resourceArn string[]Lists 
- Specifies a list of ARNs of resources for which you want to retrieve tag data. Conflicts with filter.
- resourceType string[]Filters 
- Constraints on the resources that you want returned. The format of each resource type is service:resourceType. For example, specifying a resource type ofec2returns all Amazon EC2 resources (which includes EC2 instances). Specifying a resource type ofec2:instancereturns only EC2 instances.
- tagFilters GetResources Tag Filter[] 
- 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_ boolresources 
- Specifies whether to exclude resources that are compliant with the tag policy. You can use this parameter only if the include_compliance_detailsargument is also set totrue.
- include_compliance_ booldetails 
- Specifies whether to include details regarding the compliance with the effective tag policy.
- resource_arn_ Sequence[str]lists 
- Specifies a list of ARNs of resources for which you want to retrieve tag data. Conflicts with filter.
- resource_type_ Sequence[str]filters 
- Constraints on the resources that you want returned. The format of each resource type is service:resourceType. For example, specifying a resource type ofec2returns all Amazon EC2 resources (which includes EC2 instances). Specifying a resource type ofec2:instancereturns only EC2 instances.
- tag_filters Sequence[GetResources Tag Filter] 
- 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.
- excludeCompliant BooleanResources 
- Specifies whether to exclude resources that are compliant with the tag policy. You can use this parameter only if the include_compliance_detailsargument is also set totrue.
- includeCompliance BooleanDetails 
- Specifies whether to include details regarding the compliance with the effective tag policy.
- resourceArn List<String>Lists 
- Specifies a list of ARNs of resources for which you want to retrieve tag data. Conflicts with filter.
- resourceType List<String>Filters 
- Constraints on the resources that you want returned. The format of each resource type is service:resourceType. For example, specifying a resource type ofec2returns all Amazon EC2 resources (which includes EC2 instances). Specifying a resource type ofec2:instancereturns 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.
- ResourceTag List<GetMapping Lists Resources Resource Tag Mapping List> 
- List of objects matching the search criteria.
- ExcludeCompliant boolResources 
- IncludeCompliance boolDetails 
- ResourceArn List<string>Lists 
- ResourceType List<string>Filters 
- TagFilters List<GetResources Tag Filter> 
- Id string
- The provider-assigned unique ID for this managed resource.
- ResourceTag []GetMapping Lists Resources Resource Tag Mapping List 
- List of objects matching the search criteria.
- ExcludeCompliant boolResources 
- IncludeCompliance boolDetails 
- ResourceArn []stringLists 
- ResourceType []stringFilters 
- TagFilters []GetResources Tag Filter 
- id String
- The provider-assigned unique ID for this managed resource.
- resourceTag List<GetMapping Lists Resources Resource Tag Mapping List> 
- List of objects matching the search criteria.
- excludeCompliant BooleanResources 
- includeCompliance BooleanDetails 
- resourceArn List<String>Lists 
- resourceType List<String>Filters 
- tagFilters List<GetResources Tag Filter> 
- id string
- The provider-assigned unique ID for this managed resource.
- resourceTag GetMapping Lists Resources Resource Tag Mapping List[] 
- List of objects matching the search criteria.
- excludeCompliant booleanResources 
- includeCompliance booleanDetails 
- resourceArn string[]Lists 
- resourceType string[]Filters 
- tagFilters GetResources Tag Filter[] 
- id str
- The provider-assigned unique ID for this managed resource.
- resource_tag_ Sequence[Getmapping_ lists Resources Resource Tag Mapping List] 
- List of objects matching the search criteria.
- exclude_compliant_ boolresources 
- include_compliance_ booldetails 
- resource_arn_ Sequence[str]lists 
- resource_type_ Sequence[str]filters 
- tag_filters Sequence[GetResources Tag Filter] 
- id String
- The provider-assigned unique ID for this managed resource.
- resourceTag List<Property Map>Mapping Lists 
- List of objects matching the search criteria.
- excludeCompliant BooleanResources 
- includeCompliance BooleanDetails 
- resourceArn List<String>Lists 
- resourceType List<String>Filters 
- tagFilters List<Property Map>
Supporting Types
GetResourcesResourceTagMappingList     
- ComplianceDetails List<GetResources Resource Tag Mapping List Compliance Detail> 
- 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 string
- ARN of the resource.
- Dictionary<string, string>
- Map of tags assigned to the resource.
- ComplianceDetails []GetResources Resource Tag Mapping List Compliance Detail 
- 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 string
- ARN of the resource.
- map[string]string
- Map of tags assigned to the resource.
- complianceDetails List<GetResources Resource Tag Mapping List Compliance Detail> 
- 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 String
- ARN of the resource.
- Map<String,String>
- Map of tags assigned to the resource.
- complianceDetails GetResources Resource Tag Mapping List Compliance Detail[] 
- 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 string
- ARN of the resource.
- {[key: string]: string}
- Map of tags assigned to the resource.
- compliance_details Sequence[GetResources Resource Tag Mapping List Compliance Detail] 
- 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 str
- ARN of the resource.
- Mapping[str, str]
- Map of tags assigned to the resource.
- complianceDetails 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 String
- ARN of the resource.
- Map<String>
- Map of tags assigned to the resource.
GetResourcesResourceTagMappingListComplianceDetail       
- ComplianceStatus 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.
 
- KeysWith List<string>Noncompliant Values 
- NonCompliant List<string>Keys 
- ComplianceStatus 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.
 
- KeysWith []stringNoncompliant Values 
- NonCompliant []stringKeys 
- complianceStatus 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.
 
- keysWith List<String>Noncompliant Values 
- nonCompliant List<String>Keys 
- complianceStatus 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.
 
- keysWith string[]Noncompliant Values 
- nonCompliant string[]Keys 
- compliance_status 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_ Sequence[str]noncompliant_ values 
- non_compliant_ Sequence[str]keys 
- complianceStatus 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.
 
- keysWith List<String>Noncompliant Values 
- nonCompliant List<String>Keys 
GetResourcesTagFilter   
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the awsTerraform Provider.