Skip to content

Commit 5fff7de

Browse files
Add orchestration chart resources to Terraform (#30)
1 parent 227acff commit 5fff7de

File tree

4 files changed

+71
-17
lines changed

4 files changed

+71
-17
lines changed
1.35 KB
Binary file not shown.

terraform/implementation/data.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ data "kubectl_path_documents" "keda_trigger" {
3131
}
3232

3333
data "kubectl_path_documents" "keda_scaled_object" {
34-
for_each = local.services
34+
for_each = var.services_to_chart
3535
pattern = "./manifests/kedaScaledObject.yaml"
3636
vars = {
3737
subscriptionId = "${var.subscription_id}"
1.03 KB
Binary file not shown.

terraform/implementation/main.tf

Lines changed: 70 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,21 @@ locals {
1919
resource_group_name = var.resource_group_name,
2020
subscription_id = var.subscription_id,
2121
}))
22+
}
2223

23-
services = toset([
24-
"fhir-converter",
25-
"ingestion",
26-
"ingress",
27-
"message-parser",
28-
"validation",
29-
])
24+
variable "services_to_chart" {
25+
type = map(string)
26+
default = {
27+
fhir-converter = "fhir-converter-chart",
28+
ingestion = "ingestion-chart",
29+
ingress = "ingress-chart",
30+
message-parser = "message-parser-chart",
31+
orchestration = "orchestration",
32+
validation = "validation-chart"
33+
}
3034
}
3135

36+
3237
# Service Principal
3338
resource "azuread_application" "aks" {
3439
display_name = "phdi-playground-${terraform.workspace}-aks"
@@ -320,19 +325,20 @@ spec:
320325
YAML
321326
}
322327

323-
# Helm Releases
324328

325329
resource "helm_release" "building_blocks" {
326-
for_each = local.services
327-
repository = "https://cdcgov.github.io/phdi-charts/"
328-
name = "phdi-playground-${terraform.workspace}-${each.key}"
329-
chart = "${each.key}-chart"
330-
recreate_pods = true
331-
depends_on = [helm_release.agic]
330+
for_each = var.services_to_chart
331+
repository = "https://cdcgov.github.io/phdi-charts/"
332+
name = "phdi-playground-${terraform.workspace}-${each.key}"
333+
chart = each.value
334+
depends_on = [helm_release.agic]
335+
force_update = true
336+
recreate_pods = true
337+
cleanup_on_fail = true
332338

333339
set {
334340
name = "image.tag"
335-
value = "latest"
341+
value = "v1.1.1"
336342
}
337343

338344
set {
@@ -349,8 +355,56 @@ resource "helm_release" "building_blocks" {
349355
name = "ingressHostname"
350356
value = "${var.resource_group_name}-${terraform.workspace}.${var.location}.cloudapp.azure.com"
351357
}
358+
359+
# Service names needed for ingress routes
360+
set {
361+
name = "ingestionServiceName"
362+
value = "phdi-playground-${terraform.workspace}-ingestion-ingestion-service"
363+
}
364+
365+
set {
366+
name = "fhirConverterServiceName"
367+
value = "phdi-playground-${terraform.workspace}-fhir-converter-fhir-converter-service"
368+
}
369+
370+
set {
371+
name = "messageParserServiceName"
372+
value = "phdi-playground-${terraform.workspace}-message-parser-message-parser-service"
373+
}
374+
375+
set {
376+
name = "validationServiceName"
377+
value = "phdi-playground-${terraform.workspace}-validation-validation-service"
378+
}
379+
380+
set {
381+
name = "orchestrationServiceName"
382+
value = "phdi-playground-${terraform.workspace}-orchestration-orchestration-service"
383+
}
384+
385+
# Values needed for orchestration service
386+
set {
387+
name = "fhirConverterUrl"
388+
value = "https://${var.resource_group_name}-${terraform.workspace}.${var.location}.cloudapp.azure.com/fhir-converter"
389+
}
390+
391+
set {
392+
name = "ingestionUrl"
393+
value = "https://${var.resource_group_name}-${terraform.workspace}.${var.location}.cloudapp.azure.com/ingestion"
394+
}
395+
396+
set {
397+
name = "messageParserUrl"
398+
value = "https://${var.resource_group_name}-${terraform.workspace}.${var.location}.cloudapp.azure.com/message-parser"
399+
}
400+
401+
set {
402+
name = "validationUrl"
403+
value = "https://${var.resource_group_name}-${terraform.workspace}.${var.location}.cloudapp.azure.com/validation"
404+
}
352405
}
353406

407+
354408
# Metrics Dashboard
355409

356410
resource "azurerm_portal_dashboard" "pipeline_metrics" {
@@ -388,7 +442,7 @@ resource "kubectl_manifest" "keda_trigger" {
388442
}
389443

390444
resource "kubectl_manifest" "keda_scaled_object" {
391-
for_each = local.services
445+
for_each = var.services_to_chart
392446
depends_on = [kubectl_manifest.keda_trigger]
393447
yaml_body = data.kubectl_path_documents.keda_scaled_object[each.key].documents[0]
394448
}

0 commit comments

Comments
 (0)