From 77c8a19b9f70f08d355cc1eb8133c2bb61309d39 Mon Sep 17 00:00:00 2001 From: Automatic Update Date: Thu, 9 Nov 2023 14:42:54 +0100 Subject: [PATCH 1/2] Change folder structure when creating files on StorageAccounts in LA --- .../s940/prod/logicapps/main.tf | 2 +- .../infrastructure/s941/dev/logicapps/main.tf | 71 ++++++++++++++++++- 2 files changed, 71 insertions(+), 2 deletions(-) diff --git a/terraform/infrastructure/s940/prod/logicapps/main.tf b/terraform/infrastructure/s940/prod/logicapps/main.tf index 4416b6296..3eca8aaa1 100644 --- a/terraform/infrastructure/s940/prod/logicapps/main.tf +++ b/terraform/infrastructure/s940/prod/logicapps/main.tf @@ -181,7 +181,7 @@ resource "azurerm_logic_app_action_custom" "create_blob" { method = "post", path = "/v2/datasets/@{encodeURIComponent(encodeURIComponent('${each.value["storageaccount"]}'))}/files", queries = { - folderPath = "/archive-log-analytics-${each.value["folder"]}/@{formatDateTime(utcNow(), 'yyyy-MM-dd')}", + folderPath = "/archive-log-analytics-${each.value["folder"]}/@{formatDateTime(utcNow(), 'yyyy')}/@{formatDateTime(utcNow(), 'MM')}/@{formatDateTime(utcNow(), 'dd')}", name = "@{subtractFromTime(formatDateTime(utcNow(),'yyyy-MM-ddTHH:00:00'), 1,'Hour')}", queryParametersSingleEncoded = true } diff --git a/terraform/infrastructure/s941/dev/logicapps/main.tf b/terraform/infrastructure/s941/dev/logicapps/main.tf index 4416b6296..5a60a5998 100644 --- a/terraform/infrastructure/s941/dev/logicapps/main.tf +++ b/terraform/infrastructure/s941/dev/logicapps/main.tf @@ -6,6 +6,14 @@ provider "azurerm" { features {} } +# locals { +# arm_file_path = jsondecode(file("arm.json")) +# } + +# data "template_file" "workflow" { +# template = file(local.arm_file_path) +# } + data "azurerm_managed_api" "azureblob" { name = "azureblob" location = var.AZ_LOCATION @@ -22,6 +30,7 @@ data "azurerm_user_assigned_identity" "managed_identity" { resource_group_name = each.value["rg_name"] } + resource "azurerm_logic_app_workflow" "logic_app_workflow" { for_each = var.logic_app_workflow name = each.value["name"] @@ -73,6 +82,7 @@ resource "azurerm_logic_app_workflow" "logic_app_workflow" { } } + resource "azurerm_logic_app_trigger_recurrence" "recurrence" { for_each = var.logic_app_workflow name = "Recurrence" @@ -181,7 +191,7 @@ resource "azurerm_logic_app_action_custom" "create_blob" { method = "post", path = "/v2/datasets/@{encodeURIComponent(encodeURIComponent('${each.value["storageaccount"]}'))}/files", queries = { - folderPath = "/archive-log-analytics-${each.value["folder"]}/@{formatDateTime(utcNow(), 'yyyy-MM-dd')}", + folderPath = "/archive-log-analytics-${each.value["folder"]}/@{formatDateTime(utcNow(), 'yyyy')}/@{formatDateTime(utcNow(), 'MM')}/@{formatDateTime(utcNow(), 'dd')}", name = "@{subtractFromTime(formatDateTime(utcNow(),'yyyy-MM-ddTHH:00:00'), 1,'Hour')}", queryParametersSingleEncoded = true } @@ -201,3 +211,62 @@ resource "azurerm_logic_app_action_custom" "create_blob" { ) } +# data "azurerm_resource_group" "example" { +# name = "logs-dev" +# } + +# resource "azurerm_storage_account" "example" { +# name = "archives941diagnostics" +# resource_group_name = data.azurerm_resource_group.example.name +# location = data.azurerm_resource_group.example.location +# account_tier = "Standard" +# account_replication_type = "LRS" +# } + +# resource "azurerm_service_plan" "example" { +# name = "archives941diagnostics-plan" +# resource_group_name = data.azurerm_resource_group.example.name +# location = data.azurerm_resource_group.example.location +# os_type = "Linux" +# sku_name = "WS1" +# } + +# resource "azurerm_logic_app_standard" "example" { +# name = "archive-s941-northeurope" +# location = data.azurerm_resource_group.example.location +# resource_group_name = data.azurerm_resource_group.example.name +# app_service_plan_id = azurerm_service_plan.example.id +# storage_account_name = azurerm_storage_account.example.name +# storage_account_access_key = azurerm_storage_account.example.primary_access_key +# version = "~4" + + + +# identity { +# identity_ids = [ +# #data.azurerm_user_assigned_identity.managed_identity[each.value["managed_identity_name"]].id +# data.azurerm_user_assigned_identity.managed_identity["id-radix-logicapp-operator-dev"].id +# ] +# type = "UserAssigned" +# } + + + +# app_settings = { +# "FUNCTIONS_WORKER_RUNTIME" = "node" +# "WEBSITE_NODE_DEFAULT_VERSION" = "~18" +# } +# } + +# resource "azurerm_logic_app_trigger_recurrence" "example" { +# name = "run-every-day" +# logic_app_id = azurerm_logic_app_standard.example.id +# frequency = "Day" +# interval = 1 +# } + +# resource "azurerm_logic_app_workflow" "example" { +# name = "workflow1" +# location = data.azurerm_resource_group.example.location +# resource_group_name = data.azurerm_resource_group.example.name +# } \ No newline at end of file From ef9bb9fde2ea87496e5633a262cf1b45f10434e0 Mon Sep 17 00:00:00 2001 From: Automatic Update Date: Fri, 10 Nov 2023 11:57:29 +0100 Subject: [PATCH 2/2] Remove sample --- .../infrastructure/s941/dev/logicapps/main.tf | 68 ------------------- terraform/radix-zone/radix_zone_dev.tfvars | 2 - 2 files changed, 70 deletions(-) diff --git a/terraform/infrastructure/s941/dev/logicapps/main.tf b/terraform/infrastructure/s941/dev/logicapps/main.tf index 5a60a5998..a9537cb3c 100644 --- a/terraform/infrastructure/s941/dev/logicapps/main.tf +++ b/terraform/infrastructure/s941/dev/logicapps/main.tf @@ -6,14 +6,6 @@ provider "azurerm" { features {} } -# locals { -# arm_file_path = jsondecode(file("arm.json")) -# } - -# data "template_file" "workflow" { -# template = file(local.arm_file_path) -# } - data "azurerm_managed_api" "azureblob" { name = "azureblob" location = var.AZ_LOCATION @@ -210,63 +202,3 @@ resource "azurerm_logic_app_action_custom" "create_blob" { } ) } - -# data "azurerm_resource_group" "example" { -# name = "logs-dev" -# } - -# resource "azurerm_storage_account" "example" { -# name = "archives941diagnostics" -# resource_group_name = data.azurerm_resource_group.example.name -# location = data.azurerm_resource_group.example.location -# account_tier = "Standard" -# account_replication_type = "LRS" -# } - -# resource "azurerm_service_plan" "example" { -# name = "archives941diagnostics-plan" -# resource_group_name = data.azurerm_resource_group.example.name -# location = data.azurerm_resource_group.example.location -# os_type = "Linux" -# sku_name = "WS1" -# } - -# resource "azurerm_logic_app_standard" "example" { -# name = "archive-s941-northeurope" -# location = data.azurerm_resource_group.example.location -# resource_group_name = data.azurerm_resource_group.example.name -# app_service_plan_id = azurerm_service_plan.example.id -# storage_account_name = azurerm_storage_account.example.name -# storage_account_access_key = azurerm_storage_account.example.primary_access_key -# version = "~4" - - - -# identity { -# identity_ids = [ -# #data.azurerm_user_assigned_identity.managed_identity[each.value["managed_identity_name"]].id -# data.azurerm_user_assigned_identity.managed_identity["id-radix-logicapp-operator-dev"].id -# ] -# type = "UserAssigned" -# } - - - -# app_settings = { -# "FUNCTIONS_WORKER_RUNTIME" = "node" -# "WEBSITE_NODE_DEFAULT_VERSION" = "~18" -# } -# } - -# resource "azurerm_logic_app_trigger_recurrence" "example" { -# name = "run-every-day" -# logic_app_id = azurerm_logic_app_standard.example.id -# frequency = "Day" -# interval = 1 -# } - -# resource "azurerm_logic_app_workflow" "example" { -# name = "workflow1" -# location = data.azurerm_resource_group.example.location -# resource_group_name = data.azurerm_resource_group.example.name -# } \ No newline at end of file diff --git a/terraform/radix-zone/radix_zone_dev.tfvars b/terraform/radix-zone/radix_zone_dev.tfvars index 5346c77e7..e01d80f8a 100644 --- a/terraform/radix-zone/radix_zone_dev.tfvars +++ b/terraform/radix-zone/radix_zone_dev.tfvars @@ -239,7 +239,6 @@ sql_server = { name = "sql-radix-cost-allocation-dev" rg_name = "cost-allocation" db_admin = "radix-cost-allocation-db-admin" - minimum_tls_version = "Disabled" vault = "radix-vault-dev" tags = { "displayName" = "SqlServer" @@ -249,7 +248,6 @@ sql_server = { name = "sql-radix-cost-allocation-playground" rg_name = "cost-allocation" db_admin = "radix-cost-allocation-db-admin-playground" - minimum_tls_version = "Disabled" vault = "radix-vault-dev" tags = { "displayName" = "SqlServer"