Skip to content

Resource: awsEcsTag

Manages an individual ECS resource tag. This resource should only be used in cases where ECS resources are created outside Terraform (e.g., ECS Clusters implicitly created by Batch Compute Environments).

\~> NOTE: This tagging resource should not be combined with the Terraform resource for managing the parent resource. For example, using awsEcsCluster and awsEcsTag to manage tags of the same ECS Cluster will cause a perpetual difference where the awsEcsCluster resource will try to remove the tag being added by the awsEcsTag resource.

\~> NOTE: This tagging resource does not use the provider ignoreTags configuration.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsBatchComputeEnvironmentExample =
  new aws.batchComputeEnvironment.BatchComputeEnvironment(this, "example", {
    computeEnvironmentName: "example",
    serviceRole: "${aws_iam_role.example.arn}",
    type: "UNMANAGED",
  });
const awsEcsTagExample = new aws.ecsTag.EcsTag(this, "example_1", {
  key: "Name",
  resourceArn: awsBatchComputeEnvironmentExample.ecsClusterArn,
  value: "Hello World",
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsEcsTagExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • resourceArn - (Required) Amazon Resource Name (ARN) of the ECS resource to tag.
  • key - (Required) Tag name.
  • value - (Required) Tag value.

Attributes Reference

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

  • id - ECS resource identifier and key, separated by a comma (,)

Import

awsEcsTag can be imported by using the ECS resource identifier and key, separated by a comma (,), e.g.,

$ terraform import aws_ecs_tag.example arn:aws:ecs:us-east-1:123456789012:cluster/example,Name