File tree Expand file tree Collapse file tree
infrastructure/stacks/shared-resources Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ SLACK_ALERT_CHANNEL := dos-integration-dev-status
4040
4141# WAF
4242WAF_ENABLED := true
43+ DDB_DELETE_PROTECTION :=false
4344
4445# ==============================================================================
4546# Performance variables
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ SLACK_ALERT_CHANNEL := dos-integration-dev-status
3939
4040# WAF
4141WAF_ENABLED := false
42+ DDB_DELETE_PROTECTION :=false
4243
4344# ==============================================================================
4445# Performance variables
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ SLACK_ALERT_CHANNEL := dos-integration-live-status
4141
4242# WAF
4343WAF_ENABLED := true
44+ DDB_DELETE_PROTECTION :=true
4445
4546# ==============================================================================
4647# Performance variables
Original file line number Diff line number Diff line change 22
33# WAF
44WAF_ENABLED := true
5+ DDB_DELETE_PROTECTION :=false
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ SLACK_ALERT_CHANNEL := dos-integration-dev-status
3939
4040# WAF
4141WAF_ENABLED := true
42+ DDB_DELETE_PROTECTION :=false
4243
4344# ==============================================================================
4445# Performance variables
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ SLACK_ALERT_CHANNEL := dos-integration-dev-status
3939
4040# WAF
4141WAF_ENABLED := true
42+ DDB_DELETE_PROTECTION :=false
4243
4344# ==============================================================================
4445# Performance variables
Original file line number Diff line number Diff line change @@ -109,6 +109,7 @@ TF_VAR_change_event_dlq := $(PROJECT_ID)-$(SHARED_ENVIRONMENT)-change-event-dead
109109# Dynamodb
110110TF_VAR_change_events_table_name := $(PROJECT_ID ) -$(SHARED_ENVIRONMENT ) -change-events
111111DYNAMO_DB_TABLE := $(TF_VAR_change_events_table_name )
112+ TF_VAR_ddb_delete_protection :=$(DDB_DELETE_PROTECTION )
112113
113114# Log Group Filters for Firehose
114115TF_VAR_change_event_gateway_subscription_filter_name := $(PROJECT_ID ) -$(SHARED_ENVIRONMENT ) -change-event-api-gateway-cw-logs-firehose-subscription
@@ -140,6 +141,7 @@ TF_VAR_waf_ip_allow_list_rule_name := $(PROJECT_ID)-$(SHARED_ENVIRONMENT)-waf-ip
140141TF_VAR_waf_rate_based_rule_name := $(PROJECT_ID ) -$(SHARED_ENVIRONMENT ) -waf-rate-based-rule
141142TF_VAR_waf_aws_known_bad_inputs_rule_name := $(PROJECT_ID ) -$(SHARED_ENVIRONMENT ) -waf-aws-known-bad-inputs-rule
142143TF_VAR_waf_aws_sqli_rule_name := $(PROJECT_ID ) -$(SHARED_ENVIRONMENT ) -waf-aws-sqli-rule
144+ TF_VAR_waf_custom_sqli_rule_name := $(PROJECT_ID ) -$(SHARED_ENVIRONMENT ) -waf-custom-sqli-rule
143145
144146# -------------------------------
145147# BLUE/GREEN ENVIRONMENT VARIABLES
Original file line number Diff line number Diff line change @@ -118,6 +118,26 @@ resource "aws_cloudwatch_metric_alarm" "waf_aws_managed_sql_injection_blocked_re
118118 threshold = " 1"
119119}
120120
121+ resource "aws_cloudwatch_metric_alarm" "waf_custom_sql_injection_count_requests" {
122+ count = var. waf_enabled ? 1 : 0
123+ alarm_actions = [aws_sns_topic . shared_resources_sns_topic_app_alerts_for_slack_default_region . arn ]
124+ alarm_description = " WAF Custom SQL Injection Count Requests"
125+ alarm_name = " ${ var . project_id } | ${ var . shared_environment } | WAF Custom SQL Injection Count Requests"
126+ comparison_operator = " GreaterThanThreshold"
127+ datapoints_to_alarm = " 1"
128+ dimensions = {
129+ Rule = var.waf_custom_sqli_rule_name
130+ WebACL = var.waf_acl_name,
131+ Region = var.aws_region
132+ }
133+ evaluation_periods = " 1"
134+ metric_name = " CountedRequests"
135+ namespace = " AWS/WAFV2"
136+ period = " 60"
137+ statistic = " Sum"
138+ threshold = " 1"
139+ }
140+
121141resource "aws_cloudwatch_metric_alarm" "waf_aws_managed_ip_reputation_list_blocked_requests" {
122142 count = var. waf_enabled ? 1 : 0
123143 alarm_actions = [aws_sns_topic . shared_resources_sns_topic_app_alerts_for_slack_default_region . arn ]
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ resource "aws_dynamodb_table" "message-history-table" {
33 billing_mode = " PAY_PER_REQUEST"
44 hash_key = " Id"
55 range_key = " ODSCode"
6+ deletion_protection_enabled = var. ddb_delete_protection
67
78 server_side_encryption {
89 enabled = true
Original file line number Diff line number Diff line change @@ -158,6 +158,11 @@ variable "waf_enabled" {
158158 description = " Whether to enable WAF"
159159}
160160
161+ variable "ddb_delete_protection" {
162+ type = bool
163+ description = " Whether to enable delete protection"
164+ }
165+
161166variable "waf_acl_name" {
162167 type = string
163168 description = " Name of the WAF ACL"
@@ -211,3 +216,8 @@ variable "waf_aws_sqli_rule_name" {
211216 type = string
212217 description = " WAF AWS SQLi rule name"
213218}
219+
220+ variable "waf_custom_sqli_rule_name" {
221+ type = string
222+ description = " WAF custom SQLi rule name"
223+ }
You can’t perform that action at this time.
0 commit comments