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

feat: intro "Names.uniqueId()" instead of the deprecated "node.uniqueId" #11166

Merged
merged 23 commits into from
Nov 3, 2020
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/@aws-cdk/aws-apigateway/lib/authorizers/lambda.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as iam from '@aws-cdk/aws-iam';
import * as lambda from '@aws-cdk/aws-lambda';
import { Duration, Lazy, Stack } from '@aws-cdk/core';
import { Duration, Lazy, Names, Stack } from '@aws-cdk/core';
import { Construct } from 'constructs';
import { CfnAuthorizer } from '../apigateway.generated';
import { Authorizer, IAuthorizer } from '../authorizer';
Expand All @@ -13,7 +13,7 @@ export interface LambdaAuthorizerProps {
/**
* An optional human friendly name for the authorizer. Note that, this is not the primary identifier of the authorizer.
*
* @default this.node.uniqueId
* @default - the unique construcrt ID
*/
readonly authorizerName?: string;

Expand Down Expand Up @@ -97,7 +97,7 @@ abstract class LambdaAuthorizer extends Authorizer implements IAuthorizer {
*/
protected setupPermissions() {
if (!this.role) {
this.handler.addPermission(`${this.node.uniqueId}:Permissions`, {
this.handler.addPermission(`${Names.uniqueId(this)}:Permissions`, {
principal: new iam.ServicePrincipal('apigateway.amazonaws.com'),
sourceArn: this.authorizerArn,
});
Expand Down Expand Up @@ -168,7 +168,7 @@ export class TokenAuthorizer extends LambdaAuthorizer {

const restApiId = this.lazyRestApiId();
const resource = new CfnAuthorizer(this, 'Resource', {
name: props.authorizerName ?? this.node.uniqueId,
name: props.authorizerName ?? Names.uniqueId(this),
restApiId,
type: 'TOKEN',
authorizerUri: lambdaAuthorizerArn(props.handler),
Expand Down Expand Up @@ -230,7 +230,7 @@ export class RequestAuthorizer extends LambdaAuthorizer {

const restApiId = this.lazyRestApiId();
const resource = new CfnAuthorizer(this, 'Resource', {
name: props.authorizerName ?? this.node.uniqueId,
name: props.authorizerName ?? Names.uniqueId(this),
restApiId,
type: 'REQUEST',
authorizerUri: lambdaAuthorizerArn(props.handler),
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-apigateway/lib/domain-name.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as acm from '@aws-cdk/aws-certificatemanager';
import { IBucket } from '@aws-cdk/aws-s3';
import { IResource, Resource, Token } from '@aws-cdk/core';
import { IResource, Names, Resource, Token } from '@aws-cdk/core';
import { Construct } from 'constructs';
import { CfnDomainName } from './apigateway.generated';
import { BasePathMapping, BasePathMappingOptions } from './base-path-mapping';
Expand Down Expand Up @@ -147,7 +147,7 @@ export class DomainName extends Resource implements IDomainName {
*/
public addBasePathMapping(targetApi: IRestApi, options: BasePathMappingOptions = { }) {
const basePath = options.basePath || '/';
const id = `Map:${basePath}=>${targetApi.node.uniqueId}`;
const id = `Map:${basePath}=>${Names.uniqueId(targetApi)}`;
return new BasePathMapping(this, id, {
domainName: this,
restApi: targetApi,
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-apigateway/lib/integrations/lambda.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as iam from '@aws-cdk/aws-iam';
import * as lambda from '@aws-cdk/aws-lambda';
import { Lazy, Token } from '@aws-cdk/core';
import { Lazy, Names, Token } from '@aws-cdk/core';
import { IntegrationConfig, IntegrationOptions } from '../integration';
import { Method } from '../method';
import { AwsIntegration } from './aws';
Expand Down Expand Up @@ -56,7 +56,7 @@ export class LambdaIntegration extends AwsIntegration {
const bindResult = super.bind(method);
const principal = new iam.ServicePrincipal('apigateway.amazonaws.com');

const desc = `${method.api.node.uniqueId}.${method.httpMethod}.${method.resource.path.replace(/\//g, '.')}`;
const desc = `${Names.uniqueId(method.api)}.${method.httpMethod}.${method.resource.path.replace(/\//g, '.')}`;

this.handler.addPermission(`ApiPermission.${desc}`, {
principal,
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-apigateway/lib/usage-plan.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Lazy, Resource, Token } from '@aws-cdk/core';
import { Lazy, Names, Resource, Token } from '@aws-cdk/core';
import { Construct } from 'constructs';
import { IApiKey } from './api-key';
import { CfnUsagePlan, CfnUsagePlanKey } from './apigateway.generated';
Expand Down Expand Up @@ -182,7 +182,7 @@ export class UsagePlan extends Resource {
const prefix = 'UsagePlanKeyResource';

// Postfixing apikey id only from the 2nd child, to keep physicalIds of UsagePlanKey for existing CDK apps unmodifed.
const id = this.node.tryFindChild(prefix) ? `${prefix}:${apiKey.node.uniqueId}` : prefix;
const id = this.node.tryFindChild(prefix) ? `${prefix}:${Names.uniqueId(apiKey)}` : prefix;

new CfnUsagePlanKey(this, id, {
keyId: apiKey.keyId,
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-apigateway/lib/vpc-link.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2';
import { IResource, Lazy, Resource } from '@aws-cdk/core';
import { IResource, Lazy, Names, Resource } from '@aws-cdk/core';
import { Construct } from 'constructs';
import { CfnVpcLink } from './apigateway.generated';

Expand Down Expand Up @@ -66,7 +66,7 @@ export class VpcLink extends Resource implements IVpcLink {
constructor(scope: Construct, id: string, props: VpcLinkProps = {}) {
super(scope, id, {
physicalName: props.vpcLinkName ||
Lazy.stringValue({ produce: () => this.node.uniqueId }),
Lazy.stringValue({ produce: () => Names.uniqueId(this.node) }),
});

const cfnResource = new CfnVpcLink(this, 'Resource', {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ServicePrincipal } from '@aws-cdk/aws-iam';
import { IFunction } from '@aws-cdk/aws-lambda';
import { Stack } from '@aws-cdk/core';
import { Names, Stack } from '@aws-cdk/core';
import { HttpIntegrationType, HttpRouteIntegrationBindOptions, HttpRouteIntegrationConfig, IHttpRouteIntegration, PayloadFormatVersion } from '../integration';

/**
Expand Down Expand Up @@ -30,7 +30,7 @@ export class LambdaProxyIntegration implements IHttpRouteIntegration {

public bind(options: HttpRouteIntegrationBindOptions): HttpRouteIntegrationConfig {
const route = options.route;
this.props.handler.addPermission(`${route.node.uniqueId}-Permission`, {
this.props.handler.addPermission(`${Names.uniqueId(route)}-Permission`, {
scope: options.scope,
principal: new ServicePrincipal('apigateway.amazonaws.com'),
sourceArn: Stack.of(route).formatArn({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class StepScalingAction extends cdk.Construct {
// properties, or the ScalingTargetId property, but not both.
// https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-applicationautoscaling-scalingpolicy.html
const resource = new CfnScalingPolicy(this, 'Resource', {
policyName: props.policyName || this.node.uniqueId,
policyName: props.policyName || cdk.Names.uniqueId(this),
policyType: 'StepScaling',
scalingTargetId: props.scalingTarget.scalableTargetId,
stepScalingPolicyConfiguration: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class TargetTrackingScalingPolicy extends cdk.Construct {
super(scope, id);

const resource = new CfnScalingPolicy(this, 'Resource', {
policyName: props.policyName || this.node.uniqueId,
policyName: props.policyName || cdk.Names.uniqueId(this),
policyType: 'TargetTrackingScaling',
scalingTargetId: props.scalingTarget.scalableTargetId,
targetTrackingScalingPolicyConfiguration: {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-appmesh/lib/mesh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export class Mesh extends MeshBase {

constructor(scope: Construct, id: string, props: MeshProps = {}) {
super(scope, id, {
physicalName: props.meshName || cdk.Lazy.stringValue({ produce: () => this.node.uniqueId }),
physicalName: props.meshName || cdk.Lazy.stringValue({ produce: () => cdk.Names.uniqueId(this) }),
});

const mesh = new CfnMesh(this, 'Resource', {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-appmesh/lib/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export class Route extends cdk.Resource implements IRoute {

constructor(scope: Construct, id: string, props: RouteProps) {
super(scope, id, {
physicalName: props.routeName || cdk.Lazy.stringValue({ produce: () => this.node.uniqueId }),
physicalName: props.routeName || cdk.Lazy.stringValue({ produce: () => cdk.Names.uniqueId(this) }),
});

this.virtualRouter = props.virtualRouter;
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-appmesh/lib/virtual-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export class VirtualNode extends VirtualNodeBase {

constructor(scope: Construct, id: string, props: VirtualNodeProps) {
super(scope, id, {
physicalName: props.virtualNodeName || cdk.Lazy.stringValue({ produce: () => this.node.uniqueId }),
physicalName: props.virtualNodeName || cdk.Lazy.stringValue({ produce: () => cdk.Names.uniqueId(this) }),
});

this.mesh = props.mesh;
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-appmesh/lib/virtual-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export class VirtualRouter extends VirtualRouterBase {

constructor(scope: Construct, id: string, props: VirtualRouterProps) {
super(scope, id, {
physicalName: props.virtualRouterName || cdk.Lazy.stringValue({ produce: () => this.node.uniqueId }),
physicalName: props.virtualRouterName || cdk.Lazy.stringValue({ produce: () => cdk.Names.uniqueId(this) }),
});

this.mesh = props.mesh;
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-appmesh/lib/virtual-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class VirtualService extends cdk.Resource implements IVirtualService {

constructor(scope: Construct, id: string, props: VirtualServiceProps) {
super(scope, id, {
physicalName: props.virtualServiceName || cdk.Lazy.stringValue({ produce: () => this.node.uniqueId }),
physicalName: props.virtualServiceName || cdk.Lazy.stringValue({ produce: () => cdk.Names.uniqueId(this) }),
});

if (props.virtualNode && props.virtualRouter) {
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-backup/lib/vault.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as iam from '@aws-cdk/aws-iam';
import * as kms from '@aws-cdk/aws-kms';
import * as sns from '@aws-cdk/aws-sns';
import { IResource, RemovalPolicy, Resource } from '@aws-cdk/core';
import { IResource, Names, RemovalPolicy, Resource } from '@aws-cdk/core';
import { Construct } from 'constructs';
import { CfnBackupVault } from './backup.generated';

Expand Down Expand Up @@ -161,7 +161,7 @@ export class BackupVault extends Resource implements IBackupVault {

private uniqueVaultName() {
// Max length of 50 chars, get the last 50 chars
const id = this.node.uniqueId;
const id = Names.uniqueId(this);
return id.substring(Math.max(id.length - 50, 0), id.length);
}
}
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-batch/test/compute-environment.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { throws } from 'assert';
import { expect, haveResource, haveResourceLike, ResourcePart } from '@aws-cdk/assert';
import '@aws-cdk/assert/jest';
import * as ec2 from '@aws-cdk/aws-ec2';
import * as ecs from '@aws-cdk/aws-ecs';
import * as iam from '@aws-cdk/aws-iam';
import * as cdk from '@aws-cdk/core';
import { throws } from 'assert';
import * as batch from '../lib';

describe('Batch Compute Evironment', () => {
Expand Down Expand Up @@ -240,10 +240,10 @@ describe('Batch Compute Evironment', () => {
],
Subnets: [
{
Ref: `${vpc.node.uniqueId}PrivateSubnet1Subnet865FB50A`,
Ref: `${cdk.Names.uniqueId(vpc)}PrivateSubnet1Subnet865FB50A`,
},
{
Ref: `${vpc.node.uniqueId}PrivateSubnet2Subnet23D3396F`,
Ref: `${cdk.Names.uniqueId(vpc)}PrivateSubnet2Subnet23D3396F`,
},
],
Tags: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as path from 'path';
import { expect, haveResource, matchTemplate, SynthUtils } from '@aws-cdk/assert';
import * as s3_assets from '@aws-cdk/aws-s3-assets';
import * as sns from '@aws-cdk/aws-sns';
import { App, CfnParameter, CfnResource, Construct, ContextProvider, Stack } from '@aws-cdk/core';
import { App, CfnParameter, CfnResource, Construct, ContextProvider, Names, Stack } from '@aws-cdk/core';
import { Test } from 'nodeunit';
import { NestedStack } from '../lib/nested-stack';

Expand Down Expand Up @@ -63,7 +63,7 @@ export = {
const assembly = app.synth();

// THEN
const template = JSON.parse(fs.readFileSync(path.join(assembly.directory, `${nested.node.uniqueId}.nested.template.json`), 'utf-8'));
const template = JSON.parse(fs.readFileSync(path.join(assembly.directory, `${Names.uniqueId(nested)}.nested.template.json`), 'utf-8'));
test.deepEqual(template, {
Resources: {
ResourceInNestedStack: {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-cloudfront-origins/lib/s3-origin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class S3BucketOrigin extends cloudfront.OriginBase {
const bucketStack = cdk.Stack.of(this.bucket);
const bucketInDifferentStack = bucketStack !== cdk.Stack.of(scope);
const oaiScope = bucketInDifferentStack ? bucketStack : scope;
const oaiId = bucketInDifferentStack ? `${scope.node.uniqueId}S3Origin` : 'S3Origin';
const oaiId = bucketInDifferentStack ? `${cdk.Names.uniqueId(scope)}S3Origin` : 'S3Origin';

this.originAccessIdentity = new cloudfront.OriginAccessIdentity(oaiScope, oaiId, {
comment: `Identity for ${options.originId}`,
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-cloudfront/lib/cache-policy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Duration, Resource, Token } from '@aws-cdk/core';
import { Duration, Names, Resource, Token } from '@aws-cdk/core';
import { Construct } from 'constructs';
import { CfnCachePolicy } from './cloudfront.generated';

Expand Down Expand Up @@ -128,7 +128,7 @@ export class CachePolicy extends Resource implements ICachePolicy {
physicalName: props.cachePolicyName,
});

const cachePolicyName = props.cachePolicyName ?? this.node.uniqueId;
const cachePolicyName = props.cachePolicyName ?? Names.uniqueId(this);
if (!Token.isUnresolved(cachePolicyName) && !cachePolicyName.match(/^[\w-]+$/i)) {
throw new Error(`'cachePolicyName' can only include '-', '_', and alphanumeric characters, got: '${props.cachePolicyName}'`);
}
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-cloudfront/lib/distribution.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as acm from '@aws-cdk/aws-certificatemanager';
import * as lambda from '@aws-cdk/aws-lambda';
import * as s3 from '@aws-cdk/aws-s3';
import { IResource, Lazy, Resource, Stack, Token, Duration } from '@aws-cdk/core';
import { IResource, Lazy, Resource, Stack, Token, Duration, Names } from '@aws-cdk/core';
import { Construct, Node } from 'constructs';
import { ICachePolicy } from './cache-policy';
import { CfnDistribution } from './cloudfront.generated';
Expand Down Expand Up @@ -322,7 +322,7 @@ export class Distribution extends Resource implements IDistribution {
} else {
const originIndex = this.boundOrigins.length + 1;
const scope = new CoreConstruct(this, `Origin${originIndex}`);
const originId = Node.of(scope).uniqueId;
const originId = Names.uniqueId(scope);
const originBindConfig = origin.bind(scope, { originId });
if (!originBindConfig.failoverConfig) {
this.boundOrigins.push({ origin, originId, ...originBindConfig });
Expand All @@ -331,7 +331,7 @@ export class Distribution extends Resource implements IDistribution {
throw new Error('An Origin cannot use an Origin with its own failover configuration as its fallback origin!');
}
const groupIndex = this.originGroups.length + 1;
const originGroupId = Node.of(new CoreConstruct(this, `OriginGroup${groupIndex}`)).uniqueId;
const originGroupId = Names.uniqueId(new CoreConstruct(this, `OriginGroup${groupIndex}`));
this.boundOrigins.push({ origin, originId, originGroupId, ...originBindConfig });

const failoverOriginId = this.addOrigin(originBindConfig.failoverConfig.failoverOrigin, true);
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-cloudfront/lib/origin-request-policy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Resource, Token } from '@aws-cdk/core';
import { Names, Resource, Token } from '@aws-cdk/core';
import { Construct } from 'constructs';
import { CfnOriginRequestPolicy } from './cloudfront.generated';

Expand Down Expand Up @@ -91,7 +91,7 @@ export class OriginRequestPolicy extends Resource implements IOriginRequestPolic
physicalName: props.originRequestPolicyName,
});

const originRequestPolicyName = props.originRequestPolicyName ?? this.node.uniqueId;
const originRequestPolicyName = props.originRequestPolicyName ?? Names.uniqueId(this);
if (!Token.isUnresolved(originRequestPolicyName) && !originRequestPolicyName.match(/^[\w-]+$/i)) {
throw new Error(`'originRequestPolicyName' can only include '-', '_', and alphanumeric characters, got: '${props.originRequestPolicyName}'`);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-cloudwatch/lib/composite-alarm.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Lazy, Stack } from '@aws-cdk/core';
import { Lazy, Names, Stack } from '@aws-cdk/core';
import { Construct } from 'constructs';
import { AlarmBase, IAlarm, IAlarmRule } from './alarm-base';
import { CfnCompositeAlarm } from './cloudwatch.generated';
Expand Down Expand Up @@ -120,7 +120,7 @@ export class CompositeAlarm extends AlarmBase {
}

private generateUniqueId(): string {
const name = this.node.uniqueId;
const name = Names.uniqueId(this);
if (name.length > 240) {
return name.substring(0, 120) + name.substring(name.length - 120);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-codebuild/lib/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as iam from '@aws-cdk/aws-iam';
import * as kms from '@aws-cdk/aws-kms';
import * as s3 from '@aws-cdk/aws-s3';
import * as secretsmanager from '@aws-cdk/aws-secretsmanager';
import { Aws, Duration, IResource, Lazy, PhysicalName, Resource, Stack } from '@aws-cdk/core';
import { Aws, Duration, IResource, Lazy, Names, PhysicalName, Resource, Stack } from '@aws-cdk/core';
import { Construct } from 'constructs';
import { IArtifacts } from './artifacts';
import { BuildSpec } from './build-spec';
Expand Down Expand Up @@ -1019,7 +1019,7 @@ export class Project extends ProjectBase {
} else {
const securityGroup = new ec2.SecurityGroup(this, 'SecurityGroup', {
vpc: props.vpc,
description: 'Automatic generated security group for CodeBuild ' + this.node.uniqueId,
description: 'Automatic generated security group for CodeBuild ' + Names.uniqueId(this),
allowAllOutbound: props.allowAllOutbound,
});
securityGroups = [securityGroup];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Duration, Resource } from '@aws-cdk/core';
import { Duration, Names, Resource } from '@aws-cdk/core';
import { AwsCustomResource, AwsCustomResourcePolicy, PhysicalResourceId } from '@aws-cdk/custom-resources';
import { Construct } from 'constructs';
import { arnForDeploymentConfig } from '../utils';
Expand Down Expand Up @@ -101,7 +101,7 @@ export class CustomLambdaDeploymentConfig extends Resource implements ILambdaDep
// Unless the user provides an explicit name
this.deploymentConfigName = props.deploymentConfigName !== undefined
? props.deploymentConfigName
: `${this.node.uniqueId}.Lambda${props.type}${props.percentage}Percent${props.type === CustomLambdaDeploymentConfigType.LINEAR
: `${Names.uniqueId(this)}.Lambda${props.type}${props.percentage}Percent${props.type === CustomLambdaDeploymentConfigType.LINEAR
? 'Every'
: ''}${props.interval.toMinutes()}Minutes`;
this.deploymentConfigArn = arnForDeploymentConfig(this.deploymentConfigName);
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-codeguruprofiler/lib/profiling-group.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Grant, IGrantable } from '@aws-cdk/aws-iam';
import { IResource, Lazy, Resource, Stack } from '@aws-cdk/core';
import { IResource, Lazy, Names, Resource, Stack } from '@aws-cdk/core';
import { Construct } from 'constructs';
import { CfnProfilingGroup } from './codeguruprofiler.generated';

Expand Down Expand Up @@ -195,7 +195,7 @@ export class ProfilingGroup extends ProfilingGroupBase {
}

private generateUniqueId(): string {
const name = this.node.uniqueId;
const name = Names.uniqueId(this);
if (name.length > 240) {
return name.substring(0, 120) + name.substring(name.length - 120);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ abstract class CloudFormationDeployAction extends CloudFormationAction {
// pass role is not allowed for cross-account access - so,
// create the deployment Role in the other account!
this._deploymentRole = new iam.Role(roleStack,
`${stage.pipeline.node.uniqueId}-${stage.stageName}-${this.actionProperties.actionName}-DeploymentRole`, {
`${cdk.Names.uniqueId(stage.pipeline)}-${stage.stageName}-${this.actionProperties.actionName}-DeploymentRole`, {
assumedBy: new iam.ServicePrincipal('cloudformation.amazonaws.com'),
roleName: cdk.PhysicalName.GENERATE_IF_NEEDED,
});
Expand Down
Loading