Skip to content

Commit 3c33f4e

Browse files
committed
Rip out non-AMI/SSM additionalCacheKey
1 parent bd90d09 commit 3c33f4e

File tree

16 files changed

+13
-205
lines changed

16 files changed

+13
-205
lines changed

packages/aws-cdk-lib/aws-ec2/README.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -634,13 +634,6 @@ called `cdk.context.json`. You must commit this file to source control so
634634
that the lookup values are available in non-privileged environments such
635635
as CI build steps, and to ensure your template builds are repeatable.
636636

637-
To customize the cache key, use the `additionalCacheKey` parameter.
638-
This allows you to have multiple lookups with the same parameters
639-
cache their values separately. This can be useful if you want to
640-
scope the context variable to a construct (ie, using `additionalCacheKey: this.node.path`),
641-
so that if the value in the cache needs to be updated, it does not need to be updated
642-
for all constructs at the same time.
643-
644637
Here's how `Vpc.fromLookup()` can be used:
645638

646639
[importing existing VPCs](test/integ.import-default-vpc.lit.ts)
@@ -894,13 +887,6 @@ written to a file called `cdk.context.json`.
894887
You must commit this file to source control so that the lookup values are available in non-privileged
895888
environments such as CI build steps, and to ensure your template builds are repeatable.
896889

897-
To customize the cache key, use the `additionalCacheKey` property of the `options` parameter.
898-
This allows you to have multiple lookups with the same parameters
899-
cache their values separately. This can be useful if you want to
900-
scope the context variable to a construct (ie, using `additionalCacheKey: this.node.path`),
901-
so that if the value in the cache needs to be updated, it does not need to be updated
902-
for all constructs at the same time.
903-
904890
### Cross Stack Connections
905891

906892
If you are attempting to add a connection from a peer in one stack to a peer in a different stack, sometimes it is necessary to ensure that you are making the connection in

