diff options
Diffstat (limited to 'deploy')
-rw-r--r-- | deploy/cloudfront.go | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/deploy/cloudfront.go b/deploy/cloudfront.go index a91126c5d..91453dfb9 100644 --- a/deploy/cloudfront.go +++ b/deploy/cloudfront.go @@ -27,6 +27,15 @@ import ( gcaws "gocloud.dev/aws" ) +// V2ConfigFromURLParams will fail for any unknown params, so we need to remove them. +// This is a mysterious API, but inspecting the code the known params are: +var v2ConfigValidParams = map[string]bool{ + "endpoint": true, + "region": true, + "profile": true, + "awssdk": true, +} + // InvalidateCloudFront invalidates the CloudFront cache for distributionID. // Uses AWS credentials config from the bucket URL. func InvalidateCloudFront(ctx context.Context, target *Target) error { @@ -34,7 +43,16 @@ func InvalidateCloudFront(ctx context.Context, target *Target) error { if err != nil { return err } - cfg, err := gcaws.V2ConfigFromURLParams(ctx, u.Query()) + vals := u.Query() + + // Remove any unknown params. + for k := range vals { + if !v2ConfigValidParams[k] { + vals.Del(k) + } + } + + cfg, err := gcaws.V2ConfigFromURLParams(ctx, vals) if err != nil { return err } |