From fa352a6684ca6dc74d7a41cff68d662bf5eb8ae0 Mon Sep 17 00:00:00 2001 From: Luke Hoban Date: Tue, 29 Dec 2020 21:06:14 +1100 Subject: [PATCH 1/2] Update ecs types The awsx.ecs types have drifted a little relative to the aws.ecs types. This change brings them up to date with the latest types in the AWS package. In particular this adds: * Container#interactive * ServiceArgs#forceNewDeployment * TaskDefinitionArgs#inferenceAccelerators * TaskDefinitionArgs#ipcMode * TaskDefinitionArgs#pidMode * TaskDefinitionArgs#proxyConfiguration Aside: The implementation includes an Override type that attempts to derive the correct type from the upstream types. If this had been used directly, it would have avoided the need for this maintenance. But documentation and error message experiences in TypeScript are not good for these derived types, so we instead also manually maintain a copy of the types. We then attempt to verify that the manually maintained copy is compatible, but that attempt only verifies required properties, leaving the possibility that drift in optional properties (which in practice is the only kind of drift that can happen) will not be caught. We likely need to revisit the overall strategy here. Fixes #615. --- nodejs/awsx/ecs/container.ts | 7 +++ nodejs/awsx/ecs/service.ts | 32 ++++++++----- nodejs/awsx/ecs/taskDefinition.ts | 79 +++++++++++++++++++------------ 3 files changed, 77 insertions(+), 41 deletions(-) diff --git a/nodejs/awsx/ecs/container.ts b/nodejs/awsx/ecs/container.ts index 192efc4ee..90116bcb5 100644 --- a/nodejs/awsx/ecs/container.ts +++ b/nodejs/awsx/ecs/container.ts @@ -484,6 +484,13 @@ export interface Container { */ hostname?: pulumi.Input; + /** + * When this parameter is true, this allows you to deploy containerized applications that + * require stdin or a tty to be allocated. This parameter maps to OpenStdin in the Create + * a container section of the Docker Remote API and the --interactive option to docker run. + */ + interactive?: pulumi.Input; + /** * The links parameter allows containers to communicate with each other without the need for * port mappings. This parameter is only supported if the network mode of a task definition is diff --git a/nodejs/awsx/ecs/service.ts b/nodejs/awsx/ecs/service.ts index 4d899e5d6..080f3a850 100644 --- a/nodejs/awsx/ecs/service.ts +++ b/nodejs/awsx/ecs/service.ts @@ -205,6 +205,14 @@ export interface ServiceArgs { */ enableEcsManagedTags?: pulumi.Input; + /** + * Enable to force a new task deployment of the service. This can be used to update tasks + * to use a newer Docker image with same image/tag combination (e.g. `myimage:latest`), roll + * Fargate tasks onto a newer platform version, or immediately deploy `orderedPlacementStrategy` + * and `placementConstraints` updates. + */ + forceNewDeployment?: pulumi.Input; + /** * Seconds to ignore failing load balancer health checks on newly instantiated tasks to prevent * premature shutdown, up to 7200. Only valid for services configured to use load balancers. @@ -282,6 +290,18 @@ export interface ServiceArgs { */ serviceRegistries?: aws.ecs.ServiceArgs["serviceRegistries"]; + /** + * Key-value mapping of resource tags + */ + tags?: pulumi.Input; + + /** + * Wait for the service to reach a steady state (like [`aws ecs wait + * services-stable`](https://docs.aws.amazon.com/cli/latest/reference/ecs/wait/services-stable.html)) + * before continuing. Defaults to `true`. + */ + waitForSteadyState?: pulumi.Input; + // Changes we made to the core args type. /** @@ -298,18 +318,6 @@ export interface ServiceArgs { * Security groups determining how this service can be reached. */ securityGroups: x.ec2.SecurityGroup[]; - - /** - * Wait for the service to reach a steady state (like [`aws ecs wait - * services-stable`](https://docs.aws.amazon.com/cli/latest/reference/ecs/wait/services-stable.html)) - * before continuing. Defaults to `true`. - */ - waitForSteadyState?: pulumi.Input; - - /** - * Key-value mapping of resource tags - */ - tags?: pulumi.Input; } // Make sure our exported args shape is compatible with the overwrite shape we're trying to provide. diff --git a/nodejs/awsx/ecs/taskDefinition.ts b/nodejs/awsx/ecs/taskDefinition.ts index 7901c446b..aab0b9068 100644 --- a/nodejs/awsx/ecs/taskDefinition.ts +++ b/nodejs/awsx/ecs/taskDefinition.ts @@ -290,7 +290,7 @@ type OverwriteShape = utils.Overwrite; export interface TaskDefinitionArgs { - // Properties copied from aws.ecs.TaskDefinitionArgs + // Added for AWSX /** * The vpc that the service for this task will run in. Does not normally need to be explicitly @@ -299,29 +299,26 @@ export interface TaskDefinitionArgs { vpc?: x.ec2.Vpc; /** - * A set of placement constraints rules that are taken into consideration during task placement. - * Maximum number of `placement_constraints` is `10`. - */ - placementConstraints?: aws.ecs.TaskDefinitionArgs["placementConstraints"]; - - /** - * A set of volume blocks that containers in your task may use. + * Log group for logging information related to the service. If `undefined` a default instance + * with a one-day retention policy will be created. If `null`, no log group will be created. */ - volumes?: aws.ecs.TaskDefinitionArgs["volumes"]; + logGroup?: aws.cloudwatch.LogGroup | null; - // Properties we've added/changed. + // Copied from aws.ecs.TaskDefinitionArgs /** - * Log group for logging information related to the service. If `undefined` a default instance - * with a one-day retention policy will be created. If `null`, no log group will be created. + * All the containers to make a ClusterTaskDefinition from. Useful when creating a + * ClusterService that will contain many containers within. + * + * Either [container] or [containers] must be provided. */ - logGroup?: aws.cloudwatch.LogGroup | null; + containers: Record; /** - * IAM role that allows your Amazon ECS container task to make calls to other AWS services. If - * `undefined`, a default will be created for the task. If `null`, no task will be created. + * The number of cpu units used by the task. If not provided, a default will be computed + * based on the cumulative needs specified by [containerDefinitions] */ - taskRole?: aws.iam.Role | null; + cpu?: pulumi.Input; /** * The execution role that the Amazon ECS container agent and the Docker daemon can assume. @@ -336,21 +333,20 @@ export interface TaskDefinitionArgs { family?: pulumi.Input; /** - * The number of cpu units used by the task. If not provided, a default will be computed - * based on the cumulative needs specified by [containerDefinitions] + * Configuration block(s) with Inference Accelerators settings. Detailed below. */ - cpu?: pulumi.Input; + inferenceAccelerators?: pulumi.Input[]>; /** - * The amount (in MiB) of memory used by the task. If not provided, a default will be computed - * based on the cumulative needs specified by [containerDefinitions] + * The IPC resource namespace to be used for the containers in the task The valid values are `host`, `task`, and `none`. */ - memory?: pulumi.Input; + ipcMode?: pulumi.Input; /** - * A set of launch types required by the task. The valid values are `EC2` and `FARGATE`. + * The amount (in MiB) of memory used by the task. If not provided, a default will be computed + * based on the cumulative needs specified by [containerDefinitions] */ - requiresCompatibilities: pulumi.Input<["FARGATE"] | ["EC2"]>; + memory?: pulumi.Input; /** * The Docker networking mode to use for the containers in the task. The valid values are @@ -359,17 +355,42 @@ export interface TaskDefinitionArgs { networkMode?: pulumi.Input<"none" | "bridge" | "awsvpc" | "host">; /** - * All the containers to make a ClusterTaskDefinition from. Useful when creating a - * ClusterService that will contain many containers within. - * - * Either [container] or [containers] must be provided. + * The process namespace to use for the containers in the task. The valid values are `host` and `task`. */ - containers: Record; + pidMode?: pulumi.Input; + + /** + * A set of placement constraints rules that are taken into consideration during task placement. + * Maximum number of `placement_constraints` is `10`. + */ + placementConstraints?: aws.ecs.TaskDefinitionArgs["placementConstraints"]; + + /** + * The proxy configuration details for the App Mesh proxy. + */ + proxyConfiguration?: aws.ecs.TaskDefinitionArgs["proxyConfiguration"]; + + /** + * A set of launch types required by the task. The valid values are `EC2` and `FARGATE`. + */ + requiresCompatibilities: pulumi.Input<["FARGATE"] | ["EC2"]>; /** * Key-value mapping of resource tags */ tags?: pulumi.Input; + + /** + * IAM role that allows your Amazon ECS container task to make calls to other AWS services. If + * `undefined`, a default will be created for the task. If `null`, no task will be created. + */ + taskRole?: aws.iam.Role | null; + + /** + * A set of volume blocks that containers in your task may use. + */ + volumes?: aws.ecs.TaskDefinitionArgs["volumes"]; + } // Make sure our exported args shape is compatible with the overwrite shape we're trying to provide. From be407fa9534135a30593801ba46269bc4bbbaa5b Mon Sep 17 00:00:00 2001 From: Luke Hoban Date: Tue, 29 Dec 2020 21:14:42 +1100 Subject: [PATCH 2/2] Add CHANGELOG --- CHANGELOG.md | 1 + nodejs/awsx/ecs/container.ts | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed69c4c6d..18f7c3d95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ CHANGELOG [#581](https://github.com/pulumi/pulumi-awsx/pull/581) * Add `cloudtrail.Trail` component which can generate the required roles and bucket for a CloudTrail. * Update `lb.NetworkTargetGroupHealthCheck` to allow for `path` and `matcher` properties. +* Update ECS types [#616](https://github.com/pulumi/pulumi-awsx/pull/616) ## 0.22.0 (2020-09-01) diff --git a/nodejs/awsx/ecs/container.ts b/nodejs/awsx/ecs/container.ts index 90116bcb5..f65d06ad0 100644 --- a/nodejs/awsx/ecs/container.ts +++ b/nodejs/awsx/ecs/container.ts @@ -486,10 +486,10 @@ export interface Container { /** * When this parameter is true, this allows you to deploy containerized applications that - * require stdin or a tty to be allocated. This parameter maps to OpenStdin in the Create - * a container section of the Docker Remote API and the --interactive option to docker run. + * require stdin or a tty to be allocated. This parameter maps to OpenStdin in the Create a + * container section of the Docker Remote API and the --interactive option to docker run. */ - interactive?: pulumi.Input; + interactive?: pulumi.Input; /** * The links parameter allows containers to communicate with each other without the need for