File tree Expand file tree Collapse file tree 5 files changed +74
-4
lines changed
terraform/account-wide-infrastructure Expand file tree Collapse file tree 5 files changed +74
-4
lines changed Original file line number Diff line number Diff line change @@ -174,6 +174,7 @@ def _populate_seed_table(
174174 )
175175 doc_ref_counter = 0
176176 batch_counter = 0
177+ unprocessed_count = 0
177178
178179 pointer_data : list [list [str ]] = []
179180
@@ -189,8 +190,8 @@ def _populate_seed_table(
189190 )
190191
191192 if response .get ("UnprocessedItems" ):
192- logger . error (
193- f"Unprocessed items in batch write: { len ( response .get (' UnprocessedItems' )) } "
193+ unprocessed_count += len (
194+ response .get (" UnprocessedItems" ). get ( table_name , [])
194195 )
195196
196197 batch_upsert_items = []
@@ -221,13 +222,13 @@ def _populate_seed_table(
221222 if px_counter % 1000 == 0 :
222223 print ("." , end = "" , flush = True )
223224 if px_counter % 100000 == 0 :
224- print (f" { px_counter } patients processed" )
225+ print (f" { px_counter } patients processed ( { doc_ref_counter } pointers). " )
225226
226227 print (" Done." )
227228
228229 end_time = datetime .now (tz = timezone .utc )
229230 print (
230- f"Created { doc_ref_counter } pointers in { timedelta .total_seconds (end_time - start_time )} seconds."
231+ f"Created { doc_ref_counter } pointers in { timedelta .total_seconds (end_time - start_time )} seconds (unprocessed: { unprocessed_count } ) ."
231232 )
232233
233234 with open ("./dist/seed-nft-pointers.csv" , "w" ) as f :
Original file line number Diff line number Diff line change 1+ output "bucket_name" {
2+ description = " Name of the metadata S3 bucket"
3+ value = aws_s3_bucket. metadata_bucket . bucket
4+ }
Original file line number Diff line number Diff line change 1+ resource "aws_s3_bucket" "metadata_bucket" {
2+ bucket = " ${ var . name_prefix } -metadata"
3+ force_destroy = false
4+ }
5+
6+ resource "aws_s3_bucket_policy" "metadata_bucket_policy" {
7+ bucket = aws_s3_bucket. metadata_bucket . id
8+
9+ policy = jsonencode ({
10+ Version = " 2012-10-17"
11+ Id = " metadata_bucket_policy"
12+ Statement = [
13+ {
14+ Sid = " HTTPSOnly"
15+ Effect = " Deny"
16+ Principal = " *"
17+ Action = " s3:*"
18+ Resource = [
19+ aws_s3_bucket.metadata_bucket.arn,
20+ " ${ aws_s3_bucket . metadata_bucket . arn } /*" ,
21+ ]
22+ Condition = {
23+ Bool = {
24+ " aws:SecureTransport" = " false"
25+ }
26+ }
27+ },
28+ ]
29+ })
30+ }
31+
32+ resource "aws_s3_bucket_public_access_block" "metadata_bucket_public_access_block" {
33+ bucket = aws_s3_bucket. metadata_bucket . id
34+
35+ block_public_acls = true
36+ block_public_policy = true
37+ ignore_public_acls = true
38+ restrict_public_buckets = true
39+ }
40+
41+ resource "aws_s3_bucket_server_side_encryption_configuration" "metadata_bucket" {
42+ bucket = aws_s3_bucket. metadata_bucket . bucket
43+
44+ rule {
45+ apply_server_side_encryption_by_default {
46+ sse_algorithm = " AES256"
47+ }
48+ }
49+ }
50+
51+ resource "aws_s3_bucket_versioning" "metadata_bucket" {
52+ bucket = aws_s3_bucket. metadata_bucket . id
53+ versioning_configuration {
54+ status = " Enabled"
55+ }
56+ }
Original file line number Diff line number Diff line change 1+ variable "name_prefix" {
2+ type = string
3+ description = " The prefix to apply to all resources in the module."
4+ }
Original file line number Diff line number Diff line change @@ -64,3 +64,8 @@ module "perftest-truststore-bucket" {
6464 name_prefix = " nhsd-nrlf--perftest"
6565 server_certificate_file = " ../../../truststore/server/perftest.pem"
6666}
67+
68+ module "perftest-metadata-bucket" {
69+ source = " ../modules/metadata-bucket"
70+ name_prefix = " nhsd-nrlf--perftest"
71+ }
You can’t perform that action at this time.
0 commit comments