File tree Expand file tree Collapse file tree
infrastructure/modules/container-apps Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,3 +27,37 @@ module "db_setup" {
2727 ]
2828
2929}
30+
31+ module "flush_database" {
32+ source = " ../dtos-devops-templates/infrastructure/modules/container-app-job"
33+ # We need to be able to flush the db on a daily basis in POC to ensure
34+ # We can test the service in a clean state. DO NOT ADD THIS TO OTHER ENVIRONMENTS.
35+ count = var. environment == " poc" ? 1 : 0
36+
37+ name = " ${ var . app_short_name } -flush-db-${ var . environment } "
38+ container_app_environment_id = var. container_app_environment_id
39+ resource_group_name = azurerm_resource_group. main . name
40+
41+ container_command = [" /bin/sh" , " -c" ]
42+
43+ container_args = [
44+ " python manage.py flush"
45+ ]
46+ cron_expression = " 0 6 * * *" # Run at 6am every day
47+ secret_variables = var. deploy_database_as_container ? { DATABASE_PASSWORD = resource.random_password.admin_password[0 ].result } : {}
48+ docker_image = var. docker_image
49+ user_assigned_identity_ids = flatten ([
50+ [module . azure_blob_storage_identity . id ],
51+ [module . azure_queue_storage_identity . id ],
52+ var . deploy_database_as_container ? [] : [module . db_connect_identity [0 ]. id ]
53+ ])
54+ environment_variables = merge (
55+ local. common_env ,
56+ var. deploy_database_as_container ? local. container_db_env : local. azure_db_env
57+ )
58+ depends_on = [
59+ module . queue_storage_role_assignment ,
60+ module . blob_storage_role_assignment
61+ ]
62+
63+ }
You can’t perform that action at this time.
0 commit comments