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

[#IOPID-2001] Appinsight connection string fn-lollipop #1057

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
22 changes: 18 additions & 4 deletions src/domains/citizen-auth-app/04_function_lollipop.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ data "azurerm_key_vault_secret" "first_lollipop_consumer_subscription_key" {
}

locals {
function_name = format("%s-lollipop-fn-01", local.common_project_itn)

function_lollipop = {
app_settings = {
FUNCTIONS_WORKER_PROCESS_COUNT = 4
Expand Down Expand Up @@ -44,6 +46,16 @@ locals {
// -------------------------
FIRST_LC_ASSERTION_CLIENT_BASE_URL = "https://api.io.pagopa.it"
FIRST_LC_ASSERTION_CLIENT_SUBSCRIPTION_KEY = data.azurerm_key_vault_secret.first_lollipop_consumer_subscription_key.value

# APPINSIGHTS
APPLICATIONINSIGHTS_CONNECTION_STRING = data.azurerm_application_insights.application_insights.connection_string
// NOTE: the following variable ensures that the applicationinsights
// nodejs sdk doesn't include additional headers towards requests on all
// type of storage accounts. without the following, all requests would
// fail for an unexpected signature from the storage account. to support
// the storage-account calls, a migration from `azure-storage` to
// `@azure/...` sdks is needed (see https://www.npmjs.com/package/diagnostic-channel-publishers/v/1.0.8#currently-supported-modules)
APPINSIGHTS_EXCLUDED_DOMAINS = "queue.core.windows.net,blob.core.windows.net,table.core.windows.net,file.core.windows.net"
}

# Scaling strategy
Expand Down Expand Up @@ -153,7 +165,7 @@ module "function_lollipop_itn" {
source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//function_app?ref=v8.22.0"

resource_group_name = azurerm_resource_group.lollipop_rg_itn.name
name = format("%s-lollipop-fn-01", local.common_project_itn)
name = local.function_name
location = local.itn_location
domain = "IO-COMMONS"
health_check_path = "/info"
Expand Down Expand Up @@ -184,10 +196,11 @@ module "function_lollipop_itn" {

app_settings = merge(
local.function_lollipop.app_settings,
{ "AzureWebJobs.HandlePubKeyRevoke.Disabled" = "0" },
{ "AzureWebJobs.HandlePubKeyRevoke.Disabled" = "0",
APPINSIGHTS_CLOUD_ROLE_NAME = local.function_name },
)

sticky_app_setting_names = ["AzureWebJobs.HandlePubKeyRevoke.Disabled"]
sticky_app_setting_names = ["AzureWebJobs.HandlePubKeyRevoke.Disabled", "APPINSIGHTS_CLOUD_ROLE_NAME"]

internal_storage = {
"enable" = true,
Expand Down Expand Up @@ -234,7 +247,8 @@ module "function_lollipop_staging_slot_itn" {

app_settings = merge(
local.function_lollipop.app_settings,
{ "AzureWebJobs.HandlePubKeyRevoke.Disabled" = "1" },
{ "AzureWebJobs.HandlePubKeyRevoke.Disabled" = "1",
APPINSIGHTS_CLOUD_ROLE_NAME = "${module.function_lollipop_itn.name}-staging" },
)

subnet_id = azurerm_subnet.lollipop_snet_itn.id
Expand Down
Loading