diff --git a/packages/@aws-cdk/aws-amplify-alpha/README.md b/packages/@aws-cdk/aws-amplify-alpha/README.md index d543b4090faff..eaeed3c8b9c33 100644 --- a/packages/@aws-cdk/aws-amplify-alpha/README.md +++ b/packages/@aws-cdk/aws-amplify-alpha/README.md @@ -246,6 +246,20 @@ const amplifyApp = new amplify.App(this, 'MyApp', { }); ``` +## Cache Config + +Amplify uses Amazon CloudFront to manage the caching configuration for your hosted applications. A cache configuration is applied to each app to optimize for the best performance. + +Setting the `cacheConfigType` field on the Amplify `App` construct can be used to control cache configguration. By default, the value is set to `AMPLIFY_MANAGED`. If you want to exclude all cookies from the cache key, set `AMPLIFY_MANAGED_NO_COOKIES`. + +For more information, see [Managing the cache configuration for an app](https://docs.aws.amazon.com/amplify/latest/userguide/caching.html). + +```ts +const amplifyApp = new amplify.App(this, 'MyApp', { + cacheConfigType: amplify.CacheConfigType.AMPLIFY_MANAGED_NO_COOKIES, +}); +``` + ## Deploying Assets `sourceCodeProvider` is optional; when this is not specified the Amplify app can be deployed to using `.zip` packages. The `asset` property can be used to deploy S3 assets to Amplify as part of the CDK: diff --git a/packages/@aws-cdk/aws-amplify-alpha/lib/app.ts b/packages/@aws-cdk/aws-amplify-alpha/lib/app.ts index db9dfae461c80..803ce4ae8f9a2 100644 --- a/packages/@aws-cdk/aws-amplify-alpha/lib/app.ts +++ b/packages/@aws-cdk/aws-amplify-alpha/lib/app.ts @@ -167,6 +167,13 @@ export interface AppProps { * @default Platform.WEB */ readonly platform?: Platform; + + /** + * The type of cache configuration to use for an Amplify app. + * + * @default CacheConfigType.AMPLIFY_MANAGED + */ + readonly cacheConfigType?: CacheConfigType; } /** @@ -239,7 +246,7 @@ export class App extends Resource implements IApp, iam.IGrantable { buildSpec: props.autoBranchCreation.buildSpec && props.autoBranchCreation.buildSpec.toBuildSpec(), enableAutoBranchCreation: true, enableAutoBuild: props.autoBranchCreation.autoBuild ?? true, - environmentVariables: Lazy.any({ produce: () => renderEnvironmentVariables(this.autoBranchEnvironmentVariables ) }, { omitEmptyArray: true }), // eslint-disable-line max-len + environmentVariables: Lazy.any({ produce: () => renderEnvironmentVariables(this.autoBranchEnvironmentVariables) }, { omitEmptyArray: true }), // eslint-disable-line max-len enablePullRequestPreview: props.autoBranchCreation.pullRequestPreview ?? true, pullRequestEnvironmentName: props.autoBranchCreation.pullRequestEnvironmentName, stage: props.autoBranchCreation.stage, @@ -249,6 +256,7 @@ export class App extends Resource implements IApp, iam.IGrantable { ? props.basicAuth.bind(this, 'AppBasicAuth') : { enableBasicAuth: false }, buildSpec: props.buildSpec && props.buildSpec.toBuildSpec(), + cacheConfig: props.cacheConfigType ? { type: props.cacheConfigType } : undefined, customRules: Lazy.any({ produce: () => this.customRules }, { omitEmptyArray: true }), description: props.description, environmentVariables: Lazy.any({ produce: () => renderEnvironmentVariables(this.environmentVariables) }, { omitEmptyArray: true }), @@ -554,3 +562,20 @@ export enum Platform { */ WEB_COMPUTE = 'WEB_COMPUTE', } + +/** + * The type of cache configuration to use for an Amplify app. + */ +export enum CacheConfigType { + /** + * AMPLIFY_MANAGED - Automatically applies an optimized cache configuration + * for your app based on its platform, routing rules, and rewrite rules. + */ + AMPLIFY_MANAGED = 'AMPLIFY_MANAGED', + + /** + * AMPLIFY_MANAGED_NO_COOKIES - The same as AMPLIFY_MANAGED, + * except that it excludes all cookies from the cache key. + */ + AMPLIFY_MANAGED_NO_COOKIES = 'AMPLIFY_MANAGED_NO_COOKIES', +} diff --git a/packages/@aws-cdk/aws-amplify-alpha/test/app.test.ts b/packages/@aws-cdk/aws-amplify-alpha/test/app.test.ts index b5c800bf387d6..1e097547c8215 100644 --- a/packages/@aws-cdk/aws-amplify-alpha/test/app.test.ts +++ b/packages/@aws-cdk/aws-amplify-alpha/test/app.test.ts @@ -464,3 +464,17 @@ test('create a dynamically rendered app when the platform is set to WEB_COMPUTE' Platform: amplify.Platform.WEB_COMPUTE, }); }); + +test.each([amplify.CacheConfigType.AMPLIFY_MANAGED, amplify.CacheConfigType.AMPLIFY_MANAGED_NO_COOKIES])('create a app with cacheConfigType is set to %s', (cacheConfigType) => { + // WHEN + new amplify.App(stack, 'App', { + cacheConfigType, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Amplify::App', { + CacheConfig: { + Type: cacheConfigType, + }, + }); +}); diff --git a/packages/@aws-cdk/aws-amplify-alpha/test/integ.app-cache-config.js.snapshot/amplifyappcachecofigintegDefaultTestDeployAssert14075C62.assets.json b/packages/@aws-cdk/aws-amplify-alpha/test/integ.app-cache-config.js.snapshot/amplifyappcachecofigintegDefaultTestDeployAssert14075C62.assets.json new file mode 100644 index 0000000000000..08cc0d277255b --- /dev/null +++ b/packages/@aws-cdk/aws-amplify-alpha/test/integ.app-cache-config.js.snapshot/amplifyappcachecofigintegDefaultTestDeployAssert14075C62.assets.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.5", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "amplifyappcachecofigintegDefaultTestDeployAssert14075C62.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-amplify-alpha/test/integ.app-cache-config.js.snapshot/amplifyappcachecofigintegDefaultTestDeployAssert14075C62.template.json b/packages/@aws-cdk/aws-amplify-alpha/test/integ.app-cache-config.js.snapshot/amplifyappcachecofigintegDefaultTestDeployAssert14075C62.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk/aws-amplify-alpha/test/integ.app-cache-config.js.snapshot/amplifyappcachecofigintegDefaultTestDeployAssert14075C62.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-amplify-alpha/test/integ.app-cache-config.js.snapshot/cdk-amplify-app-cache-config.assets.json b/packages/@aws-cdk/aws-amplify-alpha/test/integ.app-cache-config.js.snapshot/cdk-amplify-app-cache-config.assets.json new file mode 100644 index 0000000000000..fed9ce3ee5b8a --- /dev/null +++ b/packages/@aws-cdk/aws-amplify-alpha/test/integ.app-cache-config.js.snapshot/cdk-amplify-app-cache-config.assets.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.5", + "files": { + "3239e363f9e8e5a4ef7c700724f38f69548a563607e006187dc64b4027f36839": { + "source": { + "path": "cdk-amplify-app-cache-config.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "3239e363f9e8e5a4ef7c700724f38f69548a563607e006187dc64b4027f36839.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-amplify-alpha/test/integ.app-cache-config.js.snapshot/cdk-amplify-app-cache-config.template.json b/packages/@aws-cdk/aws-amplify-alpha/test/integ.app-cache-config.js.snapshot/cdk-amplify-app-cache-config.template.json new file mode 100644 index 0000000000000..bc7e9cd8edbda --- /dev/null +++ b/packages/@aws-cdk/aws-amplify-alpha/test/integ.app-cache-config.js.snapshot/cdk-amplify-app-cache-config.template.json @@ -0,0 +1,88 @@ +{ + "Resources": { + "AppRole1AF9B530": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "amplify.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "AppF1B96344": { + "Type": "AWS::Amplify::App", + "Properties": { + "BasicAuthConfig": { + "EnableBasicAuth": false + }, + "CacheConfig": { + "Type": "AMPLIFY_MANAGED_NO_COOKIES" + }, + "IAMServiceRole": { + "Fn::GetAtt": [ + "AppRole1AF9B530", + "Arn" + ] + }, + "Name": "App", + "Platform": "WEB" + } + }, + "AppmainF505BAED": { + "Type": "AWS::Amplify::Branch", + "Properties": { + "AppId": { + "Fn::GetAtt": [ + "AppF1B96344", + "AppId" + ] + }, + "BranchName": "main", + "EnableAutoBuild": true, + "EnablePullRequestPreview": true + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-amplify-alpha/test/integ.app-cache-config.js.snapshot/cdk.out b/packages/@aws-cdk/aws-amplify-alpha/test/integ.app-cache-config.js.snapshot/cdk.out new file mode 100644 index 0000000000000..bd5311dc372de --- /dev/null +++ b/packages/@aws-cdk/aws-amplify-alpha/test/integ.app-cache-config.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"36.0.5"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-amplify-alpha/test/integ.app-cache-config.js.snapshot/integ.json b/packages/@aws-cdk/aws-amplify-alpha/test/integ.app-cache-config.js.snapshot/integ.json new file mode 100644 index 0000000000000..1ebbff2484eae --- /dev/null +++ b/packages/@aws-cdk/aws-amplify-alpha/test/integ.app-cache-config.js.snapshot/integ.json @@ -0,0 +1,14 @@ +{ + "enableLookups": true, + "version": "36.0.5", + "testCases": { + "amplify-app-cache-cofig-integ/DefaultTest": { + "stacks": [ + "cdk-amplify-app-cache-config" + ], + "stackUpdateWorkflow": false, + "assertionStack": "amplify-app-cache-cofig-integ/DefaultTest/DeployAssert", + "assertionStackName": "amplifyappcachecofigintegDefaultTestDeployAssert14075C62" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-amplify-alpha/test/integ.app-cache-config.js.snapshot/manifest.json b/packages/@aws-cdk/aws-amplify-alpha/test/integ.app-cache-config.js.snapshot/manifest.json new file mode 100644 index 0000000000000..d82bda55c99dc --- /dev/null +++ b/packages/@aws-cdk/aws-amplify-alpha/test/integ.app-cache-config.js.snapshot/manifest.json @@ -0,0 +1,125 @@ +{ + "version": "36.0.5", + "artifacts": { + "cdk-amplify-app-cache-config.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "cdk-amplify-app-cache-config.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "cdk-amplify-app-cache-config": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "cdk-amplify-app-cache-config.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/3239e363f9e8e5a4ef7c700724f38f69548a563607e006187dc64b4027f36839.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "cdk-amplify-app-cache-config.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "cdk-amplify-app-cache-config.assets" + ], + "metadata": { + "/cdk-amplify-app-cache-config/App/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "AppRole1AF9B530" + } + ], + "/cdk-amplify-app-cache-config/App/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "AppF1B96344" + } + ], + "/cdk-amplify-app-cache-config/App/main/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "AppmainF505BAED" + } + ], + "/cdk-amplify-app-cache-config/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/cdk-amplify-app-cache-config/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "cdk-amplify-app-cache-config" + }, + "amplifyappcachecofigintegDefaultTestDeployAssert14075C62.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "amplifyappcachecofigintegDefaultTestDeployAssert14075C62.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "amplifyappcachecofigintegDefaultTestDeployAssert14075C62": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "amplifyappcachecofigintegDefaultTestDeployAssert14075C62.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "amplifyappcachecofigintegDefaultTestDeployAssert14075C62.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "amplifyappcachecofigintegDefaultTestDeployAssert14075C62.assets" + ], + "metadata": { + "/amplify-app-cache-cofig-integ/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/amplify-app-cache-cofig-integ/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "amplify-app-cache-cofig-integ/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-amplify-alpha/test/integ.app-cache-config.js.snapshot/tree.json b/packages/@aws-cdk/aws-amplify-alpha/test/integ.app-cache-config.js.snapshot/tree.json new file mode 100644 index 0000000000000..f390075480891 --- /dev/null +++ b/packages/@aws-cdk/aws-amplify-alpha/test/integ.app-cache-config.js.snapshot/tree.json @@ -0,0 +1,213 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "cdk-amplify-app-cache-config": { + "id": "cdk-amplify-app-cache-config", + "path": "cdk-amplify-app-cache-config", + "children": { + "App": { + "id": "App", + "path": "cdk-amplify-app-cache-config/App", + "children": { + "Role": { + "id": "Role", + "path": "cdk-amplify-app-cache-config/App/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "cdk-amplify-app-cache-config/App/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "cdk-amplify-app-cache-config/App/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "amplify.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "cdk-amplify-app-cache-config/App/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Amplify::App", + "aws:cdk:cloudformation:props": { + "basicAuthConfig": { + "enableBasicAuth": false + }, + "cacheConfig": { + "type": "AMPLIFY_MANAGED_NO_COOKIES" + }, + "iamServiceRole": { + "Fn::GetAtt": [ + "AppRole1AF9B530", + "Arn" + ] + }, + "name": "App", + "platform": "WEB" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_amplify.CfnApp", + "version": "0.0.0" + } + }, + "main": { + "id": "main", + "path": "cdk-amplify-app-cache-config/App/main", + "children": { + "Resource": { + "id": "Resource", + "path": "cdk-amplify-app-cache-config/App/main/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Amplify::Branch", + "aws:cdk:cloudformation:props": { + "appId": { + "Fn::GetAtt": [ + "AppF1B96344", + "AppId" + ] + }, + "branchName": "main", + "enableAutoBuild": true, + "enablePullRequestPreview": true + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_amplify.CfnBranch", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "cdk-amplify-app-cache-config/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "cdk-amplify-app-cache-config/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "amplify-app-cache-cofig-integ": { + "id": "amplify-app-cache-cofig-integ", + "path": "amplify-app-cache-cofig-integ", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "amplify-app-cache-cofig-integ/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "amplify-app-cache-cofig-integ/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "amplify-app-cache-cofig-integ/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "amplify-app-cache-cofig-integ/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "amplify-app-cache-cofig-integ/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-amplify-alpha/test/integ.app-cache-config.ts b/packages/@aws-cdk/aws-amplify-alpha/test/integ.app-cache-config.ts new file mode 100644 index 0000000000000..78c5b9544ed4a --- /dev/null +++ b/packages/@aws-cdk/aws-amplify-alpha/test/integ.app-cache-config.ts @@ -0,0 +1,25 @@ +import { App, Stack, StackProps } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as amplify from '../lib'; + +class TestStack extends Stack { + constructor(scope: Construct, id: string, props?: StackProps) { + super(scope, id, props); + + const amplifyApp = new amplify.App(this, 'App', { + cacheConfigType: amplify.CacheConfigType.AMPLIFY_MANAGED_NO_COOKIES, + }); + + amplifyApp.addBranch('main'); + } +} + +const app = new App(); +const stack = new TestStack(app, 'cdk-amplify-app-cache-config'); + +new IntegTest(app, 'amplify-app-cache-cofig-integ', { + testCases: [stack], + enableLookups: true, + stackUpdateWorkflow: false, +});