packages/aws-cdk-lib/aws-ec2/lib/security-group.ts

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -376,22 +376,22 @@ export class SecurityGroup extends SecurityGroupBase {
376376
*
377377
* @deprecated Use `fromLookupById()` instead
378378
*/
379-
public static fromLookup(scope: Construct, id: string, securityGroupId: string, options?: BaseSecurityGroupLookupOptions) {
380-
return this.fromLookupAttributes(scope, id, { securityGroupId, ...options });
379+
public static fromLookup(scope: Construct, id: string, securityGroupId: string) {
380+
return this.fromLookupAttributes(scope, id, { securityGroupId });
381381
}
382382

383383
/**
384384
* Look up a security group by id.
385385
*/
386-
public static fromLookupById(scope: Construct, id: string, securityGroupId: string, options?: BaseSecurityGroupLookupOptions) {
387-
return this.fromLookupAttributes(scope, id, { securityGroupId, ...options });
386+
public static fromLookupById(scope: Construct, id: string, securityGroupId: string) {
387+
return this.fromLookupAttributes(scope, id, { securityGroupId });
388388
}
389389

390390
/**
391391
* Look up a security group by name.
392392
*/
393-
public static fromLookupByName(scope: Construct, id: string, securityGroupName: string, vpc: IVpc, options?: BaseSecurityGroupLookupOptions) {
394-
return this.fromLookupAttributes(scope, id, { securityGroupName, vpc, ...options });
393+
public static fromLookupByName(scope: Construct, id: string, securityGroupName: string, vpc: IVpc) {
394+
return this.fromLookupAttributes(scope, id, { securityGroupName, vpc });
395395
}
396396

397397
/**
@@ -456,7 +456,6 @@ export class SecurityGroup extends SecurityGroupBase {
456456
securityGroupId: 'sg-12345678',
457457
allowAllOutbound: true,
458458
} as cxapi.SecurityGroupContextResponse,
459-
additionalCacheKey: options.additionalCacheKey,
460459
}).value;
461460

462461
return SecurityGroup.fromSecurityGroupId(scope, id, attributes.securityGroupId, {
@@ -823,24 +822,12 @@ function isAllTrafficRule(rule: any) {
823822
return (rule.cidrIp === '0.0.0.0/0' || rule.cidrIpv6 === '::/0') && rule.ipProtocol === '-1';
824823
}
825824

826-
/**
827-
* Base properties for looking up an existing SecurityGroup.
828-
*/
829-
export interface BaseSecurityGroupLookupOptions {
830-
/**
831-
* Adds an additional discriminator to the `cdk.context.json` cache key.
832-
*
833-
* @default - no additional cache key
834-
*/
835-
readonly additionalCacheKey?: string;
836-
}
837-
838825
/**
839826
* Properties for looking up an existing SecurityGroup.
840827
*
841828
* Either `securityGroupName` or `securityGroupId` has to be specified.
842829
*/
843-
interface SecurityGroupLookupOptions extends BaseSecurityGroupLookupOptions {
830+
interface SecurityGroupLookupOptions {
844831
/**
845832
* The name of the security group
846833
*
@@ -867,11 +854,4 @@ interface SecurityGroupLookupOptions extends BaseSecurityGroupLookupOptions {
867854
* @default Don't filter on VPC
868855
*/
869856
readonly vpc?: IVpc;
870-
871-
/**
872-
* Adds an additional discriminator to the `cdk.context.json` cache key.
873-
*
874-
* @default - no additional cache key
875-
*/
876-
readonly additionalCacheKey?: string;
877857
}

packages/aws-cdk-lib/aws-ec2/lib/vpc-lookup.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,4 @@ export interface VpcLookupOptions {
7575
* @default the account id of the parent stack
7676
*/
7777
readonly ownerAccountId?: string;
78-
79-
/**
80-
* Adds an additional discriminator to the `cdk.context.json` cache key.
81-
*
82-
* @default - no additional cache key
83-
*/
84-
readonly additionalCacheKey?: string;
8578
}

packages/aws-cdk-lib/aws-ec2/lib/vpc.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1366,7 +1366,6 @@ export class Vpc extends VpcBase {
13661366
subnetGroupNameTag: options.subnetGroupNameTag,
13671367
} as cxschema.VpcContextQuery,
13681368
dummyValue: undefined,
1369-
additionalCacheKey: options.additionalCacheKey,
13701369
}).value;
13711370

13721371
return new LookedUpVpc(scope, id, attributes ?? DUMMY_VPC_PROPS, attributes === undefined);

packages/aws-cdk-lib/aws-elasticloadbalancingv2/README.md

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -953,18 +953,6 @@ following lookup methods:
953953
* `NetworkListener.fromLookup(options)` - Look up a network load balancer
954954
listener.
955955

956-
The result of a `fromLookup()` operation will be written to a file
957-
called `cdk.context.json`. You must commit this file to source control so
958-
that the lookup values are available in non-privileged environments such
959-
as CI build steps, and to ensure your template builds are repeatable.
960-
961-
To customize the cache key, use the `additionalCacheKey` parameter.
962-
This allows you to have multiple lookups with the same parameters
963-
cache their values separately. This can be useful if you want to
964-
scope the context variable to a construct (ie, using `additionalCacheKey: this.node.path`),
965-
so that if the value in the cache needs to be updated, it does not need to be updated
966-
for all constructs at the same time.
967-
968956
### Load Balancer lookup options
969957

970958
You may look up a load balancer by ARN or by associated tags. When you look a
@@ -994,20 +982,7 @@ const loadBalancer = elbv2.ApplicationLoadBalancer.fromLookup(this, 'ALB', {
994982
});
995983
```
996984

997-
**Look up a Application Load Balancer by ARN, customizing the cache key**
998-
999-
```ts
1000-
const loadBalancer = elbv2.ApplicationLoadBalancer.fromLookup(this, 'ALB', {
1001-
loadBalancerArn: 'arn:aws:elasticloadbalancing:us-east-2:123456789012:loadbalancer/app/my-load-balancer/1234567890123456',
1002-
// creates a distinct context variable for this load balancer, instead of resolving to the same
1003-
// value anywhere this lookup is done in your app
1004-
additionalCacheKey: this.node.path,
1005-
});
1006-
```
1007-
1008-
**
1009-
1010-
### Load Balancer Listener lookup options
985+
## Load Balancer Listener lookup options
1011986

1012987
You may look up a load balancer listener by the following criteria:
1013988

@@ -1055,19 +1030,6 @@ const listener = elbv2.NetworkListener.fromLookup(this, 'ALBListener', {
10551030
});
10561031
```
10571032

1058-
**Look up a Listener by associated Load Balancer, Port, and Protocol**
1059-
1060-
```ts
1061-
const listener = elbv2.ApplicationListener.fromLookup(this, 'ALBListener', {
1062-
loadBalancerArn: 'arn:aws:elasticloadbalancing:us-east-2:123456789012:loadbalancer/app/my-load-balancer/1234567890123456',
1063-
listenerProtocol: elbv2.ApplicationProtocol.HTTPS,
1064-
listenerPort: 443,
1065-
// creates a distinct context variable for this application listener, instead of resolving to the same
1066-
// value anywhere this lookup is done in your app
1067-
additionalCacheKey: this.node.path,
1068-
});
1069-
```
1070-
10711033
## Metrics
10721034

10731035
You may create metrics for Load Balancers and Target Groups through the `metrics` attribute:

packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-listener.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,7 @@ export class ApplicationListener extends BaseListener implements IApplicationLis
211211
/**
212212
* Look up an ApplicationListener.
213213
*/
214-
public static fromLookup(
215-
scope: Construct,
216-
id: string,
217-
options: ApplicationListenerLookupOptions,
218-
): IApplicationListener {
214+
public static fromLookup(scope: Construct, id: string, options: ApplicationListenerLookupOptions): IApplicationListener {
219215
if (Token.isUnresolved(options.listenerArn)) {
220216
throw new ValidationError('All arguments to look up a load balancer listener must be concrete (no Tokens)', scope);
221217
}

packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,7 @@ export class ApplicationLoadBalancer extends BaseLoadBalancer implements IApplic
164164
/**
165165
* Look up an application load balancer.
166166
*/
167-
public static fromLookup(
168-
scope: Construct,
169-
id: string,
170-
options: ApplicationLoadBalancerLookupOptions,
171-
): IApplicationLoadBalancer {
167+
public static fromLookup(scope: Construct, id: string, options: ApplicationLoadBalancerLookupOptions): IApplicationLoadBalancer {
172168
const props = BaseLoadBalancer._queryContextProvider(scope, {
173169
userOptions: options,
174170
loadBalancerType: cxschema.LoadBalancerType.APPLICATION,

packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,7 @@ export class NetworkLoadBalancer extends BaseLoadBalancer implements INetworkLoa
217217
/**
218218
* Looks up the network load balancer.
219219
*/
220-
public static fromLookup(
221-
scope: Construct,
222-
id: string,
223-
options: NetworkLoadBalancerLookupOptions,
224-
): INetworkLoadBalancer {
220+
public static fromLookup(scope: Construct, id: string, options: NetworkLoadBalancerLookupOptions): INetworkLoadBalancer {
225221
const props = BaseLoadBalancer._queryContextProvider(scope, {
226222
userOptions: options,
227223
loadBalancerType: cxschema.LoadBalancerType.NETWORK,

packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/base-listener.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ export interface BaseListenerLookupOptions {
2828
* @default - does not filter by listener port
2929
*/
3030
readonly listenerPort?: number;
31-
32-
/**
33-
* Adds an additional discriminator to the `cdk.context.json` cache key.
34-
*
35-
* @default - no additional cache key
36-
*/
37-
readonly additionalCacheKey?: string;
3831
}
3932

4033
/**
@@ -112,7 +105,6 @@ export abstract class BaseListener extends Resource implements IListener {
112105
listenerPort: 80,
113106
securityGroupIds: ['sg-123456789012'],
114107
} as cxapi.LoadBalancerListenerContextResponse,
115-
additionalCacheKey: options.userOptions.additionalCacheKey,
116108
}).value;
117109

118110
return props;

packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,6 @@ export interface BaseLoadBalancerLookupOptions {
188188
* @default - does not match load balancers by tags
189189
*/
190190
readonly loadBalancerTags?: Record<string, string>;
191-
192-
/**
193-
* Adds an additional discriminator to the `cdk.context.json` cache key.
194-
*
195-
* @default - no additional cache key
196-
*/
197-
readonly additionalCacheKey?: string;
198191
}
199192

200193
/**
@@ -221,10 +214,7 @@ export abstract class BaseLoadBalancer extends Resource {
221214
* Queries the load balancer context provider for load balancer info.
222215
* @internal
223216
*/
224-
protected static _queryContextProvider(
225-
scope: Construct,
226-
options: LoadBalancerQueryContextProviderOptions,
227-
) {
217+
protected static _queryContextProvider(scope: Construct, options: LoadBalancerQueryContextProviderOptions) {
228218
if (Token.isUnresolved(options.userOptions.loadBalancerArn)
229219
|| Object.values(options.userOptions.loadBalancerTags ?? {}).some(Token.isUnresolved)) {
230220
throw new ValidationError('All arguments to look up a load balancer must be concrete (no Tokens)', scope);
@@ -251,7 +241,6 @@ export abstract class BaseLoadBalancer extends Resource {
251241
securityGroupIds: ['sg-1234'],
252242
vpcId: 'vpc-12345',
253243
} as cxapi.LoadBalancerContextResponse,
254-
additionalCacheKey: options.userOptions.additionalCacheKey,
255244
}).value;
256245

257246
return props;

0 commit comments

Comments
 (0)