diff --git a/src/matteo/.terraform.lock.hcl b/src/matteo/.terraform.lock.hcl deleted file mode 100644 index 192bed38..00000000 --- a/src/matteo/.terraform.lock.hcl +++ /dev/null @@ -1,116 +0,0 @@ -# This file is maintained automatically by "terraform init". -# Manual edits may be lost in future updates. - -provider "registry.terraform.io/hashicorp/azuread" { - version = "2.32.0" - constraints = "> 2.10.0" - hashes = [ - "h1:K3uwNf+SJV7Ie1bhYQJ44ERM5CK48GZtwgrSrWLBO5o=", - "h1:RCsaMs2+E0ov7vIq9bSUoDShaFbKRhNyliWK0GIaRU0=", - "h1:Sy8OYYyzuRrcXs+Gat/CVgJPuIuq67QnuHKygY+w8Fc=", - "h1:aiu96Ca8j2q7J6Z/S+MOuVchJ0zhvY6YO33b6LHRvIQ=", - "zh:1142c8f1e4a51467997ecbd218661b7bc365e2a46cd1c0cf2a17045d0943f73b", - "zh:1c3e89cf19118fc07d7b04257251fc9897e722c16e0a0df7b07fcd261f8c12e7", - "zh:6733af76a0e8473d62d11fb855aa5d823ad9eee75ea0cc508b63cf0782f2b30b", - "zh:777f13db12b2820112f05e5728ad69901b2e8de9a63bfae081370c92dbc4e70b", - "zh:7c357e89acb549341dc276430ed7caf6c5f90abf282b55a90d2ed05f63f358e2", - "zh:7cc5ef7b97f9e632728b04c0f12d7f4b5c3ed123664b775d1857589ba079ebac", - "zh:9405827a7fb475629e99feefd4a11d25fee4a3e730d724d1e0090fb80cc4d85d", - "zh:a4ed113615fdc25ccb5349300f36f8eca0c490232c6dab6a45447642f8d4fea1", - "zh:e61c96da855b06eafab100941d70a65c5971d479a8812bf2d3998f6300e26095", - "zh:ea51577835d845ff4536ed1c3208d0ff54017d847d719a3e7b485ff7b7f7ba11", - "zh:ed8de8b088c6abb3bf4a47f37dd34e60c321d9f96f1b787f8ac2e9a3c8eb1e28", - "zh:fcc37e75e1a782379378a51e7a8fb5f103c1016cb5a4b186eb9c7e5f77f07008", - ] -} - -provider "registry.terraform.io/hashicorp/azurerm" { - version = "2.99.0" - constraints = ">= 2.80.0, >= 2.99.0, 2.99.0, <= 2.99.0" - hashes = [ - "h1:/M8yLHqv0uOm9IbHRa4yZvQORr9ir1QyJyIyjGs4ryQ=", - "h1:/ZY1j8YgB5GeqPnjT8avyRFjUcGH3rCk1xGLKcUCtWc=", - "h1:FXBB5TkvZpZA+ZRtofPvp5IHZpz4Atw7w9J8GDgMhvk=", - "h1:aCGPSDzEWQZLeWmUeSnXA6sDHMumbDqOVdSVKVziYoE=", - "zh:08d81e72e97351538ab4d15548942217bf0c4d3b79ad3f4c95d8f07f902d2fa6", - "zh:11fdfa4f42d6b6f01371f336fea56f28a1db9e7b490c5ca0b352f6bbca5a27f1", - "zh:12376e2c4b56b76098d5d713d1a4e07e748a926c4d165f0bd6f52157b1f7a7e9", - "zh:31f1cb5b88ed1307625050e3ee7dd9948773f522a3f3bf179195d607de843ea3", - "zh:767971161405d38412662a73ea40a422125cdc214c72fbc569bcfbea6e66c366", - "zh:973c402c3728b68c980ea537319b703c009b902a981b0067fbc64e04a90e434c", - "zh:9ec62a4f82ec1e92bceeff80dd8783f61de0a94665c133f7c7a7a68bda9cdbd6", - "zh:bbb3b7e1229c531c4634338e4fc81b28bce58312eb843a931a4420abe42d5b7e", - "zh:cbbe02cd410d21476b3a081b5fa74b4f1b3d9d79b00214009028d60e859c19a3", - "zh:cc00ecc7617a55543b60a0da1196ea92df48c399bcadbedf04c783e3d47c6e08", - "zh:eecb9fd0e7509c7fd4763e546ef0933f125770cbab2b46152416e23d5ec9dd53", - ] -} - -provider "registry.terraform.io/hashicorp/helm" { - version = "2.8.0" - constraints = ">= 2.0.0, >= 2.4.1" - hashes = [ - "h1:SAwW8iYsXVDhCs8UL5ElzfN6iP3q3tdObPwJiTpCkKI=", - "h1:U0w0mUT0SwZCR0poGNSxGaZJKWcOiu4GerpGztYBiMM=", - "h1:a98mBNghv9odh5PVmgdXapgyYJmO/ncAWkwLWdXLuY4=", - "h1:abRryu69lsIGXctqjMVoaKqi74eE12Vzd2FLpds1/PI=", - "zh:1e42d1a04c07d4006844e477ca32b5f45b04f6525dbbbe00b6be6e6ec5a11c54", - "zh:2f87187cb48ccfb18d12e2c4332e7e822923b659e7339b954b7db78aff91529f", - "zh:391fe49b4d2dc07bc717248a3fc6952189cfc49c596c514ad72a29c9a9f9d575", - "zh:89272048e1e63f3edc3e83dfddd5a9fd4bd2a4ead104e67de1e14319294dedf1", - "zh:a5a057c3435a854389ce8a1d98a54aaa7cbab68aca7baa436a605897aa70ff7e", - "zh:b1098e53e1a8a3afcd325ecd0328662156b3d9c3d80948f19ba3a4eb870cee2b", - "zh:b676f949e8274a2b6c3fa41f5428ea597125579c7b93bb50bb73a5e295a7a447", - "zh:cdf7e9460f28c2dbfe49a79a5022bd0d474ff18120d340738aa35456ba77ebca", - "zh:e24b59b4ed1c593facbf8051ec58550917991e2e017f3085dac5fb902d9908cb", - "zh:e3b5e1f5543cac9d9031a028f1c1be4858fb80fae69f181f21e9465e366ebfa2", - "zh:e9fddc0bcdb28503078456f0088851d45451600d229975fd9990ee92c7489a10", - "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c", - ] -} - -provider "registry.terraform.io/hashicorp/kubernetes" { - version = "2.16.1" - constraints = ">= 2.7.0" - hashes = [ - "h1:O23HBuu2cPnLfW/lqvMM6eAeVx7eZgjqsK+Nz/FX2Gg=", - "h1:PO4Ye/+lu5hCaUEOtwNOldQYoA0dqL1bcBICIpdlcd8=", - "h1:i+DwtJK82sIWmTcQA9lL0mlET+14/QpUqv10fU2o3As=", - "h1:kO/d+ZMZYM2tNMMFHZqBmVR0MeemoGnI2G2NSN92CrU=", - "zh:06224975f5910d41e73b35a4d5079861da2c24f9353e3ebb015fbb3b3b996b1c", - "zh:2bc400a8d9fe7755cca27c2551564a9e2609cfadc77f526ef855114ee02d446f", - "zh:3a479014187af1d0aec3a1d3d9c09551b801956fe6dd29af1186dec86712731b", - "zh:73fb0a69f1abdb02858b6589f7fab6d989a0f422f7ad95ed662aaa84872d3473", - "zh:a33852cd382cbc8e06d3f6c018b468ad809d24d912d64722e037aed1f9bf39db", - "zh:b533ff2214dca90296b1d22eace7eaa7e3efe5a7ae9da66a112094abc932db4f", - "zh:ddf74d8bb1aeb01dc2c36ef40e2b283d32b2a96db73f6daaf179fa2f10949c80", - "zh:e720f3a15d34e795fa9ff90bc755e838ebb4aef894aa2a423fb16dfa6d6b0667", - "zh:e789ae70a658800cb0a19ef7e4e9b26b5a38a92b43d1f41d64fc8bb46539cefb", - "zh:e8aed7dc0bd8f843d607dee5f72640dbef6835a8b1c6ea12cea5b4ec53e463f7", - "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c", - "zh:fb3ac4f43c8b0dfc0b0103dd0f062ea72b3a34518d4c8808e3a44c9a3dd5f024", - ] -} - -provider "registry.terraform.io/hashicorp/null" { - version = "3.2.0" - constraints = "<= 3.2.0" - hashes = [ - "h1:6yiJqQ6JAJW3oMxuZrWoUgHYpkscorX40Q/LzOMzY+w=", - "h1:J80oY79aQzHfzXYidtMrn9+G+F4YLL4iJqFBMHbLcWM=", - "h1:ZbuTqXe8q7Z0IJ2wkF4nio7eZDQc02sezY0esJ5b1Bc=", - "h1:pfjuwssoCoBDRbutlVLAP8wiDrkQ3G4d3rs+f7uSh2A=", - "zh:1d88ea3af09dcf91ad0aaa0d3978ca8dcb49dc866c8615202b738d73395af6b5", - "zh:3844db77bfac2aca43aaa46f3f698c8e5320a47e838ee1318408663449547e7e", - "zh:538fadbd87c576a332b7524f352e6004f94c27afdd3b5d105820d328dc49c5e3", - "zh:56def6f00fc2bc9c3c265b841ce71e80b77e319de7b0f662425b8e5e7eb26846", - "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:8fce56e5f1d13041d8047a1d0c93f930509704813a28f8d39c2b2082d7eebf9f", - "zh:989e909a5eca96b8bdd4a0e8609f1bd525949fd226ae870acedf2da0c55b0451", - "zh:99ddc34ad13e04e9c3477f5422fbec20fc13395ff940720c287bfa5c546d2fbc", - "zh:b546666da4b4b60c0eec23faab7f94dc900e48f66b5436fc1ac0b87c6709ef04", - "zh:d56643cb08cba6e074d70c4af37d5de2bd7c505f81d866d6d47c9e1d28ec65d1", - "zh:f39ac5ff9e9d00e6a670bce6825529eded4b0b4966abba36a387db5f0712d7ba", - "zh:fe102389facd09776502327352be99becc1ac09e80bc287db84a268172be641f", - ] -} diff --git a/src/matteo/00_acr.tf b/src/matteo/00_acr.tf deleted file mode 100644 index f157e37a..00000000 --- a/src/matteo/00_acr.tf +++ /dev/null @@ -1,4 +0,0 @@ -data "azurerm_container_registry" "acr" { - name = local.docker_registry_name - resource_group_name = local.docker_rg_name -} diff --git a/src/matteo/00_azuread.tf b/src/matteo/00_azuread.tf deleted file mode 100644 index 04a0e8be..00000000 --- a/src/matteo/00_azuread.tf +++ /dev/null @@ -1,15 +0,0 @@ -data "azuread_group" "adgroup_admin" { - display_name = format("%s-adgroup-admin", local.project) -} - -data "azuread_group" "adgroup_developers" { - display_name = format("%s-adgroup-developers", local.project) -} - -data "azuread_group" "adgroup_externals" { - display_name = format("%s-adgroup-externals", local.project) -} - -data "azuread_group" "adgroup_security" { - display_name = format("%s-adgroup-security", local.project) -} diff --git a/src/matteo/00_key_vault.tf b/src/matteo/00_key_vault.tf deleted file mode 100644 index 745dec21..00000000 --- a/src/matteo/00_key_vault.tf +++ /dev/null @@ -1,8 +0,0 @@ -data "azurerm_resource_group" "kv_rg" { - name = var.key_vault_rg_name -} - -data "azurerm_key_vault" "kv" { - name = var.key_vault_name - resource_group_name = var.key_vault_rg_name -} diff --git a/src/matteo/00_monitor.tf b/src/matteo/00_monitor.tf deleted file mode 100644 index 2f9fa25e..00000000 --- a/src/matteo/00_monitor.tf +++ /dev/null @@ -1,28 +0,0 @@ -data "azurerm_resource_group" "rg_monitor" { - name = local.monitor_rg_name -} - -data "azurerm_application_insights" "application_insights" { - name = local.monitor_appinsights_name - resource_group_name = data.azurerm_resource_group.rg_monitor.name -} - -data "azurerm_log_analytics_workspace" "log_analytics_workspace" { - name = local.monitor_log_analytics_workspace_name - resource_group_name = data.azurerm_resource_group.rg_monitor.name -} - -data "azurerm_monitor_action_group" "slack" { - resource_group_name = local.monitor_rg_name - name = local.monitor_action_group_slack_name -} - -data "azurerm_monitor_action_group" "email" { - resource_group_name = local.monitor_rg_name - name = local.monitor_action_group_email_name -} - -data "azurerm_storage_account" "security_monitoring_storage" { - name = local.monitor_security_storage_name - resource_group_name = data.azurerm_resource_group.rg_monitor.name -} diff --git a/src/matteo/00_vnet.tf b/src/matteo/00_vnet.tf deleted file mode 100644 index e8a71a2a..00000000 --- a/src/matteo/00_vnet.tf +++ /dev/null @@ -1,13 +0,0 @@ -data "azurerm_resource_group" "rg_vnet" { - name = local.vnet_resource_group_name -} - -data "azurerm_virtual_network" "vnet" { - name = local.vnet_name - resource_group_name = data.azurerm_resource_group.rg_vnet.name -} - -data "azurerm_public_ip" "aks_pip" { - name = local.aks_public_ip_index_name - resource_group_name = local.vnet_resource_group_name -} diff --git a/src/matteo/01_aks.tf b/src/matteo/01_aks.tf deleted file mode 100644 index 6cd5a116..00000000 --- a/src/matteo/01_aks.tf +++ /dev/null @@ -1,106 +0,0 @@ -data "azurerm_public_ip" "aks_outbound" { - count = var.aks_num_outbound_ips - - resource_group_name = data.azurerm_resource_group.rg_vnet.name - name = "${local.aks_public_ip_name}-${count.index + 1}" -} - -resource "azurerm_resource_group" "rg_aks" { - name = local.aks_rg_name - location = var.location - tags = var.tags -} - -module "k8s_snet" { - source = "git::https://github.com/pagopa/azurerm.git//subnet?ref=v4.1.0" - name = "${local.project}-k8s-snet" - address_prefixes = var.cidr_subnet_k8s - resource_group_name = data.azurerm_resource_group.rg_vnet.name - virtual_network_name = data.azurerm_virtual_network.vnet.name - enforce_private_link_endpoint_network_policies = var.aks_private_cluster_enabled - - service_endpoints = [ - "Microsoft.Web", - "Microsoft.Storage" - ] -} - -module "aks" { - source = "git::https://github.com/pagopa/azurerm.git//kubernetes_cluster?ref=v4.1.0" - - name = local.aks_cluster_name - location = azurerm_resource_group.rg_aks.location - dns_prefix = "${local.project}-aks" - resource_group_name = azurerm_resource_group.rg_aks.name - kubernetes_version = var.kubernetes_version - - system_node_pool_name = var.aks_system_node_pool.name - system_node_pool_vm_size = var.aks_system_node_pool.vm_size - system_node_pool_os_disk_type = var.aks_system_node_pool.os_disk_type - system_node_pool_os_disk_size_gb = var.aks_system_node_pool.os_disk_size_gb - system_node_pool_node_count_min = var.aks_system_node_pool.node_count_min - system_node_pool_node_count_max = var.aks_system_node_pool.node_count_max - system_node_pool_node_labels = var.aks_system_node_pool.node_labels - system_node_pool_tags = var.aks_system_node_pool.node_tags - - system_node_pool_only_critical_addons_enabled = true - - user_node_pool_enabled = var.aks_user_node_pool.enabled - user_node_pool_name = var.aks_user_node_pool.name - user_node_pool_vm_size = var.aks_user_node_pool.vm_size - user_node_pool_os_disk_type = var.aks_user_node_pool.os_disk_type - user_node_pool_os_disk_size_gb = var.aks_user_node_pool.os_disk_size_gb - user_node_pool_node_count_min = var.aks_user_node_pool.node_count_min - user_node_pool_node_count_max = var.aks_user_node_pool.node_count_max - user_node_pool_node_labels = var.aks_user_node_pool.node_labels - user_node_pool_node_taints = var.aks_user_node_pool.node_taints - user_node_pool_tags = var.aks_user_node_pool.node_tags - - vnet_id = data.azurerm_virtual_network.vnet.id - vnet_subnet_id = module.k8s_snet.id - - outbound_ip_address_ids = data.azurerm_public_ip.aks_outbound.*.id - private_cluster_enabled = var.aks_private_cluster_enabled - - network_profile = { - docker_bridge_cidr = "172.17.0.1/16" - dns_service_ip = "10.2.0.10" - network_plugin = "azure" - network_policy = "azure" - outbound_type = "loadBalancer" - service_cidr = "10.2.0.0/16" - } - - rbac_enabled = true - aad_admin_group_ids = var.env_short == "d" ? [data.azuread_group.adgroup_admin.object_id, data.azuread_group.adgroup_developers.object_id, data.azuread_group.adgroup_externals.object_id] : [data.azuread_group.adgroup_admin.object_id] - - log_analytics_workspace_id = data.azurerm_log_analytics_workspace.log_analytics_workspace.id - - addon_azure_policy_enabled = var.aks_addons.azure_policy - addon_azure_key_vault_secrets_provider_enabled = var.aks_addons.azure_key_vault_secrets_provider - addon_azure_pod_identity_enabled = var.aks_addons.pod_identity_enabled - - default_metric_alerts = var.aks_metric_alerts_default - custom_metric_alerts = var.aks_metric_alerts_custom - - alerts_enabled = var.aks_alerts_enabled - - action = [ - { - action_group_id = data.azurerm_monitor_action_group.slack.id - webhook_properties = null - }, - { - action_group_id = data.azurerm_monitor_action_group.email.id - webhook_properties = null - } - ] - - tags = var.tags -} - -resource "azurerm_role_assignment" "aks_to_acr" { - scope = data.azurerm_container_registry.acr.id - role_definition_name = "AcrPull" - principal_id = module.aks.kubelet_identity_id -} diff --git a/src/matteo/02_namespaces.tf b/src/matteo/02_namespaces.tf deleted file mode 100644 index b5bb2fc0..00000000 --- a/src/matteo/02_namespaces.tf +++ /dev/null @@ -1,17 +0,0 @@ -resource "kubernetes_namespace" "ingress" { - metadata { - name = "ingress" - } -} - -resource "kubernetes_namespace" "keda" { - metadata { - name = "keda" - } -} - -resource "kubernetes_namespace" "platform_namespace" { - metadata { - name = var.namespace - } -} diff --git a/src/matteo/03_ingress_controller.tf b/src/matteo/03_ingress_controller.tf deleted file mode 100644 index 88787572..00000000 --- a/src/matteo/03_ingress_controller.tf +++ /dev/null @@ -1,87 +0,0 @@ -# from Microsoft docs https://docs.microsoft.com/it-it/azure/aks/ingress-internal-ip -module "nginx_controller" { - source = "terraform-module/release/helm" - version = "2.7.0" - - namespace = kubernetes_namespace.ingress.metadata[0].name - repository = "https://kubernetes.github.io/ingress-nginx" - app = { - name = "nginx-ingress" - version = var.nginx_helm_version - chart = "ingress-nginx" - recreate_pods = false #https://github.com/helm/helm/issues/6378 -> fixed in k8s 1.22 - deploy = 1 - } - - values = [ - "${templatefile( - "${path.module}/ingress/loadbalancer.yaml.tpl", - { - load_balancer_ip = data.azurerm_public_ip.aks_pip.ip_address - is_load_balancer_private = var.aks_private_cluster_enabled - vnet_resource_group_name = local.vnet_resource_group_name - } - )}", - templatefile( - "${path.module}/ingress/autoscaling.yaml.tpl", - { - min_replicas = 1 - max_replicas = 4 - triggers = [ - { - type = "azure-monitor" - metadata = { - tenantId = data.azurerm_subscription.current.tenant_id - subscriptionId = data.azurerm_subscription.current.subscription_id - resourceGroupName = "dvopla-d-sec-rg" - resourceURI = "Microsoft.KeyVault/vaults/dvopla-d-neu-kv" - metricName = "ServiceApiHit" - metricAggregationType = "Count" - targetValue = "30" - } - authenticationRef = { - name = "ingress-keda-trigger-authentication" - } - } - ] - } - ), - ] - - set = [ - { - name = "controller.nodeSelector.beta\\.kubernetes\\.io/os" - value = "linux" - }, - { - name = "defaultBackend.nodeSelector.beta\\.kubernetes\\.io/os" - value = "linux" - }, - { - name = "controller.admissionWebhooks.patch.nodeSelector.beta\\.kubernetes\\.io/os" - value = "linux" - }, - { - name = "controller.ingressClassResource.default" - value = "true" - } - ] -} - -resource "kubernetes_manifest" "ingress_keda_trigger_authentication" { - manifest = { - "apiVersion" = "keda.sh/v1alpha1" - "kind" = "TriggerAuthentication" - "metadata" = { - "name" = "ingress-keda-trigger-authentication" - "namespace" = kubernetes_namespace.ingress.metadata[0].name - } - "spec" = { - "podIdentity" = { - "provider" = "azure" - } - } - } - - depends_on = [helm_release.keda] -} diff --git a/src/matteo/03_keda_controller.tf b/src/matteo/03_keda_controller.tf deleted file mode 100644 index bdae2d8e..00000000 --- a/src/matteo/03_keda_controller.tf +++ /dev/null @@ -1,29 +0,0 @@ -module "keda_pod_identity" { - source = "git::https://github.com/pagopa/azurerm.git//kubernetes_pod_identity?ref=v4.1.0" - - resource_group_name = "${local.project}-aks-rg" - location = var.location - identity_name = "${kubernetes_namespace.keda.metadata[0].name}-pod-identity" - cluster_name = module.aks.name - namespace = kubernetes_namespace.keda.metadata[0].name - tenant_id = data.azurerm_subscription.current.tenant_id -} - -resource "azurerm_role_assignment" "keda_monitoring_reader" { - scope = data.azurerm_subscription.current.id - role_definition_name = "Monitoring Reader" - principal_id = module.keda_pod_identity.identity.principal_id -} - -resource "helm_release" "keda" { - name = "keda" - chart = "keda" - repository = "https://kedacore.github.io/charts" - version = "2.6.0" - namespace = kubernetes_namespace.keda.metadata[0].name - - set { - name = "podIdentity.activeDirectory.identity" - value = "${kubernetes_namespace.keda.metadata[0].name}-pod-identity" - } -} diff --git a/src/matteo/98_helm_template_namespace.tf b/src/matteo/98_helm_template_namespace.tf deleted file mode 100644 index bc917805..00000000 --- a/src/matteo/98_helm_template_namespace.tf +++ /dev/null @@ -1,33 +0,0 @@ -resource "kubernetes_namespace" "helm_template" { - metadata { - name = "helm-template" - } -} - -module "namespace_pod_identity" { - source = "git::https://github.com/pagopa/azurerm.git//kubernetes_pod_identity?ref=v4.1.0" - - resource_group_name = "${local.project}-aks-rg" - - location = var.location - identity_name = "${kubernetes_namespace.helm_template.metadata[0].name}-pod-identity" - key_vault_id = data.azurerm_key_vault.kv.id - tenant_id = data.azurerm_subscription.current.tenant_id - cluster_name = module.aks.name - namespace = kubernetes_namespace.helm_template.metadata[0].name - - secret_permissions = ["get"] -} - -resource "helm_release" "reloader" { - name = "reloader" - repository = "https://stakater.github.io/stakater-charts" - chart = "reloader" - version = "v0.0.109" - namespace = kubernetes_namespace.helm_template.metadata[0].name - - set { - name = "reloader.watchGlobally" - value = "false" - } -} diff --git a/src/matteo/99_main.tf b/src/matteo/99_main.tf deleted file mode 100644 index 2448e38e..00000000 --- a/src/matteo/99_main.tf +++ /dev/null @@ -1,46 +0,0 @@ -terraform { - required_version = ">=1.1.5" - - required_providers { - azurerm = { - source = "hashicorp/azurerm" - version = "= 2.99.0" - } - azuread = { - source = "hashicorp/azuread" - version = "> 2.10.0" - } - kubernetes = { - source = "hashicorp/kubernetes" - version = ">= 2.7.0" - } - helm = { - source = "hashicorp/helm" - version = ">= 2.4.1" - } - } - - backend "azurerm" {} -} - -provider "azurerm" { - features { - key_vault { - purge_soft_delete_on_destroy = false - } - } -} - -data "azurerm_subscription" "current" {} - -data "azurerm_client_config" "current" {} - -provider "kubernetes" { - config_path = "${var.k8s_kube_config_path_prefix}/config-${local.aks_cluster_name}" -} - -provider "helm" { - kubernetes { - config_path = "${var.k8s_kube_config_path_prefix}/config-${local.aks_cluster_name}" - } -} diff --git a/src/matteo/99_main.tf.ci b/src/matteo/99_main.tf.ci deleted file mode 100644 index e8355502..00000000 --- a/src/matteo/99_main.tf.ci +++ /dev/null @@ -1,45 +0,0 @@ -terraform { - required_version = ">=1.1.5" - - required_providers { - azurerm = { - source = "hashicorp/azurerm" - version = "= 2.99.0" - } - azuread = { - source = "hashicorp/azuread" - version = "> 2.10.0" - } - kubernetes = { - source = "hashicorp/kubernetes" - version = ">= 2.7.0" - } - helm = { - source = "hashicorp/helm" - version = ">= 2.4.1" - } - } - -} - -provider "azurerm" { - features { - key_vault { - purge_soft_delete_on_destroy = false - } - } -} - -data "azurerm_subscription" "current" {} - -data "azurerm_client_config" "current" {} - -provider "kubernetes" { - config_path = "${var.k8s_kube_config_path_prefix}/config-${local.aks_cluster_name}" -} - -provider "helm" { - kubernetes { - config_path = "${var.k8s_kube_config_path_prefix}/config-${local.aks_cluster_name}" - } -} diff --git a/src/matteo/99_variables.tf b/src/matteo/99_variables.tf deleted file mode 100644 index f62f34e7..00000000 --- a/src/matteo/99_variables.tf +++ /dev/null @@ -1,723 +0,0 @@ -variable "prefix" { - type = string - default = "dvopla" - validation { - condition = ( - length(var.prefix) <= 6 - ) - error_message = "Max length is 6 chars." - } -} - -variable "env" { - type = string - validation { - condition = ( - length(var.env) <= 3 - ) - error_message = "Max length is 3 chars." - } -} - -variable "env_short" { - type = string - validation { - condition = ( - length(var.env_short) <= 1 - ) - error_message = "Max length is 1 chars." - } -} - -variable "location" { - type = string - default = "westeurope" -} - -variable "location_short" { - type = string - description = "Location short like eg: neu, weu.." -} - -variable "lock_enable" { - type = bool - default = false - description = "Apply locks to block accedentaly deletions." -} - -variable "tags" { - type = map(any) - default = { - CreatedBy = "Terraform" - } -} - -variable "namespace" { - type = string - description = "Default namespace" -} - -variable "nginx_helm_version" { - type = string - description = "Nginx helm version" -} - -variable "key_vault_rg_name" { - type = string - default = "" - description = "Key Vault - rg name" -} - -variable "cidr_vnet" { - type = list(string) - description = "Virtual network address space." -} - -variable "cidr_subnet_appgateway" { - type = list(string) - description = "Application gateway address space." -} - -variable "cidr_subnet_appgateway_beta" { - type = list(string) - description = "Application gateway beta address space." -} - -variable "cidr_subnet_azdoa" { - type = list(string) - description = "Azure DevOps agent network address space." -} - -variable "cidr_subnet_apim" { - type = list(string) - description = "Address prefixes subnet api management." - default = null -} - -variable "cidr_subnet_k8s" { - type = list(string) - description = "Subnet cluster kubernetes." -} - -variable "cidr_subnet_app_docker" { - type = list(string) - description = "Subnet web app docker." -} - -variable "cidr_subnet_flex_dbms" { - type = list(string) - description = "Subnet cidr postgres flex." -} - -variable "dns_default_ttl_sec" { - type = number - description = "value" - default = 3600 -} - -variable "external_domain" { - type = string - default = null - description = "Domain for delegation" -} - -variable "prod_dns_zone_prefix" { - type = string - default = null - description = "The dns subdomain." -} - -variable "lab_dns_zone_prefix" { - type = string - default = null - description = "The dns subdomain." -} - -variable "aks_private_cluster_enabled" { - type = bool - description = "Enable or not public visibility of AKS" - default = false -} - -variable "aks_num_outbound_ips" { - type = number - default = 1 - description = "How many outbound ips allocate for AKS cluster" -} - -variable "aks_system_node_pool" { - type = object({ - name = string, - vm_size = string, - os_disk_type = string, - os_disk_size_gb = string, - node_count_min = number, - node_count_max = number, - node_labels = map(any), - node_tags = map(any) - }) - description = "AKS node pool system configuration" -} - -variable "aks_user_node_pool" { - type = object({ - enabled = bool, - name = string, - vm_size = string, - os_disk_type = string, - os_disk_size_gb = string, - node_count_min = number, - node_count_max = number, - node_labels = map(any), - node_taints = list(string), - node_tags = map(any), - }) - description = "AKS node pool user configuration" -} - -variable "kubernetes_version" { - type = string - description = "Kubernetes version of cluster aks" -} - -variable "reverse_proxy_ip" { - type = string - default = "127.0.0.1" - description = "AKS external ip. Also the ingress-nginx-controller external ip. Value known after installing the ingress controller." -} - -variable "aks_metric_alerts" { - description = < - -## Requirements - -| Name | Version | -|------|---------| -| [terraform](#requirement\_terraform) | >=1.1.5 | -| [azuread](#requirement\_azuread) | > 2.10.0 | -| [azurerm](#requirement\_azurerm) | = 2.99.0 | -| [helm](#requirement\_helm) | >= 2.4.1 | -| [kubernetes](#requirement\_kubernetes) | >= 2.7.0 | - -## Modules - -| Name | Source | Version | -|------|--------|---------| -| [aks](#module\_aks) | git::https://github.com/pagopa/azurerm.git//kubernetes_cluster | v4.1.0 | -| [k8s\_snet](#module\_k8s\_snet) | git::https://github.com/pagopa/azurerm.git//subnet | v4.1.0 | -| [keda\_pod\_identity](#module\_keda\_pod\_identity) | git::https://github.com/pagopa/azurerm.git//kubernetes_pod_identity | v4.1.0 | -| [namespace\_pod\_identity](#module\_namespace\_pod\_identity) | git::https://github.com/pagopa/azurerm.git//kubernetes_pod_identity | v4.1.0 | -| [nginx\_controller](#module\_nginx\_controller) | terraform-module/release/helm | 2.7.0 | - -## Resources - -| Name | Type | -|------|------| -| [azurerm_resource_group.rg_aks](https://registry.terraform.io/providers/hashicorp/azurerm/2.99.0/docs/resources/resource_group) | resource | -| [azurerm_role_assignment.aks_to_acr](https://registry.terraform.io/providers/hashicorp/azurerm/2.99.0/docs/resources/role_assignment) | resource | -| [azurerm_role_assignment.keda_monitoring_reader](https://registry.terraform.io/providers/hashicorp/azurerm/2.99.0/docs/resources/role_assignment) | resource | -| [helm_release.keda](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | -| [helm_release.reloader](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | -| [kubernetes_manifest.ingress_keda_trigger_authentication](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/manifest) | resource | -| [kubernetes_namespace.helm_template](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | -| [kubernetes_namespace.ingress](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | -| [kubernetes_namespace.keda](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | -| [kubernetes_namespace.platform_namespace](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | -| [azuread_group.adgroup_admin](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/group) | data source | -| [azuread_group.adgroup_developers](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/group) | data source | -| [azuread_group.adgroup_externals](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/group) | data source | -| [azuread_group.adgroup_security](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/group) | data source | -| [azurerm_application_insights.application_insights](https://registry.terraform.io/providers/hashicorp/azurerm/2.99.0/docs/data-sources/application_insights) | data source | -| [azurerm_client_config.current](https://registry.terraform.io/providers/hashicorp/azurerm/2.99.0/docs/data-sources/client_config) | data source | -| [azurerm_container_registry.acr](https://registry.terraform.io/providers/hashicorp/azurerm/2.99.0/docs/data-sources/container_registry) | data source | -| [azurerm_key_vault.kv](https://registry.terraform.io/providers/hashicorp/azurerm/2.99.0/docs/data-sources/key_vault) | data source | -| [azurerm_log_analytics_workspace.log_analytics_workspace](https://registry.terraform.io/providers/hashicorp/azurerm/2.99.0/docs/data-sources/log_analytics_workspace) | data source | -| [azurerm_monitor_action_group.email](https://registry.terraform.io/providers/hashicorp/azurerm/2.99.0/docs/data-sources/monitor_action_group) | data source | -| [azurerm_monitor_action_group.slack](https://registry.terraform.io/providers/hashicorp/azurerm/2.99.0/docs/data-sources/monitor_action_group) | data source | -| [azurerm_public_ip.aks_outbound](https://registry.terraform.io/providers/hashicorp/azurerm/2.99.0/docs/data-sources/public_ip) | data source | -| [azurerm_public_ip.aks_pip](https://registry.terraform.io/providers/hashicorp/azurerm/2.99.0/docs/data-sources/public_ip) | data source | -| [azurerm_resource_group.kv_rg](https://registry.terraform.io/providers/hashicorp/azurerm/2.99.0/docs/data-sources/resource_group) | data source | -| [azurerm_resource_group.rg_monitor](https://registry.terraform.io/providers/hashicorp/azurerm/2.99.0/docs/data-sources/resource_group) | data source | -| [azurerm_resource_group.rg_vnet](https://registry.terraform.io/providers/hashicorp/azurerm/2.99.0/docs/data-sources/resource_group) | data source | -| [azurerm_storage_account.security_monitoring_storage](https://registry.terraform.io/providers/hashicorp/azurerm/2.99.0/docs/data-sources/storage_account) | data source | -| [azurerm_subscription.current](https://registry.terraform.io/providers/hashicorp/azurerm/2.99.0/docs/data-sources/subscription) | data source | -| [azurerm_virtual_network.vnet](https://registry.terraform.io/providers/hashicorp/azurerm/2.99.0/docs/data-sources/virtual_network) | data source | - -## Inputs - -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:--------:| -| [aks\_addons](#input\_aks\_addons) | AKS addons configuration |
object({
azure_policy = bool,
azure_key_vault_secrets_provider = bool,
pod_identity_enabled = bool,
})
|
{
"azure_key_vault_secrets_provider": true,
"azure_policy": true,
"pod_identity_enabled": true
}
| no | -| [aks\_alerts\_enabled](#input\_aks\_alerts\_enabled) | Aks alert enabled? | `bool` | `true` | no | -| [aks\_metric\_alerts](#input\_aks\_metric\_alerts) | Map of name = criteria objects |
map(object({
# criteria.*.aggregation to be one of [Average Count Minimum Maximum Total]
aggregation = string
# "Insights.Container/pods" "Insights.Container/nodes"
metric_namespace = string
metric_name = string
# criteria.0.operator to be one of [Equals NotEquals GreaterThan GreaterThanOrEqual LessThan LessThanOrEqual]
operator = string
threshold = number
# Possible values are PT1M, PT5M, PT15M, PT30M and PT1H
frequency = string
# Possible values are PT1M, PT5M, PT15M, PT30M, PT1H, PT6H, PT12H and P1D.
window_size = string

dimension = list(object(
{
name = string
operator = string
values = list(string)
}
))
}))
|
{
"container_cpu": {
"aggregation": "Average",
"dimension": [
{
"name": "kubernetes namespace",
"operator": "Include",
"values": [
"*"
]
},
{
"name": "controllerName",
"operator": "Include",
"values": [
"*"
]
}
],
"frequency": "PT1M",
"metric_name": "cpuExceededPercentage",
"metric_namespace": "Insights.Container/containers",
"operator": "GreaterThan",
"threshold": 95,
"window_size": "PT5M"
},
"container_memory": {
"aggregation": "Average",
"dimension": [
{
"name": "kubernetes namespace",
"operator": "Include",
"values": [
"*"
]
},
{
"name": "controllerName",
"operator": "Include",
"values": [
"*"
]
}
],
"frequency": "PT1M",
"metric_name": "memoryWorkingSetExceededPercentage",
"metric_namespace": "Insights.Container/containers",
"operator": "GreaterThan",
"threshold": 95,
"window_size": "PT5M"
},
"container_oom": {
"aggregation": "Average",
"dimension": [
{
"name": "kubernetes namespace",
"operator": "Include",
"values": [
"*"
]
},
{
"name": "controllerName",
"operator": "Include",
"values": [
"*"
]
}
],
"frequency": "PT1M",
"metric_name": "oomKilledContainerCount",
"metric_namespace": "Insights.Container/pods",
"operator": "GreaterThan",
"threshold": 0,
"window_size": "PT1M"
},
"container_restart": {
"aggregation": "Average",
"dimension": [
{
"name": "kubernetes namespace",
"operator": "Include",
"values": [
"*"
]
},
{
"name": "controllerName",
"operator": "Include",
"values": [
"*"
]
}
],
"frequency": "PT1M",
"metric_name": "restartingContainerCount",
"metric_namespace": "Insights.Container/pods",
"operator": "GreaterThan",
"threshold": 0,
"window_size": "PT1M"
},
"node_cpu": {
"aggregation": "Average",
"dimension": [
{
"name": "host",
"operator": "Include",
"values": [
"*"
]
}
],
"frequency": "PT1M",
"metric_name": "cpuUsagePercentage",
"metric_namespace": "Insights.Container/nodes",
"operator": "GreaterThan",
"threshold": 80,
"window_size": "PT5M"
},
"node_disk": {
"aggregation": "Average",
"dimension": [
{
"name": "host",
"operator": "Include",
"values": [
"*"
]
},
{
"name": "device",
"operator": "Include",
"values": [
"*"
]
}
],
"frequency": "PT1M",
"metric_name": "DiskUsedPercentage",
"metric_namespace": "Insights.Container/nodes",
"operator": "GreaterThan",
"threshold": 80,
"window_size": "PT5M"
},
"node_memory": {
"aggregation": "Average",
"dimension": [
{
"name": "host",
"operator": "Include",
"values": [
"*"
]
}
],
"frequency": "PT1M",
"metric_name": "memoryWorkingSetPercentage",
"metric_namespace": "Insights.Container/nodes",
"operator": "GreaterThan",
"threshold": 80,
"window_size": "PT5M"
},
"node_not_ready": {
"aggregation": "Average",
"dimension": [
{
"name": "status",
"operator": "Include",
"values": [
"NotReady"
]
}
],
"frequency": "PT1M",
"metric_name": "nodesCount",
"metric_namespace": "Insights.Container/nodes",
"operator": "GreaterThan",
"threshold": 0,
"window_size": "PT5M"
},
"pods_failed": {
"aggregation": "Average",
"dimension": [
{
"name": "phase",
"operator": "Include",
"values": [
"Failed"
]
}
],
"frequency": "PT1M",
"metric_name": "podCount",
"metric_namespace": "Insights.Container/pods",
"operator": "GreaterThan",
"threshold": 0,
"window_size": "PT5M"
},
"pods_ready": {
"aggregation": "Average",
"dimension": [
{
"name": "kubernetes namespace",
"operator": "Include",
"values": [
"*"
]
},
{
"name": "controllerName",
"operator": "Include",
"values": [
"*"
]
}
],
"frequency": "PT1M",
"metric_name": "PodReadyPercentage",
"metric_namespace": "Insights.Container/pods",
"operator": "LessThan",
"threshold": 80,
"window_size": "PT5M"
}
}
| no | -| [aks\_metric\_alerts\_custom](#input\_aks\_metric\_alerts\_custom) | Map of name = criteria objects |
map(object({
# criteria.*.aggregation to be one of [Average Count Minimum Maximum Total]
aggregation = string
# "Insights.Container/pods" "Insights.Container/nodes"
metric_namespace = string
metric_name = string
# criteria.0.operator to be one of [Equals NotEquals GreaterThan GreaterThanOrEqual LessThan LessThanOrEqual]
operator = string
threshold = number
# Possible values are PT1M, PT5M, PT15M, PT30M and PT1H
frequency = string
# Possible values are PT1M, PT5M, PT15M, PT30M, PT1H, PT6H, PT12H and P1D.
window_size = string

dimension = list(object(
{
name = string
operator = string
values = list(string)
}
))
}))
|
{
"container_cpu": {
"aggregation": "Average",
"dimension": [
{
"name": "kubernetes namespace",
"operator": "Include",
"values": [
"*"
]
},
{
"name": "controllerName",
"operator": "Include",
"values": [
"*"
]
}
],
"frequency": "PT1M",
"metric_name": "cpuExceededPercentage",
"metric_namespace": "Insights.Container/containers",
"operator": "GreaterThan",
"threshold": 95,
"window_size": "PT5M"
},
"container_memory": {
"aggregation": "Average",
"dimension": [
{
"name": "kubernetes namespace",
"operator": "Include",
"values": [
"*"
]
},
{
"name": "controllerName",
"operator": "Include",
"values": [
"*"
]
}
],
"frequency": "PT1M",
"metric_name": "memoryWorkingSetExceededPercentage",
"metric_namespace": "Insights.Container/containers",
"operator": "GreaterThan",
"threshold": 95,
"window_size": "PT5M"
},
"container_oom": {
"aggregation": "Average",
"dimension": [
{
"name": "kubernetes namespace",
"operator": "Include",
"values": [
"*"
]
},
{
"name": "controllerName",
"operator": "Include",
"values": [
"*"
]
}
],
"frequency": "PT1M",
"metric_name": "oomKilledContainerCount",
"metric_namespace": "Insights.Container/pods",
"operator": "GreaterThan",
"threshold": 0,
"window_size": "PT1M"
},
"container_restart": {
"aggregation": "Average",
"dimension": [
{
"name": "kubernetes namespace",
"operator": "Include",
"values": [
"*"
]
},
{
"name": "controllerName",
"operator": "Include",
"values": [
"*"
]
}
],
"frequency": "PT1M",
"metric_name": "restartingContainerCount",
"metric_namespace": "Insights.Container/pods",
"operator": "GreaterThan",
"threshold": 0,
"window_size": "PT1M"
},
"pods_failed": {
"aggregation": "Average",
"dimension": [
{
"name": "phase",
"operator": "Include",
"values": [
"Failed"
]
}
],
"frequency": "PT1M",
"metric_name": "podCount",
"metric_namespace": "Insights.Container/pods",
"operator": "GreaterThan",
"threshold": 0,
"window_size": "PT5M"
},
"pods_ready": {
"aggregation": "Average",
"dimension": [
{
"name": "kubernetes namespace",
"operator": "Include",
"values": [
"*"
]
},
{
"name": "controllerName",
"operator": "Include",
"values": [
"*"
]
}
],
"frequency": "PT1M",
"metric_name": "PodReadyPercentage",
"metric_namespace": "Insights.Container/pods",
"operator": "LessThan",
"threshold": 80,
"window_size": "PT5M"
}
}
| no | -| [aks\_metric\_alerts\_default](#input\_aks\_metric\_alerts\_default) | Map of name = criteria objects |
map(object({
# criteria.*.aggregation to be one of [Average Count Minimum Maximum Total]
aggregation = string
# "Insights.Container/pods" "Insights.Container/nodes"
metric_namespace = string
metric_name = string
# criteria.0.operator to be one of [Equals NotEquals GreaterThan GreaterThanOrEqual LessThan LessThanOrEqual]
operator = string
threshold = number
# Possible values are PT1M, PT5M, PT15M, PT30M and PT1H
frequency = string
# Possible values are PT1M, PT5M, PT15M, PT30M, PT1H, PT6H, PT12H and P1D.
window_size = string

dimension = list(object(
{
name = string
operator = string
values = list(string)
}
))
}))
|
{
"node_cpu": {
"aggregation": "Average",
"dimension": [
{
"name": "host",
"operator": "Include",
"values": [
"*"
]
}
],
"frequency": "PT1M",
"metric_name": "cpuUsagePercentage",
"metric_namespace": "Insights.Container/nodes",
"operator": "GreaterThan",
"threshold": 80,
"window_size": "PT5M"
},
"node_disk": {
"aggregation": "Average",
"dimension": [
{
"name": "host",
"operator": "Include",
"values": [
"*"
]
},
{
"name": "device",
"operator": "Include",
"values": [
"*"
]
}
],
"frequency": "PT1M",
"metric_name": "DiskUsedPercentage",
"metric_namespace": "Insights.Container/nodes",
"operator": "GreaterThan",
"threshold": 80,
"window_size": "PT5M"
},
"node_memory": {
"aggregation": "Average",
"dimension": [
{
"name": "host",
"operator": "Include",
"values": [
"*"
]
}
],
"frequency": "PT1M",
"metric_name": "memoryWorkingSetPercentage",
"metric_namespace": "Insights.Container/nodes",
"operator": "GreaterThan",
"threshold": 80,
"window_size": "PT5M"
},
"node_not_ready": {
"aggregation": "Average",
"dimension": [
{
"name": "status",
"operator": "Include",
"values": [
"NotReady"
]
}
],
"frequency": "PT1M",
"metric_name": "nodesCount",
"metric_namespace": "Insights.Container/nodes",
"operator": "GreaterThan",
"threshold": 0,
"window_size": "PT5M"
}
}
| no | -| [aks\_num\_outbound\_ips](#input\_aks\_num\_outbound\_ips) | How many outbound ips allocate for AKS cluster | `number` | `1` | no | -| [aks\_private\_cluster\_enabled](#input\_aks\_private\_cluster\_enabled) | Enable or not public visibility of AKS | `bool` | `false` | no | -| [aks\_system\_node\_pool](#input\_aks\_system\_node\_pool) | AKS node pool system configuration |
object({
name = string,
vm_size = string,
os_disk_type = string,
os_disk_size_gb = string,
node_count_min = number,
node_count_max = number,
node_labels = map(any),
node_tags = map(any)
})
| n/a | yes | -| [aks\_user\_node\_pool](#input\_aks\_user\_node\_pool) | AKS node pool user configuration |
object({
enabled = bool,
name = string,
vm_size = string,
os_disk_type = string,
os_disk_size_gb = string,
node_count_min = number,
node_count_max = number,
node_labels = map(any),
node_taints = list(string),
node_tags = map(any),
})
| n/a | yes | -| [cidr\_subnet\_apim](#input\_cidr\_subnet\_apim) | Address prefixes subnet api management. | `list(string)` | `null` | no | -| [cidr\_subnet\_app\_docker](#input\_cidr\_subnet\_app\_docker) | Subnet web app docker. | `list(string)` | n/a | yes | -| [cidr\_subnet\_appgateway](#input\_cidr\_subnet\_appgateway) | Application gateway address space. | `list(string)` | n/a | yes | -| [cidr\_subnet\_appgateway\_beta](#input\_cidr\_subnet\_appgateway\_beta) | Application gateway beta address space. | `list(string)` | n/a | yes | -| [cidr\_subnet\_azdoa](#input\_cidr\_subnet\_azdoa) | Azure DevOps agent network address space. | `list(string)` | n/a | yes | -| [cidr\_subnet\_flex\_dbms](#input\_cidr\_subnet\_flex\_dbms) | Subnet cidr postgres flex. | `list(string)` | n/a | yes | -| [cidr\_subnet\_k8s](#input\_cidr\_subnet\_k8s) | Subnet cluster kubernetes. | `list(string)` | n/a | yes | -| [cidr\_vnet](#input\_cidr\_vnet) | Virtual network address space. | `list(string)` | n/a | yes | -| [dns\_default\_ttl\_sec](#input\_dns\_default\_ttl\_sec) | value | `number` | `3600` | no | -| [env](#input\_env) | n/a | `string` | n/a | yes | -| [env\_short](#input\_env\_short) | n/a | `string` | n/a | yes | -| [external\_domain](#input\_external\_domain) | Domain for delegation | `string` | `null` | no | -| [k8s\_kube\_config\_path\_prefix](#input\_k8s\_kube\_config\_path\_prefix) | n/a | `string` | `"~/.kube"` | no | -| [key\_vault\_name](#input\_key\_vault\_name) | n/a | `string` | n/a | yes | -| [key\_vault\_rg\_name](#input\_key\_vault\_rg\_name) | Key Vault - rg name | `string` | `""` | no | -| [kubernetes\_version](#input\_kubernetes\_version) | Kubernetes version of cluster aks | `string` | n/a | yes | -| [lab\_dns\_zone\_prefix](#input\_lab\_dns\_zone\_prefix) | The dns subdomain. | `string` | `null` | no | -| [location](#input\_location) | n/a | `string` | `"westeurope"` | no | -| [location\_short](#input\_location\_short) | Location short like eg: neu, weu.. | `string` | n/a | yes | -| [lock\_enable](#input\_lock\_enable) | Apply locks to block accedentaly deletions. | `bool` | `false` | no | -| [namespace](#input\_namespace) | Default namespace | `string` | n/a | yes | -| [nginx\_helm\_version](#input\_nginx\_helm\_version) | Nginx helm version | `string` | n/a | yes | -| [prefix](#input\_prefix) | n/a | `string` | `"dvopla"` | no | -| [prod\_dns\_zone\_prefix](#input\_prod\_dns\_zone\_prefix) | The dns subdomain. | `string` | `null` | no | -| [reverse\_proxy\_ip](#input\_reverse\_proxy\_ip) | AKS external ip. Also the ingress-nginx-controller external ip. Value known after installing the ingress controller. | `string` | `"127.0.0.1"` | no | -| [tags](#input\_tags) | n/a | `map(any)` |
{
"CreatedBy": "Terraform"
}
| no | - -## Outputs - -No outputs. - diff --git a/src/matteo/ingress/autoscaling.yaml.tpl b/src/matteo/ingress/autoscaling.yaml.tpl deleted file mode 100644 index f1964881..00000000 --- a/src/matteo/ingress/autoscaling.yaml.tpl +++ /dev/null @@ -1,7 +0,0 @@ -controller: - keda: - enabled: true - minReplicas: ${min_replicas} - maxReplicas: ${max_replicas} - triggers: - ${indent(6, yamlencode(triggers))} diff --git a/src/matteo/ingress/loadbalancer.yaml.tpl b/src/matteo/ingress/loadbalancer.yaml.tpl deleted file mode 100644 index a318e2e7..00000000 --- a/src/matteo/ingress/loadbalancer.yaml.tpl +++ /dev/null @@ -1,6 +0,0 @@ -controller: - service: - loadBalancerIP: ${load_balancer_ip} - annotations: - service.beta.kubernetes.io/azure-load-balancer-internal: ${is_load_balancer_private} - service.beta.kubernetes.io/azure-load-balancer-resource-group: ${vnet_resource_group_name} diff --git a/src/matteo/scripts/setup.sh b/src/matteo/scripts/setup.sh deleted file mode 100755 index 06eaf206..00000000 --- a/src/matteo/scripts/setup.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env bash -set -e - -# -# Setup configuration relative to a given subscription -# Subscription are defined in ./subscription -# Usage: -# ./setup.sh -# -# ./setup.sh dev -# ./setup.sh uat -# ./setup.sh prod - -SCRIPT_PATH="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" -CURRENT_DIRECTORY="$(basename "$SCRIPT_PATH")" -ENV=$1 -# must be subscription in lower case -subscription="" - -# -# 🏁 start shell init -# -if [ -z "$ENV" ]; then - echo "[ERROR] ENV should be: dev, uat or prod." - exit 0 -fi - -# shellcheck source=/dev/null -source "../../.env/$ENV/backend.ini" - -if [ -z "${subscription}" ]; then - printf "[ERROR] \e[1;31mYou must provide a subscription.\n" - exit 1 -fi - -echo "[INFO] This is the current directory: ${CURRENT_DIRECTORY}" - -echo "[INFO] Subscription: ${subscription}" -az account set -s "${subscription}" - -aks_name="dvopla-d-aksmatteo" -echo "[INFO] aks_name: ${aks_name}" -aks_resource_group_name="dvopla-d-aks-rg" -echo "[INFO] aks_resource_group_name: ${aks_resource_group_name}" - -# if using cygwin, we have to transcode the WORKDIR -HOME_DIR=$HOME -if [[ $HOME_DIR == /cygdrive/* ]]; then - HOME_DIR=$(cygpath -w ~) - HOME_DIR=${HOME_DIR//\\//} -fi - -# -# 🖥 start script -# -rm -rf "${HOME}/.kube/config-${aks_name}" -az aks get-credentials -g "${aks_resource_group_name}" -n "${aks_name}" --subscription "${subscription}" --file "~/.kube/config-${aks_name}" -az aks get-credentials -g "${aks_resource_group_name}" -n "${aks_name}" --subscription "${subscription}" --overwrite-existing - -# with AAD auth enabled we need to authenticate the machine on the first setup -echo "Follow Microsoft sign in steps. kubectl get pods command will fail but it's the expected behavior" -kubectl --kubeconfig="${HOME_DIR}/.kube/config-${aks_name}" get pods -kubectl config use-context "${aks_name}" -kubectl get pods diff --git a/src/matteo/terraform.sh b/src/matteo/terraform.sh deleted file mode 100755 index 6745f671..00000000 --- a/src/matteo/terraform.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash - -set -e - -SCRIPT_PATH="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" -CURRENT_DIRECTORY="$(basename "$SCRIPT_PATH")" -ACTION=$1 -ENV=$2 -shift 2 -other="$*" -# must be subscription in lower case -subscription="" -BACKEND_CONFIG_PATH="../.env/${ENV}/${CURRENT_DIRECTORY}_state.tfvars" - -echo "[INFO] This is the current directory: ${CURRENT_DIRECTORY}" - -if [ -z "$ACTION" ]; then - echo "[ERROR] Missed ACTION: init, apply, plan" - exit 0 -fi - -if [ -z "$ENV" ]; then - echo "[ERROR] ENV should be: dev, uat or prod." - exit 0 -fi - -# -# 🏁 Source & init shell -# - -# shellcheck source=/dev/null -source "../.env/$ENV/backend.ini" - -# Subscription set -az account set -s "${subscription}" - -# if using cygwin, we have to transcode the WORKDIR -if [[ $WORKDIR == /cygdrive/* ]]; then - WORKDIR=$(cygpath -w $WORKDIR) -fi - -# Helm -export HELM_DEBUG=1 - -# -# 🌎 Terraform -# -if echo "init plan apply refresh import output state taint destroy" | grep -w "$ACTION" > /dev/null; then - if [ "$ACTION" = "init" ]; then - echo "[INFO] init tf on ENV: ${ENV}" - terraform "$ACTION" -backend-config="${BACKEND_CONFIG_PATH}" $other - elif [ "$ACTION" = "output" ] || [ "$ACTION" = "state" ] || [ "$ACTION" = "taint" ]; then - # init terraform backend - terraform init -reconfigure -backend-config="${BACKEND_CONFIG_PATH}" - terraform "$ACTION" $other - else - # init terraform backend - echo "[INFO] init tf on ENV: ${ENV}" - terraform init \ - -reconfigure \ - -backend-config="${BACKEND_CONFIG_PATH}" - - echo "[INFO] run tf with: ${ACTION} on ENV: ${ENV} and other: >${other}<" - terraform "${ACTION}" \ - -var-file="../.env/${ENV}/terraform.tfvars" \ - -var-file="../.env/${ENV}/kubernetes.tfvars" \ - -compact-warnings \ - $other - fi -else - echo "[ERROR] ACTION not allowed." - exit 1 -fi