# TagProps

Properties for a tag.

Used as props by: [RemoveTag](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.RemoveTag.html), [Tag](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Tag.html)
Used as argument in: [Tags.add](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Tags.html#add), [Tags.remove](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Tags.html#remove)

- Source: [`core/lib/tag-aspect.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/core/lib/tag-aspect.ts#L16)
- Type last changed: v2.60.0 · 12 Jan 2023

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
const tagProps: cdk.TagProps = {
  applyToLaunchedInstances: false,
  excludeResourceTypes: ['excludeResourceTypes'],
  includeResourceTypes: ['includeResourceTypes'],
  priority: 123,
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk

tag_props = cdk.TagProps(
    apply_to_launched_instances=False,
    exclude_resource_types=["excludeResourceTypes"],
    include_resource_types=["includeResourceTypes"],
    priority=123
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;

TagProps tagProps = TagProps.builder()
        .applyToLaunchedInstances(false)
        .excludeResourceTypes(List.of("excludeResourceTypes"))
        .includeResourceTypes(List.of("includeResourceTypes"))
        .priority(123)
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;

var tagProps = new TagProps {
    ApplyToLaunchedInstances = false,
    ExcludeResourceTypes = new [] { "excludeResourceTypes" },
    IncludeResourceTypes = new [] { "includeResourceTypes" },
    Priority = 123
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cdk "github.com/aws/aws-cdk-go/awscdk"

tagProps := &TagProps{
	ApplyToLaunchedInstances: jsii.Boolean(false),
	ExcludeResourceTypes: []*string{
		jsii.String("excludeResourceTypes"),
	},
	IncludeResourceTypes: []*string{
		jsii.String("includeResourceTypes"),
	},
	Priority: jsii.Number(123),
}
```

## Properties

- `applyToLaunchedInstances`: boolean = true — Whether the tag should be applied to instances in an AutoScalingGroup.

- `excludeResourceTypes`: string[] = [] — An array of Resource Types that will not receive this tag.

  An empty array will allow this tag to be applied to all resources. A
  non-empty array will apply this tag only if the Resource type is not in
  this array.

- `includeResourceTypes`: string[] = [] — An array of Resource Types that will receive this tag.

  An empty array will match any Resource. A non-empty array will apply this
  tag only to Resource types that are included in this array.

- `priority`: number — Priority of the tag operation.

  **Default:** Default priorities: - 100 for `SetTag` - 200 for `RemoveTag` - 50 for tags added directly to CloudFormation resources

  Higher or equal priority tags will take precedence.

  Setting priority will enable the user to control tags when they need to not
  follow the default precedence pattern of last applied and closest to the
  construct in the tree.
