From ca0bec7d1e0629fe77dd40dc050f2d2b25850d33 Mon Sep 17 00:00:00 2001 From: Giampiero Ferrara Date: Fri, 21 Feb 2025 10:48:49 +0100 Subject: [PATCH] feat: Deleted unused files --- infra/test/.terraform.lock.hcl | 64 --------- ...fcare-Integration.postman_environment.json | 39 ------ infra/test/data.tf | 17 --- infra/test/env/dev/backend.ini | 1 - infra/test/env/dev/backend.tfvars | 4 - infra/test/env/dev/terraform.tfvars | 91 ------------- infra/test/integration_test.tf | 82 ------------ infra/test/locals.tf | 14 -- infra/test/main.tf | 33 ----- infra/test/terraform.sh | 69 ---------- infra/test/variables.tf | 123 ------------------ integration-test/locals.tf | 13 -- 12 files changed, 550 deletions(-) delete mode 100644 infra/test/.terraform.lock.hcl delete mode 100644 infra/test/Selfcare-Integration.postman_environment.json delete mode 100644 infra/test/data.tf delete mode 100644 infra/test/env/dev/backend.ini delete mode 100644 infra/test/env/dev/backend.tfvars delete mode 100644 infra/test/env/dev/terraform.tfvars delete mode 100644 infra/test/integration_test.tf delete mode 100644 infra/test/locals.tf delete mode 100644 infra/test/main.tf delete mode 100755 infra/test/terraform.sh delete mode 100644 infra/test/variables.tf delete mode 100644 integration-test/locals.tf diff --git a/infra/test/.terraform.lock.hcl b/infra/test/.terraform.lock.hcl deleted file mode 100644 index 8539e241d..000000000 --- a/infra/test/.terraform.lock.hcl +++ /dev/null @@ -1,64 +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.30.0" - constraints = "2.30.0" - hashes = [ - "h1:Uw4TcmJBEJ71h+oCwwidlkk5jFpyFRDPAFCMs/bT/cw=", - "zh:1c3e89cf19118fc07d7b04257251fc9897e722c16e0a0df7b07fcd261f8c12e7", - "zh:2e62c193030e04ebb10cc0526119cf69824bf2d7e4ea5a2f45bd5d5fb7221d36", - "zh:2f3c7a35257332d68b778cefc5201a5f044e4914dd03794a4da662ddfe756483", - "zh:35d0d3a1b58fdb8b8c4462d6b7e7016042da43ea9cc734ce897f52a73407d9b0", - "zh:47ede0cd0206ec953d40bf4a80aa6e59af64e26cbbd877614ac424533dbb693b", - "zh:48c190307d4d42ea67c9b8cc544025024753f46cef6ea64db84735e7055a72da", - "zh:6fff9b2c6a962252a70a15b400147789ab369b35a781e9d21cce3804b04d29af", - "zh:7646980cf3438bff29c91ffedb74458febbb00a996638751fbd204ab1c628c9b", - "zh:77aa2fa7ca6d5446afa71d4ff83cb87b70a2f3b72110fc442c339e8e710b2928", - "zh:e20b2b2c37175b89dd0db058a096544d448032e28e3b56e2db368343533a9684", - "zh:eab175b1dfe9865ad9404dccb6d5542899f8c435095aa7c679314b811c717ce7", - "zh:efc862bd78c55d2ff089729e2a34c1831ab4b0644fc11b36ee4ebed00a4797ba", - ] -} - -provider "registry.terraform.io/hashicorp/azurerm" { - version = "3.86.0" - constraints = "<= 3.86.0" - hashes = [ - "h1:rMBvc1zYiiv/wHc0D8ry8SPxqMiqqwUEt8zndCVPZx4=", - "zh:10473870b663b3becca1127687ed0d002d61f417c279e7daac546d265ff1f3db", - "zh:1dfe2446d7530cd082f817a8d37ec9fb0260b275085978bd81ba0e8167aa6f7c", - "zh:31712a4d9727a5970354eb3c26b4d6dc45b5103c6599cb97c2bd3f9915062baf", - "zh:51dcb102e17e49d675d6865f1ca9eaa8a2aa566ba56a93bb77aab703112d1de5", - "zh:54d5053cd88ed99e804c7b4d72f91ec1bab5fe8b6769db5c120d60b5e6a653dc", - "zh:58388274d406a55c84199d1a22b8143b47321b7b508a18ddeed9e824a864cb5d", - "zh:7b8afa8d62431512197aa5aed4e902b06bce3f8362d6ddf2c841e03c2658f4a7", - "zh:b7d3c1e8bfdd4e099e174724be41cdbc916868a7ca637bcf8682a57ef3453f7f", - "zh:ea0cc2751ef9a15b48e42d6ae62f4329c567335e348f57e577ce727d8167c29f", - "zh:f3a48fdf58a34deae9221923f30112b18ce1ab6cabb46d6c38e1a3234340cfd0", - "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c", - "zh:fbd1d24b6bc67d5c370f2a3934da70ea3b93d612fe83b71e0dae592b48d030ce", - ] -} - -provider "registry.terraform.io/integrations/github" { - version = "5.18.3" - constraints = "5.18.3" - hashes = [ - "h1:WbZvLB2qXKVoh4BvOOwFfEds+SZQrkINfSAWPnWFxGo=", - "zh:050b37d96628cb7451137755929ca8d21ea546bc46d11a715652584070e83ff2", - "zh:053051061f1b7f7673b0ceffac1f239ba28b0e5b375999206fd39976e85d9f2b", - "zh:0c300a977ca66d0347ed62bb116fd8fc9abb376a554d4c192d14f3ea71c83500", - "zh:1d5a1a5243eba78819d2f92ff2d504ebf9a9008a6670fb5f5660f44eb6a156d8", - "zh:a13ac15d251ebf4e7dc40acb0e40df066f443f4c7799186a29e2e44addc7d8e7", - "zh:a316d94b885953c036ebc9fba64a23da93974746bc3ac9d207462a6f02d44540", - "zh:a658a00373bff5979cc227052c693cbde8ca4c8f9fef1bc8094a3516f2e2a96d", - "zh:a7bfc6ad8465d5dc11b6f19d6805364de87fffe27622bb4f37da2319bb1c4956", - "zh:d7379a76861f1a6bfc36eca7a20f1f477711247563b105744d69d7bd1f365fad", - "zh:de1cd959fd4821248e8d21570601193408648474e74f49597f1d0c43185a4ab7", - "zh:e0b281240dd6f2aa405b2d6fe329bc15ab877161affe163fb150d1efca2fccdb", - "zh:e372c171358757a983d7aa878abfd05a84484fb4d22167e45c9c1267e78ed060", - "zh:f6d3116526030b3f6905f530cd6c04b23d42890d973fa2abe10ce9c89cb1db80", - "zh:f99eec731e03cc6a28996c875bd435887cd7ea75ec07cc77b9e768bb12da2227", - ] -} diff --git a/infra/test/Selfcare-Integration.postman_environment.json b/infra/test/Selfcare-Integration.postman_environment.json deleted file mode 100644 index 2b174813a..000000000 --- a/infra/test/Selfcare-Integration.postman_environment.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "id": "12505d2b-8642-4ff6-8a13-d7eba9922973", - "name": "Selfcare-Integration", - "values": [ - { - "key": "apiBaseUrl", - "value": "https://api${env}.selfcare.pagopa.it", - "type": "default", - "enabled": true - }, - { - "key": "productId", - "value": "prod-pn", - "type": "default", - "enabled": true - }, - { - "key": "apimKeyPN", - "value": "${apimKeyPN}", - "type": "default", - "enabled": true - }, - { - "key": "institutionId", - "value": "809ee84e-a962-434a-93a8-4219477ec21d", - "type": "default", - "enabled": true - }, - { - "key": "userId", - "value": "07f5b37a-6002-4a51-a501-427eca9e39ea", - "type": "default", - "enabled": true - } - ], - "_postman_variable_scope": "environment", - "_postman_exported_at": "2024-11-11T16:36:58.194Z", - "_postman_exported_using": "Postman/11.19.0" -} \ No newline at end of file diff --git a/infra/test/data.tf b/infra/test/data.tf deleted file mode 100644 index 77f293000..000000000 --- a/infra/test/data.tf +++ /dev/null @@ -1,17 +0,0 @@ -data "azurerm_resource_group" "rg_vnet" { - name = format("%s-vnet-rg", local.project) -} - -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_virtual_network" "vnet" { - name = format("%s-vnet", local.project) - resource_group_name = data.azurerm_resource_group.rg_vnet.name -} \ No newline at end of file diff --git a/infra/test/env/dev/backend.ini b/infra/test/env/dev/backend.ini deleted file mode 100644 index 73ee9c6b7..000000000 --- a/infra/test/env/dev/backend.ini +++ /dev/null @@ -1 +0,0 @@ -subscription=DEV-SelfCare \ No newline at end of file diff --git a/infra/test/env/dev/backend.tfvars b/infra/test/env/dev/backend.tfvars deleted file mode 100644 index 244cb505e..000000000 --- a/infra/test/env/dev/backend.tfvars +++ /dev/null @@ -1,4 +0,0 @@ -resource_group_name = "terraform-state-rg" -storage_account_name = "tfappdevselfcare" -container_name = "terraform-state" -key = "selfcare-onboarding.integration-test.tfstate" \ No newline at end of file diff --git a/infra/test/env/dev/terraform.tfvars b/infra/test/env/dev/terraform.tfvars deleted file mode 100644 index 6108a44a3..000000000 --- a/infra/test/env/dev/terraform.tfvars +++ /dev/null @@ -1,91 +0,0 @@ -prefix = "selc" -env_short = "d" -env = "dev" -location = "westeurope" - -tags = { - CreatedBy = "Terraform" - Environment = "Dev" - Owner = "SelfCare" - Source = "https://github.com/pagopa/selfcare-onboarding" - CostCenter = "TS310 - PAGAMENTI & SERVIZI" -} - -key_vault = { - resource_group_name = "selc-d-sec-rg" - name = "selc-d-kv" -} - - -app_settings = { - "APPLICATIONINSIGHTS_CONNECTION_STRING" = "@Microsoft.KeyVault(SecretUri=https://selc-d-kv.vault.azure.net/secrets/appinsights-connection-string/)", - "USER_REGISTRY_URL" = "https://api.uat.pdv.pagopa.it/user-registry/v1", - "MONGODB_CONNECTION_URI" = "@Microsoft.KeyVault(SecretUri=https://selc-d-kv.vault.azure.net/secrets/mongodb-connection-string/)", - "USER_REGISTRY_API_KEY" = "@Microsoft.KeyVault(SecretUri=https://selc-d-kv.vault.azure.net/secrets/user-registry-api-key/)", - "BLOB_STORAGE_CONN_STRING_PRODUCT" = "@Microsoft.KeyVault(SecretUri=https://selc-d-kv.vault.azure.net/secrets/blob-storage-product-connection-string/)", - "STORAGE_CONTAINER_CONTRACT" = "selc-d-contracts-blob", - "STORAGE_CONTAINER_PRODUCT" = "selc-d-product", - "BLOB_STORAGE_CONN_STRING_CONTRACT" = "@Microsoft.KeyVault(SecretUri=https://selc-d-kv.vault.azure.net/secrets/contracts-storage-blob-connection-string/)", - "MAIL_DESTINATION_TEST_ADDRESS" = "pectest@pec.pagopa.it", - "MAIL_TEMPLATE_REGISTRATION_REQUEST_PT_PATH" = "contracts/template/mail/registration-request-pt/1.0.0.json", - "MAIL_SENDER_ADDRESS" = "@Microsoft.KeyVault(SecretUri=https://selc-d-kv.vault.azure.net/secrets/smtp-usr/)", - "MAIL_SERVER_USERNAME" = "@Microsoft.KeyVault(SecretUri=https://selc-d-kv.vault.azure.net/secrets/smtp-usr/)", - "MAIL_SERVER_PASSWORD" = "@Microsoft.KeyVault(SecretUri=https://selc-d-kv.vault.azure.net/secrets/smtp-psw/)", - "MAIL_SERVER_HOST" = "smtps.pec.aruba.it", - "MAIL_SERVER_PORT" = "465", - "MAIL_SERVER_SSL" = "true" - "MAIL_TEMPLATE_REGISTRATION_NOTIFICATION_ADMIN_PATH" = "contracts/template/mail/registration-notification-admin/1.0.0.json", - "MAIL_TEMPLATE_NOTIFICATION_PATH" = "contracts/template/mail/onboarding-notification/1.0.0.json", - "ADDRESS_EMAIL_NOTIFICATION_ADMIN" = "@Microsoft.KeyVault(SecretUri=https://selc-d-kv.vault.azure.net/secrets/portal-admin-operator-email/)", - "MAIL_TEMPLATE_COMPLETE_PATH" = "contracts/template/mail/onboarding-complete/1.0.0.json", - "MAIL_TEMPLATE_AGGREGATE_COMPLETE_PATH" = "contracts/template/mail/onboarding-complete-aggregate/1.0.0.json", - "MAIL_TEMPLATE_FD_COMPLETE_NOTIFICATION_PATH" = "contracts/template/mail/onboarding-complete-fd/1.0.0.json", - "MAIL_TEMPLATE_AUTOCOMPLETE_PATH" = "contracts/template/mail/import-massivo-io/1.0.0.json", - "MAIL_TEMPLATE_DELEGATION_NOTIFICATION_PATH" = "contracts/template/mail/delegation-notification/1.0.0.json", - "MAIL_TEMPLATE_REGISTRATION_PATH" = "contracts/template/mail/onboarding-request/1.0.1.json", - "MAIL_TEMPLATE_REGISTRATION_AGGREGATOR_PATH" = "contracts/template/mail/onboarding-request-aggregator/1.0.1.json" - "MAIL_TEMPLATE_REJECT_PATH" = "contracts/template/mail/onboarding-refused/1.0.0.json", - "MAIL_TEMPLATE_PT_COMPLETE_PATH" = "contracts/template/mail/registration-complete-pt/1.0.0.json", - "MAIL_TEMPLATE_USER_COMPLETE_NOTIFICATION_PATH" = "contracts/template/mail/onboarding-complete-user/1.0.0.json", - "MAIL_TEMPLATE_REGISTRATION_USER_PATH" = "contracts/template/mail/onboarding-request-admin/1.0.0.json", - "MAIL_TEMPLATE_REGISTRATION_USER_NEW_MANAGER_PATH" = "contracts/template/mail/onboarding-request-manager/1.0.0.json", - "SELFCARE_ADMIN_NOTIFICATION_URL" = "https://dev.selfcare.pagopa.it/dashboard/admin/onboarding/", - "SELFCARE_URL" = "https://selfcare.pagopa.it", - "MAIL_ONBOARDING_CONFIRMATION_LINK" = "https://dev.selfcare.pagopa.it/onboarding/confirm?jwt=", - "MAIL_USER_CONFIRMATION_LINK" = "https://dev.selfcare.pagopa.it/onboarding/confirm?add-user=true&jwt=", - "MAIL_ONBOARDING_REJECTION_LINK" = "https://dev.selfcare.pagopa.it/onboarding/cancel?jwt=", - "MAIL_ONBOARDING_URL" = "https://dev.selfcare.pagopa.it/onboarding/", - "MS_USER_URL" = "https://selc-d-user-ms-ca.whitemoss-eb7ef327.westeurope.azurecontainerapps.io", - "MS_CORE_URL" = "https://selc-d-ms-core-ca.whitemoss-eb7ef327.westeurope.azurecontainerapps.io", - "JWT_BEARER_TOKEN" = "@Microsoft.KeyVault(SecretUri=https://selc-d-kv.vault.azure.net/secrets/jwt-bearer-token-functions/)", - "MS_PARTY_REGISTRY_URL" = "https://selc-d-party-reg-proxy-ca.whitemoss-eb7ef327.westeurope.azurecontainerapps.io", - "USER_MS_SEND_MAIL" = "false", - "EVENT_HUB_BASE_PATH" = "https://selc-d-eventhub-ns.servicebus.windows.net", - "STANDARD_SHARED_ACCESS_KEY_NAME" = "selfcare-wo" - "EVENTHUB_SC_CONTRACTS_SELFCARE_WO_KEY_LC" = "@Microsoft.KeyVault(SecretUri=https://selc-d-kv.vault.azure.net/secrets/eventhub-sc-contracts-selfcare-wo-key-lc/)" - "STANDARD_TOPIC_NAME" = "SC-Contracts" - "SAP_SHARED_ACCESS_KEY_NAME" = "external-interceptor-wo" - "EVENTHUB_SC_CONTRACTS_SAP_SELFCARE_WO_KEY_LC" = "@Microsoft.KeyVault(SecretUri=https://selc-d-kv.vault.azure.net/secrets/eventhub-sc-contracts-sap-external-interceptor-wo-key-lc/)" - "SAP_TOPIC_NAME" = "SC-Contracts-SAP" - "FD_SHARED_ACCESS_KEY_NAME" = "external-interceptor-wo" - "EVENTHUB_SC_CONTRACTS_FD_SELFCARE_WO_KEY_LC" = "@Microsoft.KeyVault(SecretUri=https://selc-d-kv.vault.azure.net/secrets/eventhub-selfcare-fd-external-interceptor-wo-key-lc/)" - "FD_TOPIC_NAME" = "Selfcare-FD", - "SAP_ALLOWED_INSTITUTION_TYPE" = "PA,GSP,SA,AS,SCP", - "SAP_ALLOWED_ORIGINS" = "IPA,SELC,PDND_INFOCAMERE" - "MINUTES_THRESHOLD_FOR_UPDATE_NOTIFICATION" = "5" - "BYPASS_CHECK_ORGANIZATION" = "false" - "PROD_FD_URL" = "https://fid00001fe.siachain.sv.sia.eu:30008" - "FD_TOKEN_GRANT_TYPE" = "@Microsoft.KeyVault(SecretUri=https://selc-d-kv.vault.azure.net/secrets/prod-fd-grant-type/)" - "FD_TOKEN_CLIENT_ID" = "@Microsoft.KeyVault(SecretUri=https://selc-d-kv.vault.azure.net/secrets/prod-fd-client-id/)" - "FD_TOKEN_CLIENT_SECRET" = "@Microsoft.KeyVault(SecretUri=https://selc-d-kv.vault.azure.net/secrets/prod-fd-client-secret/)" - "EMAIL_SERVICE_AVAILABLE" = "true" - "JWT_TOKEN_ISSUER" = "SPID" - "JWT_TOKEN_PRIVATE_KEY" = "@Microsoft.KeyVault(SecretUri=https://selc-d-kv.vault.azure.net/secrets/jwt-private-key/)" - "JWT_TOKEN_KID" = "@Microsoft.KeyVault(SecretUri=https://selc-d-kv.vault.azure.net/secrets/jwt-kid/)" - - ##NAMIRIAL SIGNATURE - "PAGOPA_SIGNATURE_SOURCE" = "disabled", - "NAMIRIAL_BASE_URL" = "http://selc-d-namirial-sws-cg.westeurope.azurecontainer.io:8080", - "NAMIRIAL_SIGN_SERVICE_IDENTITY_USER" = "@Microsoft.KeyVault(SecretUri=https://selc-d-kv.vault.azure.net/secrets/namirial-sign-service-user/)", - "NAMIRIAL_SIGN_SERVICE_IDENTITY_PASSWORD" = "@Microsoft.KeyVault(SecretUri=https://selc-d-kv.vault.azure.net/secrets/namirial-sign-service-psw/)" -} \ No newline at end of file diff --git a/infra/test/integration_test.tf b/infra/test/integration_test.tf deleted file mode 100644 index d237d0170..000000000 --- a/infra/test/integration_test.tf +++ /dev/null @@ -1,82 +0,0 @@ -data "azurerm_key_vault" "key_vault" { - resource_group_name = var.key_vault.resource_group_name - name = var.key_vault.name -} - -data "azurerm_key_vault_secret" "apim_product_pn_sk" { - name = "apim-product-pn-sk" - key_vault_id = data.azurerm_key_vault.key_vault.id -} - -/* -resource "azurerm_key_vault_access_policy" "keyvault_functions_access_policy" { - key_vault_id = data.azurerm_key_vault.key_vault.id - tenant_id = data.azurerm_client_config.current.tenant_id - object_id = module.selc_onboarding_fn.system_identity_principal - - secret_permissions = [ - "Get", - ] -}*/ - -data "azurerm_resource_group" "nat_rg" { - name = "${local.base_domain_name}-nat-rg" -} - -data "azurerm_resource_group" "vnet_rg" { - name = "${local.base_domain_vnet_name}-vnet-rg" -} - -/*resource "azurerm_key_vault_secret" "fn_primary_key" { - name = "fn-onboarding-primary-key" - value = module.selc_onboarding_fn.primary_key - content_type = "text/plain" - key_vault_id = data.azurerm_key_vault.key_vault.id -}*/ - -data "github_repository" "repo" { - full_name = "pagopa/selfcare-onboarding" -} - -resource "github_repository_environment" "repo_environment" { - repository = data.github_repository.repo.name - environment = "dev-ci" -} - - -resource "github_actions_environment_secret" "integration_environment" { - repository = data.github_repository.repo.name - environment = github_repository_environment.repo_environment.environment - secret_name = "integration_environment" - plaintext_value = base64encode(templatefile("Selfcare-Integration.postman_environment.json", - { - env = "${local.env_url}" - apimKeyPN = data.azurerm_key_vault_secret.apim_product_pn_sk.value - })) -} - -/* -data "azurerm_api_management" "apim" { - name = format("%s-apim-v2", local.project) - resource_group_name = format("%s-api-v2-rg", local.project) -} - -data "azurerm_api_management_product" "product_pn" { - product_id = "pn" - api_management_name = data.azurerm_api_management.apim.name - resource_group_name = data.azurerm_api_management.apim.resource_group_name -} - -data "azurerm_api_management_user" "admin" { - user_id = "1" - api_management_name = data.azurerm_api_management.apim.name - resource_group_name = data.azurerm_api_management.apim.resource_group_name -} - -resource "azurerm_api_management_subscription" "admin_product_pn" { - api_management_name = data.azurerm_api_management.apim.name - resource_group_name = data.azurerm_api_management.apim.resource_group_name - user_id = data.azurerm_api_management_user.admin.id - product_id = data.azurerm_api_management_product.product_pn.id - display_name = "Parser API" -}*/ \ No newline at end of file diff --git a/infra/test/locals.tf b/infra/test/locals.tf deleted file mode 100644 index 5f4224d62..000000000 --- a/infra/test/locals.tf +++ /dev/null @@ -1,14 +0,0 @@ -locals { - pnpg_suffix = var.is_pnpg == true ? "-pnpg" : "" - pnpg_domain_suffix = var.is_pnpg == true ? "-weu-pnpg" : "" - pnpg_domain_vnet_suffix = var.is_pnpg == true ? "-weu" : "" - project = "${var.prefix}-${var.env_short}" - env_url = var.env_short == "p" ? "" : ".${var.env}" - - app_name = "${local.project}${local.pnpg_suffix}-onboarding-fn" - base_domain_name = "${local.project}${local.pnpg_domain_suffix}" - base_domain_vnet_name = "${local.project}${local.pnpg_domain_vnet_suffix}" - vnet_name = "${local.project}-vnet-rg" - monitor_rg_name = "${local.project}-monitor-rg" - monitor_appinsights_name = "${local.project}-appinsights" -} \ No newline at end of file diff --git a/infra/test/main.tf b/infra/test/main.tf deleted file mode 100644 index c98afb934..000000000 --- a/infra/test/main.tf +++ /dev/null @@ -1,33 +0,0 @@ -terraform { - required_version = ">=1.6.0" - - required_providers { - azuread = { - source = "hashicorp/azuread" - version = "2.30.0" - } - azurerm = { - source = "hashicorp/azurerm" - version = "<= 3.86.0" - } - github = { - source = "integrations/github" - version = "5.18.3" - } - } - - backend "azurerm" {} -} - -provider "azurerm" { - features {} - skip_provider_registration = true -} - -provider "github" { - owner = "pagopa" -} - -data "azurerm_subscription" "current" {} - -data "azurerm_client_config" "current" {} \ No newline at end of file diff --git a/infra/test/terraform.sh b/infra/test/terraform.sh deleted file mode 100755 index e8fe04251..000000000 --- a/infra/test/terraform.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash - -set -e - -action=$1 -env=$2 -shift 2 -other=$@ -# must be subscription in lower case -subscription="" -BACKEND_CONFIG_PATH="./env/${ENV}/backend.tfvars" - -if [ -z "$action" ]; then - echo "Missed action: init, apply, plan" - exit 0 -fi - -if [ -z "$env" ]; then - echo "env should be: dev, uat or prod." - exit 0 -fi - -source "./env/$env/backend.ini" - -az account set -s "${subscription}" - -# if using cygwin, we have to transcode the WORKDIR -if [[ $WORKDIR == /cygdrive/* ]]; then - WORKDIR=$(cygpath -w $WORKDIR) -fi - -if [ "$action" = "force-unlock" ]; then - echo "🧭 terraform INIT in env: ${env}" - terraform init -reconfigure -backend-config="./env/$env/backend.tfvars" $other - warn_message="You are about to unlock Terraform's remote state. - This is a dangerous task you want to be aware of before going on. - This operation won't affect your infrastructure directly. - However, please note that you may lose pieces of information about partially-applied configurations. - - Please refer to the official Terraform documentation about the command: - https://developer.hashicorp.com/terraform/cli/commands/force-unlock" - printf "\n\e[33m%s\e[0m\n\n" "$warn_message" - - read -r -p "Please enter the LOCK ID: " lock_id - terraform force-unlock "$lock_id" - - exit 0 # this line prevents the script to go on -fi - -if echo "init plan apply refresh import output state taint destroy" | grep -w "$action" > /dev/null; then - if [ "$action" = "init" ]; then - echo "🧭 terraform INIT in env: ${env}" - terraform "$action" -reconfigure -backend-config="./env/$env/backend.tfvars" $other - elif [ "$action" = "output" ] || [ "$action" = "state" ] || [ "$action" = "taint" ]; then - # init terraform backend - echo "🧭 terraform (output|state|taint) launched with action: ${action} in env: ${env}" - terraform init -reconfigure -backend-config="./env/$env/backend.tfvars" - terraform "$action" $other - else - # init terraform backend - echo "🧭 terraform launched with action: ${action} in env: ${env}" - - terraform init -reconfigure -backend-config="./env/$env/backend.tfvars" - terraform "$action" -var-file="./env/$env/terraform.tfvars" $other - fi -else - echo "Action not allowed." - exit 1 -fi \ No newline at end of file diff --git a/infra/test/variables.tf b/infra/test/variables.tf deleted file mode 100644 index e147d9665..000000000 --- a/infra/test/variables.tf +++ /dev/null @@ -1,123 +0,0 @@ -variable "is_pnpg" { - type = bool - default = false - description = "(Optional) True if you want to apply changes to PNPG environment" -} - -variable "prefix" { - description = "Domain prefix" - type = string - default = "selc" - validation { - condition = ( - length(var.prefix) <= 6 - ) - error_message = "Max length is 6 chars." - } -} - -variable "location" { - type = string - description = "One of westeurope, northeurope" -} - -variable "env_short" { - description = "Environment short name" - type = string - validation { - condition = ( - length(var.env_short) <= 1 - ) - error_message = "Max length is 1 chars." - } -} - -variable "env" { - description = "Environment name" - type = string - validation { - condition = ( - length(var.env) <= 4 - ) - error_message = "Max length is 4 chars." - } -} - -variable "tags" { - type = map(any) -} - -variable "key_vault" { - description = "KeyVault data to get secrets values from" - type = object({ - resource_group_name = string - name = string - }) -} - - -variable "cidr_subnet_selc_onboarding_fn" { - type = list(string) - description = "Address prefixes subnet selc ca and functions" - default = null -} - -# Storage account -variable "storage_account_info" { - type = object({ - account_kind = string - account_tier = string - account_replication_type = string - access_tier = string - advanced_threat_protection_enable = bool - use_legacy_defender_version = bool - public_network_access_enabled = bool - }) - - default = { - account_kind = "StorageV2" - account_tier = "Standard" - account_replication_type = "LRS" - access_tier = "Hot" - advanced_threat_protection_enable = true - use_legacy_defender_version = true - public_network_access_enabled = false - } -} - -# App service plan -variable "app_service_plan_info" { - type = object({ - kind = string - # The kind of the App Service Plan to create. Possible values are Windows (also available as App), Linux, elastic (for Premium Consumption) and FunctionApp (for a Consumption Plan). - sku_size = string # Specifies the plan's instance size. - sku_tier = string - maximum_elastic_worker_count = number - # The maximum number of total workers allowed for this ElasticScaleEnabled App Service Plan. - worker_count = number # The number of Workers (instances) to be allocated. - zone_balancing_enabled = bool - # Should the Service Plan balance across Availability Zones in the region. Changing this forces a new resource to be created. - }) - - description = "Allows to configurate the internal service plan" - - default = { - kind = "Linux" - sku_size = "S1" - sku_tier = "StandardS1" - maximum_elastic_worker_count = 0 - worker_count = 0 - zone_balancing_enabled = false - } -} - -variable "function_always_on" { - type = bool - description = "Always on property" - default = false -} - - -variable "app_settings" { - type = map(any) -} \ No newline at end of file diff --git a/integration-test/locals.tf b/integration-test/locals.tf deleted file mode 100644 index 4de8e5d72..000000000 --- a/integration-test/locals.tf +++ /dev/null @@ -1,13 +0,0 @@ -locals { - pnpg_suffix = var.is_pnpg == true ? "-pnpg" : "" - pnpg_domain_suffix = var.is_pnpg == true ? "-weu-pnpg" : "" - pnpg_domain_vnet_suffix = var.is_pnpg == true ? "-weu" : "" - project = "${var.prefix}-${var.env_short}" - - app_name = "${local.project}${local.pnpg_suffix}-onboarding-fn" - base_domain_name = "${local.project}${local.pnpg_domain_suffix}" - base_domain_vnet_name = "${local.project}${local.pnpg_domain_vnet_suffix}" - vnet_name = "${local.project}-vnet-rg" - monitor_rg_name = "${local.project}-monitor-rg" - monitor_appinsights_name = "${local.project}-appinsights" -} \ No newline at end of file