UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

189 lines 6.77 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.Cluster = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides an ECS cluster. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const foo = new aws.ecs.Cluster("foo", { * name: "white-hart", * settings: [{ * name: "containerInsights", * value: "enabled", * }], * }); * ``` * * ### Execute Command Configuration with Override Logging * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.kms.Key("example", { * description: "example", * deletionWindowInDays: 7, * }); * const exampleLogGroup = new aws.cloudwatch.LogGroup("example", {name: "example"}); * const test = new aws.ecs.Cluster("test", { * name: "example", * configuration: { * executeCommandConfiguration: { * kmsKeyId: example.arn, * logging: "OVERRIDE", * logConfiguration: { * cloudWatchEncryptionEnabled: true, * cloudWatchLogGroupName: exampleLogGroup.name, * }, * }, * }, * }); * ``` * * ### Fargate Ephemeral Storage Encryption with Customer-Managed KMS Key * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const current = aws.getCallerIdentity({}); * const example = new aws.kms.Key("example", { * description: "example", * deletionWindowInDays: 7, * }); * const exampleKeyPolicy = new aws.kms.KeyPolicy("example", { * keyId: example.id, * policy: JSON.stringify({ * Id: "ECSClusterFargatePolicy", * Statement: [ * { * Sid: "Enable IAM User Permissions", * Effect: "Allow", * Principal: { * AWS: "*", * }, * Action: "kms:*", * Resource: "*", * }, * { * Sid: "Allow generate data key access for Fargate tasks.", * Effect: "Allow", * Principal: { * Service: "fargate.amazonaws.com", * }, * Action: ["kms:GenerateDataKeyWithoutPlaintext"], * Condition: { * StringEquals: { * "kms:EncryptionContext:aws:ecs:clusterAccount": [current.then(current => current.accountId)], * "kms:EncryptionContext:aws:ecs:clusterName": ["example"], * }, * }, * Resource: "*", * }, * { * Sid: "Allow grant creation permission for Fargate tasks.", * Effect: "Allow", * Principal: { * Service: "fargate.amazonaws.com", * }, * Action: ["kms:CreateGrant"], * Condition: { * StringEquals: { * "kms:EncryptionContext:aws:ecs:clusterAccount": [current.then(current => current.accountId)], * "kms:EncryptionContext:aws:ecs:clusterName": ["example"], * }, * "ForAllValues:StringEquals": { * "kms:GrantOperations": ["Decrypt"], * }, * }, * Resource: "*", * }, * ], * Version: "2012-10-17", * }), * }); * const test = new aws.ecs.Cluster("test", { * name: "example", * configuration: { * managedStorageConfiguration: { * fargateEphemeralStorageKmsKeyId: example.id, * }, * }, * }, { * dependsOn: [exampleKeyPolicy], * }); * ``` * * ## Import * * Using `pulumi import`, import ECS clusters using the cluster name. For example: * * ```sh * $ pulumi import aws:ecs/cluster:Cluster stateless stateless-app * ``` */ class Cluster extends pulumi.CustomResource { /** * Get an existing Cluster resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new Cluster(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of Cluster. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === Cluster.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["arn"] = state?.arn; resourceInputs["configuration"] = state?.configuration; resourceInputs["name"] = state?.name; resourceInputs["region"] = state?.region; resourceInputs["serviceConnectDefaults"] = state?.serviceConnectDefaults; resourceInputs["settings"] = state?.settings; resourceInputs["tags"] = state?.tags; resourceInputs["tagsAll"] = state?.tagsAll; } else { const args = argsOrState; resourceInputs["configuration"] = args?.configuration; resourceInputs["name"] = args?.name; resourceInputs["region"] = args?.region; resourceInputs["serviceConnectDefaults"] = args?.serviceConnectDefaults; resourceInputs["settings"] = args?.settings; resourceInputs["tags"] = args?.tags; resourceInputs["arn"] = undefined /*out*/; resourceInputs["tagsAll"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Cluster.__pulumiType, name, resourceInputs, opts); } } exports.Cluster = Cluster; /** @internal */ Cluster.__pulumiType = 'aws:ecs/cluster:Cluster'; //# sourceMappingURL=cluster.js.map