Skip to content

Commit 9eed7ce

Browse files
authored
VED 357 - Old infra and old terraform from release to prod v1.0.2361-alpha+313078 (#624)
1 parent af47ad1 commit 9eed7ce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+4404
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ See https://nhsd-confluence.digital.nhs.uk/display/APM/Glossary.
3939
| Folder | Description |
4040
|------------------------|-------------|
4141
| `infra` | Base infrastructure components. |
42+
| `infra_old` | Old infra code used to create INT to mimic prod. |
4243
| `grafana` | Terraform configuration for Grafana, built on top of core infra. |
4344
| `terraform` | Core Terraform infrastructure code. This is run in each PR and sets up lambdas associated with the PR.|
45+
| `terraform_old` | Old tf code used to create INT to mimic prod. |
4446
| `terraform_sandbox` | Sandbox environment for testing infrastructure changes. |
4547
| `terraform_aws_backup` | Streamlined backup processing with AWS. |
4648
| `mesh-infra` | Infrastructure setup for Imms batch MESH integration. |

infra_old/.terraform.lock.hcl

Lines changed: 47 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

infra_old/Makefile

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
-include .env
2+
3+
tf_cmd = AWS_PROFILE=$(AWS_PROFILE) terraform
4+
tf_state= -backend-config="bucket=$(BUCKET_NAME)"
5+
tf_vars= -var-file=environments/$(ENVIRONMENT)/variables.tfvars
6+
7+
.PHONY: lock-provider workspace init plan apply clean destroy output tf-%
8+
9+
lock-provider:
10+
# Run this only when you install a new terraform provider. This will generate sha code in lock file for all platform
11+
echo "This may take a while. Be patient!"
12+
$(tf_cmd) providers lock -platform=darwin_arm64 -platform=darwin_amd64 -platform=linux_amd64 -platform=windows_amd64
13+
14+
workspace:
15+
$(tf_cmd) workspace new $(ENVIRONMENT) || $(tf_cmd) workspace select $(ENVIRONMENT) && echo "Switched to workspace/environment: $(ENVIRONMENT)"
16+
17+
init:
18+
$(tf_cmd) init $(tf_state) -upgrade $(tf_vars)
19+
20+
init-reconfigure:
21+
$(tf_cmd) init $(tf_state) -upgrade $(tf_vars) -reconfigure
22+
23+
plan: workspace
24+
$(tf_cmd) plan $(tf_vars)
25+
26+
apply: workspace
27+
$(tf_cmd) apply $(tf_vars) -auto-approve
28+
29+
clean:
30+
rm -rf build .terraform upload-key
31+
32+
destroy: workspace
33+
$(tf_cmd) destroy $(tf_vars) -auto-approve
34+
$(tf_cmd) workspace select default
35+
$(tf_cmd) workspace delete $(ENVIRONMENT)
36+
37+
output:
38+
ifndef name
39+
$(error name variable not set. Use 'make output name=...')
40+
endif
41+
$(tf_cmd) output -raw $(name)
42+
43+
import:
44+
$(tf_cmd) import $(tf_vars) $(to) $(id)
45+
46+
tf-%:
47+
$(tf_cmd) $*

infra_old/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
## About
2+
This set of resources is used to set up the new INT environment. It replicates the production environment as of version v1.0.2361-alpha+313078, allowing us to simulate releases for production. Delete this folder once the infrastructure is standardised across all environmnets.

infra_old/audit_db.tf

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
resource "aws_dynamodb_table" "audit-table" {
2+
name = "immunisation-batch-int-audit-table"
3+
billing_mode = "PAY_PER_REQUEST"
4+
hash_key = "message_id"
5+
6+
attribute {
7+
name = "message_id"
8+
type = "S"
9+
}
10+
11+
attribute {
12+
name = "filename"
13+
type = "S"
14+
}
15+
16+
attribute {
17+
name = "queue_name"
18+
type = "S"
19+
}
20+
21+
attribute {
22+
name = "status"
23+
type = "S"
24+
}
25+
26+
global_secondary_index {
27+
name = "filename_index"
28+
hash_key = "filename"
29+
projection_type = "ALL"
30+
}
31+
32+
global_secondary_index {
33+
name = "queue_name_index"
34+
hash_key = "queue_name"
35+
range_key = "status"
36+
projection_type = "ALL"
37+
}
38+
39+
point_in_time_recovery {
40+
enabled = true
41+
}
42+
server_side_encryption {
43+
enabled = true
44+
kms_key_arn = aws_kms_key.dynamodb_encryption.arn
45+
}
46+
47+
tags = {
48+
"Environment" = "int"
49+
"Project" = "immunisation"
50+
"Service" = "fhir-api"
51+
}
52+
}

infra_old/delta_db.tf

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
resource "aws_dynamodb_table" "delta-dynamodb-table" {
2+
name = "imms-int-delta"
3+
billing_mode = "PAY_PER_REQUEST"
4+
hash_key = "PK"
5+
attribute {
6+
name = "PK"
7+
type = "S"
8+
}
9+
attribute {
10+
name = "DateTimeStamp"
11+
type = "S"
12+
}
13+
attribute {
14+
name = "Operation"
15+
type = "S"
16+
}
17+
18+
attribute {
19+
name = "VaccineType"
20+
type = "S"
21+
}
22+
23+
attribute {
24+
name = "SupplierSystem"
25+
type = "S"
26+
}
27+
28+
ttl {
29+
attribute_name = "ExpiresAt"
30+
enabled = true
31+
}
32+
33+
global_secondary_index {
34+
name = "SearchIndex"
35+
hash_key = "Operation"
36+
range_key = "DateTimeStamp"
37+
projection_type = "ALL"
38+
}
39+
40+
global_secondary_index {
41+
name = "SecondarySearchIndex"
42+
hash_key = "SupplierSystem"
43+
range_key = "VaccineType"
44+
projection_type = "ALL"
45+
}
46+
47+
point_in_time_recovery {
48+
enabled = true
49+
}
50+
server_side_encryption {
51+
enabled = true
52+
kms_key_arn = aws_kms_key.dynamodb_encryption.arn
53+
}
54+
55+
tags = {
56+
"Environment" = "int"
57+
"Project" = "immunisation"
58+
"Service" = "fhir-api"
59+
}
60+
}

0 commit comments

Comments
 (0)