Skip to content

Commit 80e93aa

Browse files
authored
Merge branch 'main' into dependabot/npm_and_yarn/rollup/plugin-node-resolve-16.0.3
2 parents 00badda + ae5619d commit 80e93aa

File tree

21 files changed

+654
-80
lines changed

21 files changed

+654
-80
lines changed

.env.example

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
DEBUG=True
22
SECRET_KEY=somesercetkey
3-
DATABASE_URL=
43
ALLOWED_HOSTS=localhost,127.0.0.1
54

6-
POSTGRES_HOST=db
5+
DATABASE_HOST=db
6+
DATABASE_NAME=lung_cancer_screening
7+
DATABASE_USER=lung_cancer_screening
8+
DATABASE_PASSWORD=password
9+
10+
# Required to provision development / test postgres container
711
POSTGRES_DB=lung_cancer_screening
812
POSTGRES_USER=lung_cancer_screening
913
POSTGRES_PASSWORD=password

.github/workflows/test-deploy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ jobs:
3939
terraform_version: 1.11.4
4040

4141
- name: Terraform plan
42-
run: make ${TARGET_ENV} ci terraform-apply
42+
run: make ${TARGET_ENV} ci terraform-apply DOCKER_IMAGE_TAG=git-sha-${{ github.sha }}

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13.7

infrastructure/environments/poc/variables.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ STORAGE_ACCOUNT_RG=rg-tfstate-poc-uks
66
TERRAFORM_MODULES_REF=main
77
ENABLE_SOFT_DELETE=false
88
DOCKER_IMAGE=ghcr.io/nhsdigital/lung_cancer_screening
9-
DOCKER_IMAGE_TAG=PPHA-369-build-and-push-doker-image-to-gchr

infrastructure/environments/poc/variables.tfvars

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ features = {
44
hub_and_spoke = false
55
private_networking = false
66
}
7+
fetch_secrets_from_app_key_vault = true
8+
github_mi_name = "mi-lungcs-poc-ghtoaz-uks"
9+
key_vault_secrets_officer_groups = ["Azure-Lung-Cancer-Screening---Dev-Owner"]
710
postgres_backup_retention_days = 7
811
postgres_geo_redundant_backup_enabled = false
912
protect_keyvault = false
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
module "db_setup" {
2+
source = "../dtos-devops-templates/infrastructure/modules/container-app-job"
3+
4+
name = "${var.app_short_name}-dbm-${var.environment}"
5+
container_app_environment_id = var.container_app_environment_id
6+
resource_group_name = azurerm_resource_group.main.name
7+
8+
container_command = ["/bin/sh", "-c"]
9+
10+
container_args = [
11+
"python manage.py migrate"
12+
]
13+
secret_variables = var.deploy_database_as_container ? { DATABASE_PASSWORD = resource.random_password.admin_password[0].result } : {}
14+
docker_image = var.docker_image
15+
user_assigned_identity_ids = flatten([
16+
[module.azure_blob_storage_identity.id],
17+
[module.azure_queue_storage_identity.id],
18+
var.deploy_database_as_container ? [] : [module.db_connect_identity[0].id]
19+
])
20+
environment_variables = merge(
21+
local.common_env,
22+
var.deploy_database_as_container ? local.container_db_env : local.azure_db_env
23+
)
24+
depends_on = [
25+
module.queue_storage_role_assignment,
26+
module.blob_storage_role_assignment
27+
]
28+
29+
}

infrastructure/modules/container-apps/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module "webapp" {
1717
fetch_secrets_from_app_key_vault = var.fetch_secrets_from_app_key_vault
1818
infra_key_vault_name = "kv-${var.app_short_name}-${var.env_config}-inf"
1919
infra_key_vault_rg = "rg-${var.app_short_name}-${var.env_config}-infra"
20-
enable_auth = var.enable_auth
20+
enable_entra_id_authentication = var.enable_entra_id_authentication
2121
app_key_vault_id = var.app_key_vault_id
2222
docker_image = var.docker_image
2323
user_assigned_identity_ids = var.deploy_database_as_container ? [] : [module.db_connect_identity[0].id]

infrastructure/modules/container-apps/storage.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ module "storage" {
3232
private_endpoint_resource_group_name = azurerm_resource_group.main.name
3333
private_service_connection_is_manual = false
3434
} : null
35-
queues = local.storage_queues
36-
resource_group_name = azurerm_resource_group.main.name
35+
36+
public_network_access_enabled = !var.features.private_networking
37+
queues = local.storage_queues
38+
resource_group_name = azurerm_resource_group.main.name
3739
}
3840

3941
module "blob_storage_role_assignment" {

infrastructure/modules/container-apps/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ variable "docker_image" {
3535
type = string
3636
}
3737

38-
variable "enable_auth" {
38+
variable "enable_entra_id_authentication" {
3939
description = "Enable authentication for the container app. If true, the app will use Azure AD authentication."
4040
type = bool
4141
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
data "azuread_service_principal" "github-mi" {
2+
display_name = var.github_mi_name
3+
}
4+
5+
data "azuread_group" "kv_officers" {
6+
for_each = toset(var.key_vault_secrets_officer_groups)
7+
8+
display_name = each.value
9+
}

0 commit comments

Comments
 (0)