1. Packages
  2. AWS
  3. API Docs
  4. resourcegroupstaggingapi
  5. getResources
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

aws.resourcegroupstaggingapi.getResources

Explore with Pulumi AI

aws logo
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

    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)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: aws:resourcegroupstaggingapi/getResources:getResources
      arguments:
        # arguments dictionary

    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 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 string
    ARN of the resource.
    Tags Dictionary<string, string>
    Map of tags assigned to the resource.
    ComplianceDetails []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 string
    ARN of the resource.
    Tags map[string]string
    Map of tags assigned to the resource.
    complianceDetails 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 String
    ARN of the resource.
    tags Map<String,String>
    Map of tags assigned to the resource.
    complianceDetails 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 string
    ARN of the resource.
    tags {[key: string]: string}
    Map of tags assigned to the resource.
    compliance_details 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 str
    ARN of the resource.
    tags 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.
    tags 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.
    KeysWithNoncompliantValues List<string>
    NonCompliantKeys List<string>
    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.
    KeysWithNoncompliantValues []string
    NonCompliantKeys []string
    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.
    keysWithNoncompliantValues List<String>
    nonCompliantKeys List<String>
    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.
    keysWithNoncompliantValues string[]
    nonCompliantKeys string[]
    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_noncompliant_values Sequence[str]
    non_compliant_keys Sequence[str]
    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.
    keysWithNoncompliantValues List<String>
    nonCompliantKeys List<String>

    GetResourcesTagFilter

    Key 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 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 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 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 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 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.
    aws logo
    AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi