From 4eb8f9feedc395f4a2224c76f090c88d6a6a7cf7 Mon Sep 17 00:00:00 2001 From: Mario Mupo <43968294+mamu0@users.noreply.github.com> Date: Mon, 3 Feb 2025 18:09:52 +0100 Subject: [PATCH] [CES-718] Removed provider definition inside Storage Account module (#262) --- .changeset/short-masks-dress.md | 5 +++++ infra/modules/azure_storage_account/main.tf | 4 ---- .../tests/setup/README.md | 1 + .../azure_storage_account/tests/setup/main.tf | 4 ++++ .../tests/setup/variables.tf | 5 +++++ .../tests/storageaccount.tftest.hcl | 22 ++++++++++++++----- 6 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 .changeset/short-masks-dress.md diff --git a/.changeset/short-masks-dress.md b/.changeset/short-masks-dress.md new file mode 100644 index 000000000..befd871a5 --- /dev/null +++ b/.changeset/short-masks-dress.md @@ -0,0 +1,5 @@ +--- +"azure_storage_account": patch +--- + +Removed provider definition and test updated diff --git a/infra/modules/azure_storage_account/main.tf b/infra/modules/azure_storage_account/main.tf index 15bff1f16..0843f5417 100644 --- a/infra/modules/azure_storage_account/main.tf +++ b/infra/modules/azure_storage_account/main.tf @@ -7,10 +7,6 @@ terraform { } } -provider "azurerm" { - features {} -} - module "naming_convention" { source = "pagopa/dx-azure-naming-convention/azurerm" version = "~> 0" diff --git a/infra/modules/azure_storage_account/tests/setup/README.md b/infra/modules/azure_storage_account/tests/setup/README.md index 206c81319..d30bb350e 100644 --- a/infra/modules/azure_storage_account/tests/setup/README.md +++ b/infra/modules/azure_storage_account/tests/setup/README.md @@ -27,6 +27,7 @@ | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | [environment](#input\_environment) | n/a |
object({
prefix = string
env_short = string
location = string
domain = optional(string)
app_name = string
instance_number = string
})
| n/a | yes | +| [tags](#input\_tags) | Resources tags | `map(any)` | n/a | yes | ## Outputs diff --git a/infra/modules/azure_storage_account/tests/setup/main.tf b/infra/modules/azure_storage_account/tests/setup/main.tf index d57c7f09e..229cf76b6 100644 --- a/infra/modules/azure_storage_account/tests/setup/main.tf +++ b/infra/modules/azure_storage_account/tests/setup/main.tf @@ -31,6 +31,8 @@ resource "azurerm_user_assigned_identity" "user" { name = "${module.naming_convention.prefix}-user-sa-${module.naming_convention.suffix}" resource_group_name = azurerm_resource_group.rg.name location = var.environment.location + + tags = var.tags } @@ -43,6 +45,8 @@ data "azurerm_subnet" "pep" { resource "azurerm_resource_group" "rg" { name = "${module.naming_convention.prefix}-rg-sa-${module.naming_convention.suffix}" location = var.environment.location + + tags = var.tags } output "pep_id" { diff --git a/infra/modules/azure_storage_account/tests/setup/variables.tf b/infra/modules/azure_storage_account/tests/setup/variables.tf index 790f22498..4860e92d8 100644 --- a/infra/modules/azure_storage_account/tests/setup/variables.tf +++ b/infra/modules/azure_storage_account/tests/setup/variables.tf @@ -7,4 +7,9 @@ variable "environment" { app_name = string instance_number = string }) +} + +variable "tags" { + type = map(any) + description = "Resources tags" } \ No newline at end of file diff --git a/infra/modules/azure_storage_account/tests/storageaccount.tftest.hcl b/infra/modules/azure_storage_account/tests/storageaccount.tftest.hcl index 5800a9450..2241692da 100644 --- a/infra/modules/azure_storage_account/tests/storageaccount.tftest.hcl +++ b/infra/modules/azure_storage_account/tests/storageaccount.tftest.hcl @@ -22,6 +22,17 @@ run "setup_tests" { app_name = "test" instance_number = "01" } + + tags = { + CostCenter = "TS000 - Tecnologia e Servizi" + CreatedBy = "Terraform" + Environment = "Dev" + BusinessUnit = "DevEx" + ManagementTeam = "Developer Experience" + Source = "https://github.com/pagopa/dx/blob/main/infra/modules/azure_storage_account/tests" + Test = "true" + TestName ="Create Storage Account for test" + } } } @@ -39,13 +50,14 @@ run "storage_account_is_correct_plan" { } tags = { - CostCenter = "TS700 - ENGINEERING" - CreatedBy = "Terraform" - Environment = "Dev" - Owner = "DevEx" + CostCenter = "TS000 - Tecnologia e Servizi" + CreatedBy = "Terraform" + Environment = "Dev" + BusinessUnit = "DevEx" + ManagementTeam = "Developer Experience" Source = "https://github.com/pagopa/dx/blob/main/infra/modules/azure_storage_account/tests" Test = "true" - TestName = "Create Storage Account for test" + TestName ="Create Storage Account for test" } resource_group_name = run.setup_tests.resource_group_name