Skip to content

Commit 243b4ad

Browse files
authored
docs(ecs): fixes rosetta extraction errors in the README file (#22646)
When running `yarn rosetta:extract --strict` in `@aws-cdk/aws-ecs` package, there are various errors: ![CleanShot 2022-10-25 at 22 08 55](https://user-images.githubusercontent.com/2566530/197918399-870c9bf6-4279-491f-a69a-654109472a23.png) This PR fixes all that so the command works. ![CleanShot 2022-10-25 at 22 14 03](https://user-images.githubusercontent.com/2566530/197918475-da87f603-a42f-40a1-9030-77511daa9c29.png) ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 31fe2e4 commit 243b4ad

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages/@aws-cdk/aws-ecs/README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ runs a service on it:
2626
declare const vpc: ec2.Vpc;
2727

2828
// Create an ECS cluster
29-
const cluster = new ecs.Cluster(this, 'Cluster', {
30-
vpc,
31-
});
29+
const cluster = new ecs.Cluster(this, 'Cluster', { vpc });
3230

3331
// Add capacity to it
3432
cluster.addCapacity('DefaultAutoScalingGroupCapacity', {
@@ -171,6 +169,7 @@ const autoScalingGroup = new autoscaling.AutoScalingGroup(this, 'ASG', {
171169
To use `LaunchTemplate` with `AsgCapacityProvider`, make sure to specify the `userData` in the `LaunchTemplate`:
172170

173171
```ts
172+
declare const vpc: ec2.Vpc;
174173
const launchTemplate = new ec2.LaunchTemplate(this, 'ASG-LaunchTemplate', {
175174
instanceType: new ec2.InstanceType('t3.medium'),
176175
machineImage: ecs.EcsOptimizedImage.amazonLinux2(),
@@ -424,7 +423,7 @@ To grant a principal permission to run your `TaskDefinition`, you can use the `T
424423

425424
```ts
426425
declare const role: iam.IGrantable;
427-
const taskDef = new ecs.TaskDefinition(stack, 'TaskDef', {
426+
const taskDef = new ecs.TaskDefinition(this, 'TaskDef', {
428427
cpu: '512',
429428
memoryMiB: '512',
430429
compatibility: ecs.Compatibility.EC2_AND_FARGATE,
@@ -501,7 +500,7 @@ taskDefinition.addContainer('container', {
501500
linuxParameters: new ecs.LinuxParameters(this, 'LinuxParameters', {
502501
initProcessEnabled: true,
503502
sharedMemorySize: 1024,
504-
maxSwap: 5000,
503+
maxSwap: Size.mebibytes(5000),
505504
swappiness: 90,
506505
}),
507506
});
@@ -890,7 +889,7 @@ taskDefinition.addContainer('TheContainer', {
890889
### splunk Log Driver
891890

892891
```ts
893-
declare const secret: secretsmanager.Secret;
892+
declare const secret: ecs.Secret;
894893

895894
// Create a Task Definition for the container to start
896895
const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef');

packages/@aws-cdk/aws-ecs/rosetta/default.ts-fixture

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Fixture with packages imported, but nothing else
22
import { Construct } from 'constructs';
3-
import { SecretValue, Stack } from '@aws-cdk/core';
3+
import { SecretValue, Stack, Size } from '@aws-cdk/core';
44
import autoscaling = require('@aws-cdk/aws-autoscaling');
55
import cloudmap = require('@aws-cdk/aws-servicediscovery');
66
import ecs = require('@aws-cdk/aws-ecs');
@@ -14,6 +14,7 @@ import s3 = require('@aws-cdk/aws-s3');
1414
import secretsmanager = require('@aws-cdk/aws-secretsmanager');
1515
import ssm = require('@aws-cdk/aws-ssm');
1616
import targets = require('@aws-cdk/aws-events-targets');
17+
import iam = require('@aws-cdk/aws-iam');
1718
import path = require('path');
1819

1920
class Fixture extends Stack {

0 commit comments

Comments
 (0)