private addWAF()

in packages/@prototype/provider/src/ProviderBase/index.ts [113:147]


	private addWAF (name: string) {
		const webACL = new waf.CfnWebACL(this, `ProviderWafWebACL-${name}`, {
			name,
			description: `WebACL for ${name}`,
			defaultAction: {
				block: {

				},
			},
			scope: 'REGIONAL',
			tags: [
				{
					key: 'Name',
					value: name,
				},
				{
					key: 'environment',
					value: 'prototype',
				},
			],
			visibilityConfig: {
				cloudWatchMetricsEnabled: true,
				metricName: `waf-metric-${name}`,
				sampledRequestsEnabled: true, // TODO: review this
			},
			rules: [], // TODO: add rules
		})

		const webACLAssociation = new waf.CfnWebACLAssociation(this, `ProviderWafWebACLAssociation-${name}`, {
			resourceArn: this.apiGwInstance.restApiId,
			webAclArn: webACL.attrArn,
		})

		webACLAssociation.addDependsOn(webACL)
	}