AWS v6.54.0 published on Friday, Sep 27, 2024 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, nil, 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:
- 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_details
argument is also set totrue
. - Include
Compliance boolDetails - Specifies whether to include details regarding the compliance with the effective tag policy.
- Resource
Arn List<string>Lists - Specifies a list of ARNs of resources for which you want to retrieve tag data. Conflicts with
filter
. - Resource
Type 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 ofec2
returns all Amazon EC2 resources (which includes EC2 instances). Specifying a resource type ofec2:instance
returns only EC2 instances. - Tag
Filters 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
.
- 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_details
argument is also set totrue
. - Include
Compliance boolDetails - Specifies whether to include details regarding the compliance with the effective tag policy.
- Resource
Arn []stringLists - Specifies a list of ARNs of resources for which you want to retrieve tag data. Conflicts with
filter
. - Resource
Type []stringFilters - Constraints on the resources that you want returned. The format of each resource type is
service:resourceType
. For example, specifying a resource type ofec2
returns all Amazon EC2 resources (which includes EC2 instances). Specifying a resource type ofec2:instance
returns only EC2 instances. - Tag
Filters []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 BooleanResources - 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 totrue
. - include
Compliance BooleanDetails - Specifies whether to include details regarding the compliance with the effective tag policy.
- resource
Arn List<String>Lists - Specifies a list of ARNs of resources for which you want to retrieve tag data. Conflicts with
filter
. - resource
Type 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 ofec2
returns all Amazon EC2 resources (which includes EC2 instances). Specifying a resource type ofec2:instance
returns only EC2 instances. - tag
Filters 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
.
- exclude
Compliant booleanResources - 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 totrue
. - include
Compliance booleanDetails - Specifies whether to include details regarding the compliance with the effective tag policy.
- resource
Arn string[]Lists - Specifies a list of ARNs of resources for which you want to retrieve tag data. Conflicts with
filter
. - resource
Type 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 ofec2
returns all Amazon EC2 resources (which includes EC2 instances). Specifying a resource type ofec2:instance
returns only EC2 instances. - tag
Filters 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_details
argument 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 ofec2
returns all Amazon EC2 resources (which includes EC2 instances). Specifying a resource type ofec2:instance
returns 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
.
- exclude
Compliant BooleanResources - 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 totrue
. - include
Compliance BooleanDetails - Specifies whether to include details regarding the compliance with the effective tag policy.
- resource
Arn List<String>Lists - Specifies a list of ARNs of resources for which you want to retrieve tag data. Conflicts with
filter
. - resource
Type 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 ofec2
returns all Amazon EC2 resources (which includes EC2 instances). Specifying a resource type ofec2:instance
returns only EC2 instances. - tag
Filters 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.
- Resource
Tag List<GetMapping Lists Resources Resource Tag Mapping List> - List of objects matching the search criteria.
- Exclude
Compliant boolResources - Include
Compliance boolDetails - Resource
Arn List<string>Lists - Resource
Type List<string>Filters - Tag
Filters List<GetResources Tag Filter>
- Id string
- The provider-assigned unique ID for this managed resource.
- Resource
Tag []GetMapping Lists Resources Resource Tag Mapping List - List of objects matching the search criteria.
- Exclude
Compliant boolResources - Include
Compliance boolDetails - Resource
Arn []stringLists - Resource
Type []stringFilters - Tag
Filters []GetResources Tag Filter
- id String
- The provider-assigned unique ID for this managed resource.
- resource
Tag List<GetMapping Lists Resources Resource Tag Mapping List> - List of objects matching the search criteria.
- exclude
Compliant BooleanResources - include
Compliance BooleanDetails - resource
Arn List<String>Lists - resource
Type List<String>Filters - tag
Filters List<GetResources Tag Filter>
- id string
- The provider-assigned unique ID for this managed resource.
- resource
Tag GetMapping Lists Resources Resource Tag Mapping List[] - List of objects matching the search criteria.
- exclude
Compliant booleanResources - include
Compliance booleanDetails - resource
Arn string[]Lists - resource
Type string[]Filters - tag
Filters 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.
- resource
Tag List<Property Map>Mapping Lists - List of objects matching the search criteria.
- exclude
Compliant BooleanResources - include
Compliance BooleanDetails - resource
Arn List<String>Lists - resource
Type List<String>Filters - tag
Filters List<Property Map>
Supporting Types
GetResourcesResourceTagMappingList
- Compliance
Details 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.
- Resource
Arn string - ARN of the resource.
- Dictionary<string, string>
- Map of tags assigned to the resource.
- Compliance
Details []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 string - ARN of the resource.
- map[string]string
- Map of tags assigned to the resource.
- compliance
Details 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.
- resource
Arn String - ARN of the resource.
- Map<String,String>
- Map of tags assigned to the resource.
- compliance
Details 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 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.
- compliance
Details 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.
- resource
Arn String - ARN of the resource.
- Map<String>
- Map of tags assigned to the resource.
GetResourcesResourceTagMappingListComplianceDetail
- 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 List<string>Noncompliant Values - Non
Compliant List<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 []stringNoncompliant Values - Non
Compliant []stringKeys
- compliance
Status 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.
- keys
With List<String>Noncompliant Values - non
Compliant List<String>Keys
- compliance
Status 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.
- keys
With string[]Noncompliant Values - non
Compliant 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
- compliance
Status 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.
- keys
With List<String>Noncompliant Values - non
Compliant List<String>Keys
GetResourcesTagFilter
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.