Skip to content

Commit

Permalink
chore: unexpire some feature flags (#14190)
Browse files Browse the repository at this point in the history
Some feature flags should not be expired in CDKv2. "expired" implies
that the flags will be enabled and users will be unable to disable it.

The following feature flags must not be unexpired, since it makes it
virtually impossible, in some cases, to deploy the CDK application
after upgrading to CDKv2. Deployments may cause service interruption or
may require stack re-creation.

- @aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId
- @aws-cdk/aws-rds:lowercaseDbIdentifier
- @aws-cdk/core:stackRelativeExports

These flags will still be enabled by default, but in cases where
deployment is difficult or impossible, users are now able to disable
these feature flags.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
Niranjan Jayakar authored Apr 16, 2021
1 parent 8e88a6a commit 81148f0
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export = {
},

'GlobalTable generated stacks inherit their account from the parent stack'(test: Test) {
const app = new App();
const app = new App({ context: { '@aws-cdk/core:stackRelativeExports': true } });
const stack = new Stack(app, 'GlobalTableStack', { env: { account: '123456789012', region: 'us-east-1' } });

const globalTable = new GlobalTable(stack, CONSTRUCT_NAME, {
Expand All @@ -81,7 +81,7 @@ export = {
'Outputs': {
'DynamoDbOutput': {
'Value': {
'Fn::ImportValue': 'GlobalTableStackawscdkdynamodbglobalawscdkdynamodbglobaluseast19C1C8A14:awscdkdynamodbglobalawscdkdynamodbglobaluseast1ExportsOutputFnGetAttawscdkdynamodbglobalGlobalTableuseast1FC03DD69StreamArn28E90DB8',
'Fn::ImportValue': 'GlobalTableStackawscdkdynamodbglobalawscdkdynamodbglobaluseast19C1C8A14:ExportsOutputFnGetAttawscdkdynamodbglobalGlobalTableuseast1FC03DD69StreamArn9CE585ED',
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-rds/test/cluster.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1885,7 +1885,7 @@ describe('cluster', () => {

test('does not changes the case of the cluster identifier if the lowercaseDbIdentifier feature flag is disabled', () => {
// GIVEN
const app = new cdk.App();
const app = new cdk.App({ context: { '@aws-cdk/aws-rds:lowercaseDbIdentifier': false } });
const stack = testStack(app);
const vpc = new ec2.Vpc(stack, 'VPC');

Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-rds/test/instance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1306,7 +1306,8 @@ describe('instance', () => {

test( 'does not changes the case of the cluster identifier if the lowercaseDbIdentifier feature flag is disabled', () => {
// GIVEN
stack = new cdk.Stack();
const app = new cdk.App({ context: { '@aws-cdk/aws-rds:lowercaseDbIdentifier': false } });
stack = new cdk.Stack(app);
vpc = new ec2.Vpc( stack, 'VPC' );

// WHEN
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-rds/test/serverless-cluster.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ nodeunitShim({

'does not change the case of the cluster identifier if the lowercaseDbIdentifier feature flag is disabled'(test: Test) {
// GIVEN
const app = new cdk.App();
const app = new cdk.App({ context: { '@aws-cdk/aws-rds:lowercaseDbIdentifier': false } });
const stack = testStack(app);
const clusterIdentifier = 'TestClusterIdentifier';
const vpc = ec2.Vpc.fromLookup(stack, 'VPC', { isDefault: true });
Expand Down
14 changes: 7 additions & 7 deletions packages/@aws-cdk/core/test/stack.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as cxapi from '@aws-cdk/cx-api';
import { Construct } from 'constructs';
import { testFutureBehavior, testLegacyBehavior } from 'cdk-build-tools/lib/feature-flag';
import { Construct } from 'constructs';
import {
App, CfnCondition, CfnInclude, CfnOutput, CfnParameter,
CfnResource, Lazy, ScopedAws, Stack, validateString,
Expand Down Expand Up @@ -490,7 +490,7 @@ describe('stack', () => {

test('cross stack references and dependencies work within child stacks (non-nested)', () => {
// GIVEN
const app = new App();
const app = new App({ context: { '@aws-cdk/core:stackRelativeExports': true } });
const parent = new Stack(app, 'Parent');
const child1 = new Stack(parent, 'Child1');
const child2 = new Stack(parent, 'Child2');
Expand Down Expand Up @@ -521,7 +521,7 @@ describe('stack', () => {
Outputs: {
ExportsOutputRefResourceA461B4EF9: {
Value: { Ref: 'ResourceA' },
Export: { Name: 'ParentChild18FAEF419:Child1ExportsOutputRefResourceA7BF20B37' },
Export: { Name: 'ParentChild18FAEF419:ExportsOutputRefResourceA461B4EF9' },
},
},
});
Expand All @@ -530,7 +530,7 @@ describe('stack', () => {
Resource1: {
Type: 'R2',
Properties: {
RefToResource1: { 'Fn::ImportValue': 'ParentChild18FAEF419:Child1ExportsOutputRefResourceA7BF20B37' },
RefToResource1: { 'Fn::ImportValue': 'ParentChild18FAEF419:ExportsOutputRefResourceA461B4EF9' },
},
},
},
Expand All @@ -542,7 +542,7 @@ describe('stack', () => {

test('automatic cross-stack references and manual exports look the same', () => {
// GIVEN: automatic
const appA = new App();
const appA = new App({ context: { '@aws-cdk/core:stackRelativeExports': true } });
const producerA = new Stack(appA, 'Producer');
const consumerA = new Stack(appA, 'Consumer');
const resourceA = new CfnResource(producerA, 'Resource', { type: 'AWS::Resource' });
Expand Down Expand Up @@ -725,7 +725,7 @@ describe('stack', () => {
MyParentResource: {
Type: 'Resource::Parent',
Properties: {
ParentProp: { 'Fn::ImportValue': 'parentchild13F9359B:childExportsOutputFnGetAttMyChildResourceAttributeOfChildResource420052FC' },
ParentProp: { 'Fn::ImportValue': 'parentchild13F9359B:ExportsOutputFnGetAttMyChildResourceAttributeOfChildResource52813264' },
},
},
},
Expand All @@ -736,7 +736,7 @@ describe('stack', () => {
Outputs: {
ExportsOutputFnGetAttMyChildResourceAttributeOfChildResource52813264: {
Value: { 'Fn::GetAtt': ['MyChildResource', 'AttributeOfChildResource'] },
Export: { Name: 'parentchild13F9359B:childExportsOutputFnGetAttMyChildResourceAttributeOfChildResource420052FC' },
Export: { Name: 'parentchild13F9359B:ExportsOutputFnGetAttMyChildResourceAttributeOfChildResource52813264' },
},
},
});
Expand Down
7 changes: 3 additions & 4 deletions packages/@aws-cdk/cx-api/lib/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ export const FUTURE_FLAGS: { [key: string]: any } = {
* and block usages of old feature flags in the new major version of CDK.
*/
export const FUTURE_FLAGS_EXPIRED: string[] = [
APIGATEWAY_USAGEPLANKEY_ORDERINSENSITIVE_ID,
DOCKER_IGNORE_SUPPORT,
ENABLE_DIFF_NO_FAIL_CONTEXT,
ENABLE_STACK_NAME_DUPLICATES_CONTEXT,
Expand All @@ -190,17 +189,17 @@ export const FUTURE_FLAGS_EXPIRED: string[] = [
* explicitly configured.
*/
const FUTURE_FLAGS_DEFAULTS: { [key: string]: boolean } = {
[APIGATEWAY_USAGEPLANKEY_ORDERINSENSITIVE_ID]: false,
[APIGATEWAY_USAGEPLANKEY_ORDERINSENSITIVE_ID]: true,
[ENABLE_STACK_NAME_DUPLICATES_CONTEXT]: false,
[ENABLE_DIFF_NO_FAIL_CONTEXT]: false,
[STACK_RELATIVE_EXPORTS_CONTEXT]: false,
[STACK_RELATIVE_EXPORTS_CONTEXT]: true,
[NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false,
[DOCKER_IGNORE_SUPPORT]: false,
[SECRETS_MANAGER_PARSE_OWNED_SECRET_NAME]: false,
[KMS_DEFAULT_KEY_POLICIES]: false,
[S3_GRANT_WRITE_WITHOUT_ACL]: false,
[ECS_REMOVE_DEFAULT_DESIRED_COUNT]: false,
[RDS_LOWERCASE_DB_IDENTIFIER]: false,
[RDS_LOWERCASE_DB_IDENTIFIER]: true,
[EFS_DEFAULT_ENCRYPTION_AT_REST]: false,
};

Expand Down

0 comments on commit 81148f0

Please sign in to comment.