Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nshmp-utils-ts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ghsc
National Seismic Hazard Model Project
nshmp-utils-ts
Merge requests
!222
add deletion policy
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
add deletion policy
ghsc/users/bclayton/nshmp/nshmp-utils-ts:policy
into
main
Overview
0
Commits
1
Pipelines
0
Changes
1
Merged
Clayton, Brandon Scott
requested to merge
ghsc/users/bclayton/nshmp/nshmp-utils-ts:policy
into
main
11 months ago
Overview
0
Commits
1
Pipelines
0
Changes
1
Expand
Add deletion policy to custom resource.
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
d14c5462
1 commit,
11 months ago
1 file
+
33
−
9
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
libs/aws/reverse-proxy/update-proxy.ts
+
33
−
9
Options
import
{
aws_ssm
as
ssm
,
custom_resources
as
cr
,
Stack
}
from
'
aws-cdk-lib
'
;
import
{
aws_ssm
as
ssm
,
CfnDeletionPolicy
,
CfnResource
,
custom_resources
as
cr
,
CustomResource
,
RemovalPolicy
,
Stack
,
}
from
'
aws-cdk-lib
'
;
import
{
Construct
}
from
'
constructs
'
;
import
*
as
fs
from
'
fs
'
;
import
*
as
path
from
'
path
'
;
@@ -89,12 +97,28 @@ export function updateProxy(props: UpdateProxyProps): cr.AwsCustomResource {
},
};
return
new
cr
.
AwsCustomResource
(
props
.
scope
,
`
${
props
.
id
}
SnsReverseProxy`
,
{
onCreate
:
sdkCall
,
onDelete
:
onDeleteSdkCall
,
onUpdate
:
sdkCall
,
policy
:
cr
.
AwsCustomResourcePolicy
.
fromSdkCalls
({
resources
:
cr
.
AwsCustomResourcePolicy
.
ANY_RESOURCE
,
}),
});
const
customResource
=
new
cr
.
AwsCustomResource
(
props
.
scope
,
`
${
props
.
id
}
SnsReverseProxy`
,
{
onCreate
:
sdkCall
,
onDelete
:
onDeleteSdkCall
,
onUpdate
:
sdkCall
,
removalPolicy
:
RemovalPolicy
.
RETAIN
,
policy
:
cr
.
AwsCustomResourcePolicy
.
fromSdkCalls
({
resources
:
cr
.
AwsCustomResourcePolicy
.
ANY_RESOURCE
,
}),
}
);
const
cfnResource
=
(
customResource
.
node
.
defaultChild
as
CustomResource
|
undefined
)?.
node
.
defaultChild
as
CfnResource
|
undefined
;
// Update deletion policy
if
(
cfnResource
instanceof
CfnResource
)
{
cfnResource
.
addOverride
(
'
DeletionPolicy
'
,
CfnDeletionPolicy
.
DELETE
);
}
return
customResource
;
}
Loading