diff --git a/.github/linters/.tflint.hcl b/.github/linters/.tflint.hcl index 359f6ac730..0852116fa7 100644 --- a/.github/linters/.tflint.hcl +++ b/.github/linters/.tflint.hcl @@ -5,8 +5,6 @@ config { plugin "azurerm" { enabled = true - version = "0.17.1" - source = "github.com/terraform-linters/tflint-ruleset-azurerm" } rule "terraform_unused_declarations" { diff --git a/api_app/_version.py b/api_app/_version.py index 92fced85ba..3d187266f1 100644 --- a/api_app/_version.py +++ b/api_app/_version.py @@ -1 +1 @@ -__version__ = "0.4.55" +__version__ = "0.5.0" diff --git a/api_app/event_grid/event_sender.py b/api_app/event_grid/event_sender.py index b52de58bb7..81ffa61dca 100644 --- a/api_app/event_grid/event_sender.py +++ b/api_app/event_grid/event_sender.py @@ -28,14 +28,14 @@ async def send_status_changed_event(airlock_request: AirlockRequest, previous_st async def send_airlock_notification_event(airlock_request: AirlockRequest, emails: Dict): request_id = airlock_request.id status = airlock_request.status.value - short_workspace_id = airlock_request.workspaceId[-4:] + workspace_id = airlock_request.workspaceId snake_case_emails = {re.sub(r'(?Airlock request id: @{body('Parse_JSON')?['data']?['request_id']}
\nWorkspace id: @{body('Parse_JSON')?['data']?['workspace_id']}

", + "Body": "View the request", "From": "@parameters('smtp_from_email')", "Subject": "@variables('message')", "To": "@{join(variables('recipients'), ';')}" diff --git a/templates/shared_services/airlock_notifier/app/parameters.json b/templates/shared_services/airlock_notifier/app/parameters.json index 799fe2c93c..927ff4d134 100644 --- a/templates/shared_services/airlock_notifier/app/parameters.json +++ b/templates/shared_services/airlock_notifier/app/parameters.json @@ -2,5 +2,9 @@ "smtp_from_email": { "type": "String", "value": "@appsetting('smtp_from_email')" + }, + "tre_url": { + "type": "String", + "value": "@appsetting('tre_url')" } } diff --git a/templates/shared_services/airlock_notifier/parameters.json b/templates/shared_services/airlock_notifier/parameters.json index e4f6dc8d41..59261f21ec 100755 --- a/templates/shared_services/airlock_notifier/parameters.json +++ b/templates/shared_services/airlock_notifier/parameters.json @@ -10,6 +10,12 @@ "env": "TRE_ID" } }, + { + "name": "tre_url", + "source": { + "env": "TRE_URL" + } + }, { "name": "id", "source": { diff --git a/templates/shared_services/airlock_notifier/porter.yaml b/templates/shared_services/airlock_notifier/porter.yaml index 82441a2490..34949fc315 100644 --- a/templates/shared_services/airlock_notifier/porter.yaml +++ b/templates/shared_services/airlock_notifier/porter.yaml @@ -1,6 +1,6 @@ --- name: tre-shared-service-airlock-notifier -version: 0.2.1 +version: 0.2.2 description: "A shared service notifying on Airlock Operations" registry: azuretre dockerfile: Dockerfile.tmpl @@ -19,6 +19,10 @@ parameters: - name: tre_id type: string description: "The ID of the parent TRE instance e.g., mytre-dev-3142" + - name: tre_url + type: string + description: "The URL of the parent TRE instance, e.g. https://mytre-dev-3142.uksouth.cloudapp.com" + default: "" - name: id type: string description: "Resource ID" @@ -63,6 +67,7 @@ install: vars: tre_id: "{{ bundle.parameters.tre_id }}" tre_resource_id: "{{ bundle.parameters.id }}" + tre_url: "{{ bundle.parameters.tre_url }}" smtp_server_address: "{{ bundle.parameters.smtp_server_address }}" smtp_username: "{{ bundle.parameters.smtp_username }}" smtp_password: "{{ bundle.parameters.smtp_password }}" @@ -113,6 +118,7 @@ uninstall: vars: tre_id: "{{ bundle.parameters.tre_id }}" tre_resource_id: "{{ bundle.parameters.id }}" + tre_url: "{{ bundle.parameters.tre_url }}" smtp_server_address: "{{ bundle.parameters.smtp_server_address }}" smtp_username: "{{ bundle.parameters.smtp_username }}" smtp_password: "{{ bundle.parameters.smtp_password }}" diff --git a/templates/shared_services/airlock_notifier/template_schema.json b/templates/shared_services/airlock_notifier/template_schema.json index ce4056ead6..7e9d386249 100644 --- a/templates/shared_services/airlock_notifier/template_schema.json +++ b/templates/shared_services/airlock_notifier/template_schema.json @@ -25,7 +25,8 @@ "type": "string", "title": "SMTP Password", "description": "SMTP Password", - "updateable": false + "updateable": false, + "sensitive": true }, "smtp_from_email": { "$id": "#/properties/smtp_from_email", @@ -33,6 +34,17 @@ "title": "SMTP From Email", "description": "SMTP From Email", "updateable": false + }, + "tre_url": { + "$id": "#/properties/tre_url", + "type": "string", + "title": "TRE URL", + "description": "If your TRE URL is different from ${TRE_ID}.${LOCATION}.cloudapp.azure.com, please enter it here", + "updateable": false, + "pattern": "^(https:|http:|www\\.)\\S*", + "examples": [ + "https://mytre.westeurope.cloudapp.azure.com" + ] } }, "pipeline": { diff --git a/templates/shared_services/airlock_notifier/terraform/airlock_notifier.tf b/templates/shared_services/airlock_notifier/terraform/airlock_notifier.tf index 8eabcce57d..db05ac8b29 100644 --- a/templates/shared_services/airlock_notifier/terraform/airlock_notifier.tf +++ b/templates/shared_services/airlock_notifier/terraform/airlock_notifier.tf @@ -94,6 +94,7 @@ resource "azurerm_logic_app_standard" "logic_app" { "resource_group" = data.azurerm_resource_group.core.name "smtp_connection_runtime_url" = jsondecode(azurerm_resource_group_template_deployment.smtp_api_connection.output_content).connectionRuntimeUrl.value "smtp_from_email" = var.smtp_from_email + "tre_url" = var.tre_url != "" ? var.tre_url : local.default_tre_url "APPLICATIONINSIGHTS_CONNECTION_STRING" = data.azurerm_application_insights.core.connection_string } site_config { @@ -118,10 +119,10 @@ resource "azurerm_resource_group_template_deployment" "smtp_api_connection_acces parameters_content = jsonencode({ "servicePrincipalId" = { - value = azurerm_logic_app_standard.logic_app.identity.0.principal_id + value = azurerm_logic_app_standard.logic_app.identity[0].principal_id }, "servicePrincipalTenantId" = { - value = azurerm_logic_app_standard.logic_app.identity.0.tenant_id + value = azurerm_logic_app_standard.logic_app.identity[0].tenant_id } }) diff --git a/templates/shared_services/airlock_notifier/terraform/locals.tf b/templates/shared_services/airlock_notifier/terraform/locals.tf index d7a51e8435..bcefd7f5d1 100644 --- a/templates/shared_services/airlock_notifier/terraform/locals.tf +++ b/templates/shared_services/airlock_notifier/terraform/locals.tf @@ -9,4 +9,5 @@ locals { tre_id = var.tre_id tre_shared_service_id = var.tre_resource_id } + default_tre_url = "https://${var.tre_id}.${data.azurerm_resource_group.core.location}.cloudapp.azure.com" } diff --git a/templates/shared_services/airlock_notifier/terraform/variables.tf b/templates/shared_services/airlock_notifier/terraform/variables.tf index 58ee2b894c..de9de1359c 100644 --- a/templates/shared_services/airlock_notifier/terraform/variables.tf +++ b/templates/shared_services/airlock_notifier/terraform/variables.tf @@ -8,6 +8,12 @@ variable "tre_resource_id" { description = "Resource ID" } +variable "tre_url" { + type = string + description = "TRE URL" + default = "" +} + variable "smtp_server_address" { type = string }