Tag
Manages an individual ECS resource tag. This resource should only be used in cases where ECS resources are created outside the provider (e.g., ECS Clusters implicitly created by Batch Compute Environments).
NOTE: This tagging resource should not be combined with the resource for managing the parent resource. For example, using
aws.ecs.Cluster
andaws.ecs.Tag
to manage tags of the same ECS Cluster will cause a perpetual difference where theaws.ecs.Cluster
resource will try to remove the tag being added by theaws.ecs.Tag
resource. NOTE: This tagging resource does not use the providerignore_tags
configuration.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.batch.ComputeEnvironment("example", {
computeEnvironmentName: "example",
serviceRole: exampleAwsIamRole.arn,
type: "UNMANAGED",
});
const exampleTag = new aws.ecs.Tag("example", {
resourceArn: example.ecsClusterArn,
key: "Name",
value: "Hello World",
});
Content copied to clipboard
import pulumi
import pulumi_aws as aws
example = aws.batch.ComputeEnvironment("example",
compute_environment_name="example",
service_role=example_aws_iam_role["arn"],
type="UNMANAGED")
example_tag = aws.ecs.Tag("example",
resource_arn=example.ecs_cluster_arn,
key="Name",
value="Hello World")
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Batch.ComputeEnvironment("example", new()
{
ComputeEnvironmentName = "example",
ServiceRole = exampleAwsIamRole.Arn,
Type = "UNMANAGED",
});
var exampleTag = new Aws.Ecs.Tag("example", new()
{
ResourceArn = example.EcsClusterArn,
Key = "Name",
Value = "Hello World",
});
});
Content copied to clipboard
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/batch"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ecs"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := batch.NewComputeEnvironment(ctx, "example", &batch.ComputeEnvironmentArgs{
ComputeEnvironmentName: pulumi.String("example"),
ServiceRole: pulumi.Any(exampleAwsIamRole.Arn),
Type: pulumi.String("UNMANAGED"),
})
if err != nil {
return err
}
_, err = ecs.NewTag(ctx, "example", &ecs.TagArgs{
ResourceArn: example.EcsClusterArn,
Key: pulumi.String("Name"),
Value: pulumi.String("Hello World"),
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.batch.ComputeEnvironment;
import com.pulumi.aws.batch.ComputeEnvironmentArgs;
import com.pulumi.aws.ecs.Tag;
import com.pulumi.aws.ecs.TagArgs;
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) {
var example = new ComputeEnvironment("example", ComputeEnvironmentArgs.builder()
.computeEnvironmentName("example")
.serviceRole(exampleAwsIamRole.arn())
.type("UNMANAGED")
.build());
var exampleTag = new Tag("exampleTag", TagArgs.builder()
.resourceArn(example.ecsClusterArn())
.key("Name")
.value("Hello World")
.build());
}
}
Content copied to clipboard
resources:
example:
type: aws:batch:ComputeEnvironment
properties:
computeEnvironmentName: example
serviceRole: ${exampleAwsIamRole.arn}
type: UNMANAGED
exampleTag:
type: aws:ecs:Tag
name: example
properties:
resourceArn: ${example.ecsClusterArn}
key: Name
value: Hello World
Content copied to clipboard
Import
Using pulumi import
, import aws_ecs_tag
using the ECS resource identifier and key, separated by a comma (,
). For example:
$ pulumi import aws:ecs/tag:Tag example arn:aws:ecs:us-east-1:123456789012:cluster/example,Name
Content copied to clipboard