Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new storage container for config #232

Merged
merged 3 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion azure_functions/src/functions/caDphTimerTrigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export async function caDphTimerTrigger(myTimer: Timer, context: InvocationConte
// We set the visibility timeout for the message on reading, in queue.go
// messageTimeToLive of -1 means the message does not expire
// the queue message contents will (in future) be the key to client-specific config
const sendMessageResponse = await queueClient.sendMessage("cadph", {messageTimeToLive: -1})
// The message we send here must match the key in config, the scope in report_stream_sender, and the org name in RS
const sendMessageResponse = await queueClient.sendMessage("ca-phl", {messageTimeToLive: -1})
console.log("Sent message successfully, service assigned message Id:", sendMessageResponse.messageId, "service assigned request Id:", sendMessageResponse.requestId );

context.log('Timer function processed request.');
Expand Down
8 changes: 8 additions & 0 deletions config/local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"ca-phl": {
"shouldFetch": true
},
"flexion": {
"shouldFetch": true
}
}
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ services:
- /bin/sh
- -c
- |
az storage container create -n config
az storage container create -n sftp
az storage blob upload --overwrite --account-name devstoreaccount1 --container-name sftp --name import/order_message.hl7 --file mock_data/order_message.hl7
az storage blob upload --overwrite --account-name devstoreaccount1 --container-name config --name config.json --file config/local.json
az storage queue create -n message-import-queue
az storage queue create -n message-import-dead-letter-queue
az storage queue create -n polling-trigger-queue
Expand Down
11 changes: 10 additions & 1 deletion operations/template/storage.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,25 @@ resource "azurerm_storage_account_customer_managed_key" "storage_storage_account
] //wait for the permission that allows our deployer to write the secret
}


resource "azurerm_storage_container" "sftp_container" {
name = "sftp"
storage_account_name = azurerm_storage_account.storage.name
container_access_type = "private"
}

// Used in case of event dead letter
resource "azurerm_storage_container" "sftp_container_dead_letter" {
name = "sftp-dead-letter"
storage_account_name = azurerm_storage_account.storage.name
container_access_type = "private"
}

resource "azurerm_storage_container" "config_container" {
somesylvie marked this conversation as resolved.
Show resolved Hide resolved
name = "config"
storage_account_name = azurerm_storage_account.storage.name
container_access_type = "private"
}

resource "azurerm_role_assignment" "allow_app_read_write" {
scope = azurerm_storage_account.storage.id
role_definition_name = "Storage Blob Data Contributor"
Expand All @@ -70,6 +76,9 @@ resource "azurerm_storage_management_policy" "retention_policy" {

filters {
blob_types = ["blockBlob", "appendBlob"]
// Only apply the retention policy to the SFTP containers so that we don't delete our config
// Any containers that may contain PHI **must** be included in this prefix_match list
prefix_match = ["sftp/", "sftp-dead-letter/"]
}

actions {
Expand Down