generated from nhs-england-tools/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: drop-1 infrastructure added (#3)
<!-- markdownlint-disable-next-line first-line-heading --> ## Description <!-- Describe your changes in detail. --> ## Context <!-- Why is this change required? What problem does it solve? --> ## Type of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply. --> - [ ] Refactoring (non-breaking change) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would change existing functionality) - [ ] Bug fix (non-breaking change which fixes an issue) ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply. --> - [x] I am familiar with the [contributing guidelines](../docs/CONTRIBUTING.md) - [x] I have followed the code style of the project - [ ] I have added tests to cover my changes - [ ] I have updated the documentation accordingly - [ ] This PR is a result of pair or mob programming --- ## Sensitive Information Declaration To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including [PII (Personal Identifiable Information) / PID (Personal Identifiable Data)](https://digital.nhs.uk/data-and-information/keeping-data-safe-and-benefitting-the-public) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter. - [x] I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes. --------- Co-authored-by: Maciej Murawski <[email protected]>
- Loading branch information
1 parent
97f2bba
commit 298bdc6
Showing
36 changed files
with
1,073 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module "app-plan" { | ||
source = ".//modules/app-service-plan" | ||
|
||
names = module.config.names | ||
resource_group_name = module.baseline.resource_group_names[var.app_service_plan.resource_group_index] | ||
location = module.baseline.resource_group_locations[var.app_service_plan.resource_group_index] | ||
|
||
os_type = var.app_service_plan.os_type | ||
sku_name = var.app_service_plan.sku_name | ||
|
||
tags = var.tags | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
terraform { | ||
backend "azurerm" { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module "baseline" { | ||
source = ".//modules/baseline" | ||
|
||
location = var.location | ||
names = module.config.names | ||
tags = var.tags | ||
resource_groups = var.resource_groups | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
application = "DToS" | ||
environment = "DEV" | ||
location = "uksouth" | ||
|
||
tags = { | ||
Project = "DToS" | ||
} | ||
|
||
resource_groups = { | ||
|
||
# Baseline RG | ||
baseline = { | ||
|
||
name = "rg-dtos-dev-suk-baseline" | ||
# Is is worth leaving location as a parameter for RG? | ||
# location = "uksouth" | ||
} | ||
|
||
} | ||
|
||
storage_accounts = { | ||
|
||
fnapp = { | ||
name_suffix = "fnappstor" | ||
resource_group_index = "baseline" | ||
account_tier = "Standard" | ||
replication_type = "LRS" | ||
public_network_access_enabled = true | ||
} | ||
|
||
} | ||
|
||
key_vault = { | ||
|
||
#name_suffix = "" | ||
resource_group_index = "baseline" | ||
disk_encryption = true | ||
soft_del_ret_days = 7 | ||
purge_prot = false | ||
sku_name = "standard" | ||
|
||
} | ||
|
||
sqlserver = { | ||
|
||
#name_suffix = "" | ||
resource_group_index = "baseline" | ||
sqlversion = "12.0" | ||
tlsversion = 1.2 | ||
|
||
# Baseline database | ||
db_name_suffix = "baseline" | ||
collation = "SQL_Latin1_General_CP1_CI_AS" | ||
licence_type = "LicenseIncluded" | ||
max_gb = 5 | ||
read_scale = false | ||
sku = "S0" | ||
|
||
} | ||
|
||
app_service_plan = { | ||
|
||
|
||
resource_group_index = "baseline" | ||
|
||
sku_name = "B1" | ||
os_type = "Windows" | ||
|
||
} | ||
|
||
function_app = { | ||
|
||
resource_group_index = "baseline" | ||
|
||
fa_config = { | ||
|
||
receiveCaasFile = { | ||
name_suffix = "receiveCaasFile" | ||
} | ||
|
||
ProcessCaasFile = { | ||
name_suffix = "ProcessCaasFile" | ||
} | ||
|
||
AddNewParticipant = { | ||
name_suffix = "AddNewParticipant" | ||
} | ||
|
||
MarkParticipantAsIneligible = { | ||
name_suffix = "MarkParticipantAsIneligible" | ||
} | ||
|
||
CreateParticipantDS = { | ||
name_suffix = "CreateParticipantDS" | ||
} | ||
|
||
MarkParticipantEligibleDS = { | ||
name_suffix = "MarkParticipantEligibleDS" | ||
} | ||
|
||
MarkParticipantIneligibleDS = { | ||
name_suffix = "MarkParticipantIneligibleDS" | ||
} | ||
|
||
UpdateParticipant = { | ||
name_suffix = "UpdateParticipant" | ||
} | ||
|
||
UpdateParticipantDS = { | ||
name_suffix = "UpdateParticipantDS" | ||
} | ||
|
||
BusinessAuditDS = { | ||
name_suffix = "BusinessAuditDS" | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
event_grid = { | ||
|
||
topic = { | ||
|
||
resource_group_index = "baseline" | ||
name_suffix = "baseline" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module "eventgrid" { | ||
source = ".//modules/event-grid" | ||
|
||
names = module.config.names | ||
|
||
resource_group_name = module.baseline.resource_group_names[var.event_grid.topic.resource_group_index] | ||
location = module.baseline.resource_group_locations[var.event_grid.topic.resource_group_index] | ||
|
||
name_suffix = var.event_grid.topic.name_suffix | ||
|
||
tags = var.tags | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
module "functionapp" { | ||
source = ".//modules/function-app" | ||
|
||
names = module.config.names | ||
|
||
function_app = var.function_app.fa_config | ||
resource_group_name = module.baseline.resource_group_names[var.function_app.resource_group_index] | ||
location = module.baseline.resource_group_locations[var.function_app.resource_group_index] | ||
|
||
asp_id = module.app-plan.app_service_plan_id | ||
sa_name = module.storage.storage_account_name | ||
sa_prm_key = module.storage.storage_account_primary_access_key | ||
|
||
tags = var.tags | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module "key_vault" { | ||
source = ".//modules/key-vault" | ||
|
||
names = module.config.names | ||
resource_group_name = module.baseline.resource_group_names[var.key_vault.resource_group_index] | ||
location = module.baseline.resource_group_locations[var.key_vault.resource_group_index] | ||
disk_encryption = var.key_vault.disk_encryption | ||
soft_delete_retention = var.key_vault.soft_del_ret_days | ||
purge_protection_enabled = var.key_vault.purge_prot | ||
sku_name = var.key_vault.sku_name | ||
|
||
tags = var.tags | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
resource "azurerm_service_plan" "appserviceplan" { | ||
|
||
name = var.names.app-service-plan | ||
resource_group_name = var.resource_group_name | ||
location = var.location | ||
|
||
os_type = var.os_type | ||
sku_name = var.sku_name | ||
|
||
tags = var.tags | ||
|
||
lifecycle { | ||
ignore_changes = [tags] | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
output "app_service_plan_name" { | ||
value = azurerm_service_plan.appserviceplan.name | ||
} | ||
|
||
output "app_service_plan_id" { | ||
value = azurerm_service_plan.appserviceplan.id | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
variable "resource_group_name" { | ||
type = string | ||
description = "The name of the resource group in which to create the App Service Plan. Changing this forces a new resource to be created." | ||
} | ||
|
||
variable "location" { | ||
type = string | ||
description = "The location/region where the App Service Plan is created." | ||
} | ||
|
||
variable "names" { | ||
type = map(string) | ||
description = "Standard naming configuration object for sub-resources." | ||
} | ||
|
||
variable "os_type" { | ||
type = string | ||
description = "OS type for deployed App Service Plan." | ||
default = "Windows" | ||
} | ||
|
||
variable "sku_name" { | ||
type = string | ||
description = "SKU name for deployed App Service Plan." | ||
default = "B1" | ||
} | ||
variable "tags" { | ||
type = map(string) | ||
description = "Resource tags to be applied throughout the deployment." | ||
default = {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
resource "azurerm_mssql_database" "defaultdb" { | ||
name = "${var.names.sql-server-db}-${var.db_name_suffix}" | ||
server_id = azurerm_mssql_server.sqlserver.id | ||
collation = var.collation | ||
license_type = var.licence_type | ||
max_size_gb = var.max_gb | ||
read_scale = var.read_scale | ||
sku_name = var.sku | ||
|
||
tags = var.tags | ||
|
||
lifecycle { | ||
ignore_changes = [tags] | ||
# prevent the possibility of accidental data loss | ||
prevent_destroy = true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
|
||
resource "azurerm_key_vault_secret" "sqllogin" { | ||
name = "az-sql-login" | ||
value = "sqldtosadmin" | ||
key_vault_id = var.kv_id | ||
|
||
lifecycle { | ||
ignore_changes = [tags] | ||
} | ||
} | ||
|
||
## Random administrator password | ||
resource "random_password" "randompass" { | ||
length = 16 | ||
special = true | ||
} | ||
|
||
resource "azurerm_key_vault_secret" "sqlpass" { | ||
name = "az-sql-pass" | ||
value = random_password.randompass.result | ||
key_vault_id = var.kv_id | ||
|
||
lifecycle { | ||
ignore_changes = [tags] | ||
} | ||
} | ||
|
||
resource "azurerm_mssql_server" "sqlserver" { | ||
name = var.names.sql-server | ||
resource_group_name = var.resource_group_name | ||
location = var.location | ||
version = var.sqlversion | ||
administrator_login = azurerm_key_vault_secret.sqllogin.value | ||
administrator_login_password = azurerm_key_vault_secret.sqlpass.value | ||
minimum_tls_version = var.tlsver | ||
|
||
tags = var.tags | ||
|
||
lifecycle { | ||
ignore_changes = [tags] | ||
} | ||
} |
Oops, something went wrong.