Open desoss opened 3 years ago
For some reason, the code is explicitly just doing those two, so if that was just removed, then the default of the underlying BucketDeployment.distributionPaths is this:
All files under the destination bucket key prefix will be invalidated.
It seems like a simple fix is to add distributionPaths
to interface SPADeployConfig
, so createSiteWithCloudfront()
could optionally use that passed-in value instead of the hard-coded ['/', `/${config.indexDoc}`]
, like this:
diff --git a/lib/spa-deploy/spa-deploy-construct.ts b/lib/spa-deploy/spa-deploy-construct.ts
index d754f8d..f53e0f4 100644
--- a/lib/spa-deploy/spa-deploy-construct.ts
+++ b/lib/spa-deploy/spa-deploy-construct.ts
@@ -23,6 +23,7 @@ export interface SPADeployConfig {
readonly certificateARN?: string,
readonly cfBehaviors?: Behavior[],
readonly cfAliases?: string[],
+ readonly distributionPaths?: string[],
readonly exportWebsiteUrlOutput?:boolean,
readonly exportWebsiteUrlName?: string,
readonly blockPublicAccess?:s3.BlockPublicAccess
@@ -235,7 +236,7 @@ export class SPADeploy extends Construct {
destinationBucket: websiteBucket,
// Invalidate the cache for / and index.html when we deploy so that cloudfront serves latest site
distribution,
- distributionPaths: ['/', `/${config.indexDoc}`],
+ distributionPaths: config.distributionPaths || ['/', `/${config.indexDoc}`],
role: config.role,
});
When using
createSiteWithCloudfront
is there a way to configure the Cloudfront invalidation path that should be performed on deploy?Cause currently, by default, only the configured indexDoc and / are invalidated.