Skip to content

(ec2-alpha): Expose VpcPeeringRole role name #35591

@moltar

Description

@moltar

Describe the feature

createAcceptorVpcRole is a method that creates the role, but then the requester needs the same role to be specified via peerRoleArn.

This then introduces a "magic string" anti-pattern.

Use Case

To avoid magic strings.

Proposed Solution

Would be great to either have the role name available via some const, or even better have another method:

createRequestorPeerRole: IRole

And then createPeeringConnection would accept peerRole, instead of peerRoleArn.

Example:

requestorVpc.createPeeringConnection("Peering", {
  acceptorVpc,
  peerRole: requestorVpc.createRequestorPeerRole(awsAccount: string)
});

Other Information

const peeringRole = new Role(this, 'VpcPeeringRole', {
assumedBy: new AccountPrincipal(requestorAccountId),
roleName: 'VpcPeeringRole',
description: 'Restrictive role for VPC peering',
});

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

AWS CDK Library version (aws-cdk-lib)

N/A

AWS CDK CLI version

N/A

Environment details (OS name and version, etc.)

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-iamRelated to AWS Identity and Access Managementfeature-requestA feature should be added or improved.p2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions