Skip to content

Commit

Permalink
build: add etag for deleting policies
Browse files Browse the repository at this point in the history
  • Loading branch information
ilfa committed Dec 19, 2023
1 parent f642ad8 commit 4c22b69
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions e2e/scripts/cleanup.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async function cleanupSecrets() {
async function cleanupCloudFrontCachePolicies() {
for await(const policy of listCloudFrontCachePolicies()) {
try {
await cloudFront.deleteCachePolicy({ Id: policy.CachePolicy.Id }).promise()
await cloudFront.deleteCachePolicy({ Id: policy.CachePolicy.Id, IfMatch: policy.CachePolicy.ETag }).promise()
console.info(`Deleted Cache Policy ${policy.CachePolicy.CachePolicyConfig.Name}`)
} catch (error) {
console.error(`Failed to delete Cache Policy ${policy.CachePolicy.CachePolicyConfig.Name}`, error)
Expand All @@ -52,7 +52,7 @@ async function cleanupCloudFrontCachePolicies() {
async function cleanupCloudFrontOriginPolicies() {
for await(const policy of listCloudFrontOriginPolicies()) {
try {
await cloudFront.deleteOriginRequestPolicy({ Id: policy.OriginRequestPolicy.Id }).promise()
await cloudFront.deleteOriginRequestPolicy({ Id: policy.OriginRequestPolicy.Id, IfMatch: policy.OriginRequestPolicy.ETag }).promise()
console.info(`Deleted Origin Request Policy ${policy.OriginRequestPolicy.OriginRequestPolicyConfig.Name}`)
} catch (error) {
console.error(`Failed to delete Origin Request Policy ${policy.OriginRequestPolicy.OriginRequestPolicyConfig.Name}`, error)
Expand Down

0 comments on commit 4c22b69

Please sign in to comment.