Skip to content

Commit b44007d

Browse files
committed
CCM-12875: split api gateway resources into their own files
1 parent f60ad97 commit b44007d

16 files changed

+174
-198
lines changed

infrastructure/terraform/components/dl/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ No requirements.
5858
| Name | Description |
5959
|------|-------------|
6060
| <a name="output_deployment"></a> [deployment](#output\_deployment) | Deployment details used for post-deployment scripts |
61-
| <a name="output_pdm_mock_endpoint"></a> [pdm\_mock\_endpoint](#output\_pdm\_mock\_endpoint) | The base URL of the PDM Mock (null when not deployed) |
62-
| <a name="output_pdm_mock_id"></a> [pdm\_mock\_id](#output\_pdm\_mock\_id) | The ID of the PDM Mock API Gateway (null when not deployed) |
6361
<!-- vale on -->
6462
<!-- markdownlint-enable -->
6563
<!-- END_TF_DOCS -->

infrastructure/terraform/components/dl/apigateway_pdm_mock.tf

Lines changed: 0 additions & 196 deletions
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
resource "aws_api_gateway_deployment" "pdm_mock" {
2+
count = local.deploy_pdm_mock ? 1 : 0
3+
4+
depends_on = [
5+
aws_api_gateway_integration.create_document_reference,
6+
aws_api_gateway_integration.get_document_reference,
7+
]
8+
9+
rest_api_id = aws_api_gateway_rest_api.pdm_mock[0].id
10+
11+
triggers = {
12+
redeployment = sha1(jsonencode([
13+
aws_api_gateway_resource.patient_data_manager[0].id,
14+
aws_api_gateway_resource.fhir[0].id,
15+
aws_api_gateway_resource.r4[0].id,
16+
aws_api_gateway_resource.document_reference[0].id,
17+
aws_api_gateway_resource.document_reference_id[0].id,
18+
aws_api_gateway_method.create_document_reference[0].id,
19+
aws_api_gateway_method.get_document_reference[0].id,
20+
aws_api_gateway_integration.create_document_reference[0].id,
21+
aws_api_gateway_integration.get_document_reference[0].id,
22+
]))
23+
}
24+
25+
lifecycle {
26+
create_before_destroy = true
27+
}
28+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
resource "aws_api_gateway_integration" "create_document_reference" {
2+
count = local.deploy_pdm_mock ? 1 : 0
3+
4+
rest_api_id = aws_api_gateway_rest_api.pdm_mock[0].id
5+
resource_id = aws_api_gateway_resource.document_reference[0].id
6+
http_method = aws_api_gateway_method.create_document_reference[0].http_method
7+
8+
integration_http_method = "POST"
9+
type = "AWS_PROXY"
10+
uri = module.pdm_mock[0].function_invoke_arn
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
resource "aws_api_gateway_integration" "get_document_reference" {
2+
count = local.deploy_pdm_mock ? 1 : 0
3+
4+
rest_api_id = aws_api_gateway_rest_api.pdm_mock[0].id
5+
resource_id = aws_api_gateway_resource.document_reference_id[0].id
6+
http_method = aws_api_gateway_method.get_document_reference[0].http_method
7+
8+
integration_http_method = "POST"
9+
type = "AWS_PROXY"
10+
uri = module.pdm_mock[0].function_invoke_arn
11+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
resource "aws_api_gateway_method" "create_document_reference" {
2+
count = local.deploy_pdm_mock ? 1 : 0
3+
4+
rest_api_id = aws_api_gateway_rest_api.pdm_mock[0].id
5+
resource_id = aws_api_gateway_resource.document_reference[0].id
6+
http_method = "POST"
7+
authorization = "AWS_IAM"
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
resource "aws_api_gateway_method" "get_document_reference" {
2+
count = local.deploy_pdm_mock ? 1 : 0
3+
4+
rest_api_id = aws_api_gateway_rest_api.pdm_mock[0].id
5+
resource_id = aws_api_gateway_resource.document_reference_id[0].id
6+
http_method = "GET"
7+
authorization = "AWS_IAM"
8+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
resource "aws_api_gateway_resource" "document_reference" {
2+
count = local.deploy_pdm_mock ? 1 : 0
3+
4+
rest_api_id = aws_api_gateway_rest_api.pdm_mock[0].id
5+
parent_id = aws_api_gateway_resource.r4[0].id
6+
path_part = "DocumentReference"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
resource "aws_api_gateway_resource" "document_reference_id" {
2+
count = local.deploy_pdm_mock ? 1 : 0
3+
4+
rest_api_id = aws_api_gateway_rest_api.pdm_mock[0].id
5+
parent_id = aws_api_gateway_resource.document_reference[0].id
6+
path_part = "{id}"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
resource "aws_api_gateway_resource" "fhir" {
2+
count = local.deploy_pdm_mock ? 1 : 0
3+
4+
rest_api_id = aws_api_gateway_rest_api.pdm_mock[0].id
5+
parent_id = aws_api_gateway_resource.patient_data_manager[0].id
6+
path_part = "FHIR"
7+
}

0 commit comments

Comments
 (0)