Skip to content

Commit b82f1ef

Browse files
committed
Added terraform for SQL Managed Instance
1 parent 8848d40 commit b82f1ef

4 files changed

Lines changed: 66 additions & 5 deletions

File tree

.github/workflows/ContinousIntegration.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33

44
name: continous integration messagequeueprocessor
55

6-
# on:
7-
# push:
8-
# branches:
9-
# - CI
6+
on:
7+
workflow_dispatch:
8+
109

1110
jobs:
1211
build:

.github/workflows/MessageQueueProcessor_deploy_dev.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,14 @@ jobs:
4545
cd LearningHub.Nhs.MessageQueueProcessor/Terraform
4646
terraform apply -auto-approve `
4747
-var="ResourceGroupName=${{ vars.AZURE_RESOURCE_GROUP_NAME }}" `
48-
-var="ResourceGroupLocation=${{ vars.AZURE_RESOURCE_GROUP_LOCATION }}"
48+
-var="ResourceGroupLocation=${{ vars.AZURE_RESOURCE_GROUP_LOCATION }}" `
49+
-var="SqlmiName=${{ vars.SQLMI_NAME }}" `
50+
-var="SQLAdministratorLogin=${{ vars.SQL_ADMINISTRATOR_LOGIN }}" `
51+
-var="SQLAdministratorLoginPassword${{ }}" `
52+
-var "SQLSkuName${{ vars.SQL_SKU_NAME }}" `
53+
-var "SQLStorageSize${{ vars.SQL_STORAGE_SIZE }}" `
54+
-var "SQLVcores${{ vars.SQL_VCORES }}" `
55+
-var "Environment=Development"
4956
5057
build_and_deploy:
5158
needs: terraform

LearningHub.Nhs.MessageQueueProcessor/Terraform/main.tf

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,31 @@ resource "azurerm_function_app" "MessageQueueProcessorFunctionApp" {
4141
FUNCTIONS_WORKER_RUNTIME = "dotnet-isolated"
4242
DOTNET_VERSION = "8.0"
4343
}
44+
}
45+
46+
resource "azurerm_mssql_managed_instance" "sqlmi" {
47+
name = var.SqlmiName
48+
resource_group_name = azurerm_resource_group.learningHubMoodleResourceGroup.name
49+
location = azurerm_resource_group.learningHubMoodleResourceGroup.location
50+
license_type = "BasePrice"
51+
administrator_login = var.SQLAdministratorLogin
52+
administrator_login_password = var.SQLAdministratorLoginPassword
53+
subnet_id = azurerm_subnet.subnet.id
54+
sku_name = var.SQLSkuName
55+
storage_size_in_gb = var.SQLStorageSize
56+
vcores = var.SQLVcores
57+
tags = {
58+
environment = var.Environment
59+
}
60+
identity {
61+
type = "SystemAssigned"
62+
}
63+
lifecycle {
64+
prevent_destroy = true
65+
}
66+
}
67+
68+
resource "azurerm_mssql_managed_database" "sqldb" {
69+
name = "GovNotifyMessage"
70+
managed_instance_id = azurerm_mssql_managed_instance.sqlmi.id
4471
}

LearningHub.Nhs.MessageQueueProcessor/Terraform/variables.tf

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,32 @@ variable "ResourceGroupName" {
44

55
variable "ResourceGroupLocation" {
66
type = string
7+
}
8+
9+
variable "SqlmiName" {
10+
type = string
11+
}
12+
13+
variable "SQLAdministratorLogin" {
14+
type = string
15+
}
16+
17+
variable "SQLAdministratorLoginPassword" {
18+
type = string
19+
}
20+
21+
variable "SQLSkuName" {
22+
type = string
23+
}
24+
25+
variable "SQLStorageSize" {
26+
type = string
27+
}
28+
29+
variable "SQLVcores" {
30+
type = string
31+
}
32+
33+
variable "Environment" {
34+
type = string
735
}

0 commit comments

Comments
 (0)