From dbe04738718c730495d47ce73e53d18047337de9 Mon Sep 17 00:00:00 2001 From: Teemu Erkkola Date: Wed, 24 Apr 2024 09:59:31 +0300 Subject: [PATCH] REKDAT-117: Fix string list parsing in ShieldStack --- cdk/lib/shield-stack.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/cdk/lib/shield-stack.ts b/cdk/lib/shield-stack.ts index d2335aa8..e653e5f6 100644 --- a/cdk/lib/shield-stack.ts +++ b/cdk/lib/shield-stack.ts @@ -22,25 +22,28 @@ export class ShieldStack extends Stack { resourceArn: props.loadBalancer.loadBalancerArn }) - const banned_ips = aws_ssm.StringListParameter.fromStringListParameterName(this, 'bannedIpsList', - `/${props.environment}/waf/banned_ips`); - - const whitelisted_ips = aws_ssm.StringListParameter.fromStringListParameterName(this, 'whitelistedIpsList', - `/${props.environment}/waf/whitelisted_ips`); - + const banned_ips = new CfnParameter(this, 'bannedIpsList', { + type: 'AWS::SSM::Parameter::Value>', + default: `/${props.environment}/waf/banned_ips` + }) const cfnBannedIPSet = new aws_wafv2.CfnIPSet(this, 'BannedIPSet', { name: 'banned-ips', scope: 'REGIONAL', ipAddressVersion: "IPV4", - addresses: banned_ips.stringListValue + addresses: banned_ips.valueAsList + }) + + const whitelisted_ips = new CfnParameter(this, 'whitelistedIpsList', { + type: 'AWS::SSM::Parameter::Value>', + default: `/${props.environment}/waf/whitelisted_ips` }) const cfnWhiteListedIpSet = new aws_wafv2.CfnIPSet(this, 'WhitelistedIPSet', { name: 'whitelisted-ips', scope: 'REGIONAL', ipAddressVersion: "IPV4", - addresses: whitelisted_ips.stringListValue + addresses: whitelisted_ips.valueAsList })