ec2: setting placement group name does not work
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
Unable to manually set/change the name of a placement group using with the [L1](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.CfnPlacementGroup.html#attrgroupname) or [L2](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.PlacementGroup.html#placementgroupname-1) construct
### Expected Behavior
As the the feature is documented, the expectation is to able to manually set a placement group name
### Current Behavior
The CDK will auto-generate a name for the placement group regardless if you is manually set
### Reproduction Steps
```
import { Duration, Stack, StackProps } from 'aws-cdk-lib';
import * as ec2 from 'aws-cdk-lib/aws-ec2';
import { Construct } from 'constructs';
export class PlacementStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
const placem = new ec2.PlacementGroup(this, 'MyPlacementGroup', /* all optional props */ {
partitions: 1,
placementGroupName: 'Testing2341413',
// spreadLevel: ec2.PlacementGroupSpreadLevel.HOST,
strategy: ec2.PlacementGroupStrategy.PARTITION,
});
}
}
```
### Possible Solution
_No response_
### Additional Information/Context
The underlying [CFN placement group](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-placementgroup.html) resource has no support for the placement group name property. Since the CDK is a wrapper for the CFN, there may be some back end integration that is not working as expected
### CDK CLI Version
2.108.1 (build 2320255)
### Framework Version
_No response_
### Node.js Version
v18.17.1
### OS
n/a
### Language
TypeScript
### Language Version
_No response_
### Other information
_No response_
Contributor guide
Research direction
Start with the aws_ec2.PlacementGroup and CfnPlacementGroup constructs referenced in the reproduction, then compare their documented placementGroupName behavior with the linked CloudFormation placement-group resource. Reproduce the TypeScript example and determine whether the expected name can be supported or whether the documentation and behavior need alignment; done means the documented behavior is accurate and covered by an appropriate test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100