Skip to content

Data Source: awsResourcegroupstaggingapiResources

Provides details about resource tagging.

Example Usage

Get All Resource Tag Mappings

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.dataAwsResourcegroupstaggingapiResources.DataAwsResourcegroupstaggingapiResources(
  this,
  "test",
  {}
);

Filter By Tag Key and Value

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.dataAwsResourcegroupstaggingapiResources.DataAwsResourcegroupstaggingapiResources(
  this,
  "test",
  {
    tagFilter: [
      {
        key: "tag-key",
        values: ["tag-value-1", "tag-value-2"],
      },
    ],
  }
);

Filter By Resource Type

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.dataAwsResourcegroupstaggingapiResources.DataAwsResourcegroupstaggingapiResources(
  this,
  "test",
  {
    resourceTypeFilters: ["ec2:instance"],
  }
);

Argument Reference

The following arguments are supported:

  • excludeCompliantResources - (Optional) Specifies whether to exclude resources that are compliant with the tag policy. You can use this parameter only if the includeComplianceDetails argument is also set to true.
  • includeComplianceDetails - (Optional) Specifies whether to include details regarding the compliance with the effective tag policy.
  • tagFilter - (Optional) 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 resourceArnList.
  • resourceTypeFilters - (Optional) 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.
  • resourceArnList - (Optional) Specifies a list of ARNs of resources for which you want to retrieve tag data. Conflicts with filter.

Tag Filter

A tagFilter block supports the following arguments:

If you do specify tagFilter, the response returns only those resources that are currently associated with the specified tag. If you don't specify a tagFilter, the response includes all resources that were ever associated with tags. Resources that currently don't have associated tags are shown with an empty tag set.

  • key - (Required) One part of a key-value pair that makes up a tag.
  • values - (Optional) Optional part of a key-value pair that make up a tag.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • resourceTagMappingList - List of objects matching the search criteria.
  • complianceDetails - List of objects with information that shows whether a resource is compliant with the effective tag policy, including details on any noncompliant tag keys.
    • complianceStatus - Whether the resource is compliant.
    • keysWithNoncompliantValues - Set of tag keys with non-compliant tag values.
    • nonCompliantKeys - Set of non-compliant tag keys.
  • resourceArn - ARN of the resource.
  • tags - Map of tags assigned to the resource.