Skip to content

Commit fa87a75

Browse files
ajmu1mabe13Tomdangonsindhu26ThomasC-Kainos
authored
Release/30.1 (#1139)
# Release Branch Pull Request ## Description of Changes This release will contain upgrade of terraform core version(from v1.2.1 to v1.13.0), terraform AWS provider version(v5.68.0 to v6.14.1) and python version upgrade(v3.12 to v3.14) for lambda and tester docker images of DI application as well. --------- Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Matthew Begley <60427904+mabe13@users.noreply.github.com> Co-authored-by: Matthew Begley <60427904+mabe13@users.noreply.github.com> Co-authored-by: Thomas Judd-Cooper <me@tomjuddcooper.co.uk> Co-authored-by: Sindhu Natarajan <nsindhupriya@hotmail.co.uk> Co-authored-by: ThomasC-Kainos <106971950+ThomasC-Kainos@users.noreply.github.com> Co-authored-by: ajmu1 <ajmu1@hscic.gov.uk> Co-authored-by: ManithaSrinivasa <142212846+ManithaSrinivasa@users.noreply.github.com>
1 parent 713dc26 commit fa87a75

2 files changed

Lines changed: 78 additions & 0 deletions

File tree

infrastructure/stacks/blue-green-link/cloudwatch-queries.tf

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1+
// Introduce a short sleep BEFORE creating query definitions to allow
2+
// recently-created log groups (from other modules in the same apply)
3+
// to propagate. Note: This does NOT guarantee post-create consistency
4+
// of the query definitions themselves, but can reduce immediate read
5+
// failures when the provider plans many resources concurrently.
6+
resource "time_sleep" "wait_for_propagation" {
7+
create_duration = "5s"
8+
}
9+
110
resource "aws_cloudwatch_query_definition" "search_for_errors" {
11+
depends_on = [time_sleep.wait_for_propagation]
212
name = "${var.project_id}/${var.blue_green_environment}/search-for-errors"
313

414
log_group_names = [
@@ -16,9 +26,14 @@ fields @timestamp, correlation_id, ods_code, function_name, message
1626
| filter level == 'ERROR'
1727
| sort @timestamp
1828
EOF
29+
30+
lifecycle {
31+
create_before_destroy = false
32+
}
1933
}
2034

2135
resource "aws_cloudwatch_query_definition" "search_by_correlation_id" {
36+
depends_on = [time_sleep.wait_for_propagation]
2237
name = "${var.project_id}/${var.blue_green_environment}/search-by-correlation-id"
2338

2439
log_group_names = [
@@ -36,9 +51,14 @@ fields @timestamp, message
3651
| filter correlation_id == 'REPLACE'
3752
| sort @timestamp
3853
EOF
54+
55+
lifecycle {
56+
create_before_destroy = false
57+
}
3958
}
4059

4160
resource "aws_cloudwatch_query_definition" "search_by_correlation_id_expanded" {
61+
depends_on = [time_sleep.wait_for_propagation]
4262
name = "${var.project_id}/${var.blue_green_environment}/search-by-correlation-id-expanded"
4363

4464
log_group_names = [
@@ -56,9 +76,14 @@ fields @timestamp,correlation_id,ods_code,level,message_received,function_name,
5676
| filter correlation_id == 'REPLACE'
5777
| sort @timestamp
5878
EOF
79+
80+
lifecycle {
81+
create_before_destroy = false
82+
}
5983
}
6084

6185
resource "aws_cloudwatch_query_definition" "search_by_odscode" {
86+
depends_on = [time_sleep.wait_for_propagation]
6287
name = "${var.project_id}/${var.blue_green_environment}/search-by-odscode"
6388

6489
log_group_names = [
@@ -76,9 +101,14 @@ fields @timestamp, message
76101
| filter ods_code == 'REPLACE'
77102
| sort @timestamp
78103
EOF
104+
105+
lifecycle {
106+
create_before_destroy = false
107+
}
79108
}
80109

81110
resource "aws_cloudwatch_query_definition" "search_by_odscode_expanded" {
111+
depends_on = [time_sleep.wait_for_propagation]
82112
name = "${var.project_id}/${var.blue_green_environment}/search-by-odscode-expanded"
83113

84114
log_group_names = [
@@ -96,9 +126,14 @@ fields @timestamp,correlation_id,ods_code,level,message_received,function_name,
96126
| filter ods_code == 'REPLACE'
97127
| sort @timestamp
98128
EOF
129+
130+
lifecycle {
131+
create_before_destroy = false
132+
}
99133
}
100134

101135
resource "aws_cloudwatch_query_definition" "search_for_invalid_postcode" {
136+
depends_on = [time_sleep.wait_for_propagation]
102137
name = "${var.project_id}/${var.blue_green_environment}/search-for-invalid-postcode"
103138

104139
log_group_names = [
@@ -110,9 +145,14 @@ fields @timestamp,correlation_id,ods_code,level,message_received,function_name,
110145
| filter report_key == 'INVALID_POSTCODE'
111146
| sort @timestamp
112147
EOF
148+
149+
lifecycle {
150+
create_before_destroy = false
151+
}
113152
}
114153

115154
resource "aws_cloudwatch_query_definition" "search_for_invalid_opening_times" {
155+
depends_on = [time_sleep.wait_for_propagation]
116156
name = "${var.project_id}/${var.blue_green_environment}/search-for-invalid-opening-times"
117157

118158
log_group_names = [
@@ -124,9 +164,14 @@ fields @timestamp,correlation_id,ods_code,level,message_received,function_name,
124164
| filter report_key == 'INVALID_OPEN_TIMES'
125165
| sort @timestamp
126166
EOF
167+
168+
lifecycle {
169+
create_before_destroy = false
170+
}
127171
}
128172

129173
resource "aws_cloudwatch_query_definition" "search_by_email_correlation_id" {
174+
depends_on = [time_sleep.wait_for_propagation]
130175
name = "${var.project_id}/${var.blue_green_environment}/search-by-email-correlation-id"
131176

132177
log_group_names = [
@@ -139,9 +184,14 @@ fields correlation_id
139184
| filter message =="Email Correlation Id"
140185
| filter email_correlation_id == "ADD_EMAIL_CORRELATION_ID"
141186
EOF
187+
188+
lifecycle {
189+
create_before_destroy = false
190+
}
142191
}
143192

144193
resource "aws_cloudwatch_query_definition" "search_by_update_request_success" {
194+
depends_on = [time_sleep.wait_for_propagation]
145195
name = "${var.project_id}/${var.blue_green_environment}/update-request-success"
146196

147197
log_group_names = [
@@ -153,9 +203,14 @@ fields @timestamp, correlation_id
153203
| filter ServiceUpdateSuccess == 1
154204
| sort @timestamp desc
155205
EOF
206+
207+
lifecycle {
208+
create_before_destroy = false
209+
}
156210
}
157211

158212
resource "aws_cloudwatch_query_definition" "search_by_update_request_failed" {
213+
depends_on = [time_sleep.wait_for_propagation]
159214
name = "${var.project_id}/${var.blue_green_environment}/update-request-failed"
160215

161216
log_group_names = [
@@ -167,9 +222,14 @@ fields @timestamp, correlation_id, report_key
167222
| filter report_key == DOS_DB_UPDATE_DLQ_HANDLER_RECEIVED_EVENT
168223
| sort @timestamp desc
169224
EOF
225+
226+
lifecycle {
227+
create_before_destroy = false
228+
}
170229
}
171230

172231
resource "aws_cloudwatch_query_definition" "search_by_dos_data_item_updates" {
232+
depends_on = [time_sleep.wait_for_propagation]
173233
name = "${var.project_id}/${var.blue_green_environment}/dos-data-item-updates"
174234

175235
log_group_names = [
@@ -183,9 +243,14 @@ fields @timestamp, correlation_id
183243
| filter field == 'REPLACE'
184244
| sort @timestamp desc
185245
EOF
246+
247+
lifecycle {
248+
create_before_destroy = false
249+
}
186250
}
187251

188252
resource "aws_cloudwatch_query_definition" "search_for_report_warnings" {
253+
depends_on = [time_sleep.wait_for_propagation]
189254
name = "${var.project_id}/${var.blue_green_environment}/search-for-report-warnings"
190255

191256
log_group_names = [
@@ -204,10 +269,15 @@ fields @timestamp, correlation_id, message
204269
| filter level == 'WARNING'
205270
| sort @timestamp desc
206271
EOF
272+
273+
lifecycle {
274+
create_before_destroy = false
275+
}
207276
}
208277

209278

210279
resource "aws_cloudwatch_query_definition" "search_for_quality_checker_logs_with_odscode" {
280+
depends_on = [time_sleep.wait_for_propagation]
211281
name = "${var.project_id}/${var.blue_green_environment}/search-for-quality-checker-logs-with-odscode"
212282

213283
log_group_names = [
@@ -219,4 +289,8 @@ fields @timestamp, level, message
219289
| filter odscode = 'TO_ADD'
220290
| sort @timestamp asc
221291
EOF
292+
293+
lifecycle {
294+
create_before_destroy = false
295+
}
222296
}

infrastructure/stacks/blue-green-link/terraform.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,9 @@ terraform {
77
source = "hashicorp/aws"
88
version = "~> 6.14.1"
99
}
10+
time = {
11+
source = "hashicorp/time"
12+
version = "~> 0.13.1"
13+
}
1014
}
1115
}

0 commit comments

Comments
 (0)