Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ec2: setting placement group name does not work #28361

Open
NdemeraS opened this issue Dec 14, 2023 · 2 comments
Open

ec2: setting placement group name does not work #28361

NdemeraS opened this issue Dec 14, 2023 · 2 comments
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud blocked Work is blocked on this issue for this codebase. Other labels or comments may indicate why. bug This issue is a bug. effort/medium Medium work item – several days of effort needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed. p2

Comments

@NdemeraS
Copy link

Describe the bug

Unable to manually set/change the name of a placement group using with the L1 or L2 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 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

@NdemeraS NdemeraS added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Dec 14, 2023
@github-actions github-actions bot added the @aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud label Dec 14, 2023
@pahud pahud changed the title (Placement Group): (Setting placement group name does not work) ec2: setting placement group name does not work Dec 14, 2023
@pahud
Copy link
Contributor

pahud commented Dec 14, 2023

Yes. As you mentioned, the placegroup name is not a property in its CFN resource and if we look at the constructor from CDK source code, it does not really pass to the L1 resource.

const resource = new CfnPlacementGroup(this, 'Resource', {
partitionCount: this.partitions,
spreadLevel: this.spreadLevel,
strategy: this.strategy,
});
this.placementGroupName = this.getResourceArnAttribute(resource.attrGroupName, {
service: 'batch',
resource: 'compute-environment',
resourceName: this.physicalName,
});

I guess maybe the L2 resource can create a Name tag with the placegroup name as its value but it's very opinionated and requires some discussion.

Are you able to specify the name from console? What will happen when you specify a name for that? Will the console create a Name tag for you? If yes then it makes perfect sense to create a Name tag in the L2 constructor.

@pahud pahud added p2 effort/medium Medium work item – several days of effort response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Dec 14, 2023
@pahud
Copy link
Contributor

pahud commented Dec 15, 2023

OK I can confirm this should be a gap from cloudformation and it's not possible to specify the Name through CFN and CDK cannot do anything with that.

Please create a feature request in cloudformation-coverage-roadmap github repo and allow the community to vote for more visibility. After CFN supports that, CDK would follow up and support it very soon.

@pahud pahud added needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed. blocked Work is blocked on this issue for this codebase. Other labels or comments may indicate why. labels Dec 15, 2023
@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Dec 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud blocked Work is blocked on this issue for this codebase. Other labels or comments may indicate why. bug This issue is a bug. effort/medium Medium work item – several days of effort needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed. p2
Projects
None yet
Development

No branches or pull requests

2 participants