Skip to content

Commit

Permalink
feat: added outputs in common and edited common_values
Browse files Browse the repository at this point in the history
  • Loading branch information
mamu0 committed Dec 20, 2024
1 parent 26956aa commit d938505
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/_modules/common_values/data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ data "azurerm_virtual_network" "weu_prod01" {
resource_group_name = "${local.project_weu}-prod01-vnet-rg"
}

data "terraform_remote_state" "core" {
data "terraform_remote_state" "common" {
backend = "azurerm"

config = {
resource_group_name = "terraform-state-rg"
storage_account_name = "iopitntfst001"
container_name = "terraform-state"
key = "io-infra.core.prod.italynorth.tfstate"
key = "io-infra.common.prod.tfstate"
}
}
2 changes: 1 addition & 1 deletion src/_modules/common_values/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ locals {
project_itn = "${local.prefix}-${local.env_short}-${local.location_short.italynorth}"
project_weu = "${local.prefix}-${local.env_short}-${local.location_short.westeurope}"
project_weu_legacy = "${local.prefix}-${local.env_short}"
core = data.terraform_remote_state.core.outputs
common = data.terraform_remote_state.common.outputs
}
22 changes: 14 additions & 8 deletions src/_modules/common_values/outputs_network.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,20 @@ output "virtual_networks" {
EOF
value = {
itn = {
common = local.core.networking.itn.vnet_common
id = local.common.virtual_networks.itn.id
name = local.common.virtual_networks.itn.name
resource_group_name = local.common.virtual_networks.itn.resource_group_name
}
weu = {
common = local.core.networking.weu.vnet_common
prod01 = {
name = data.azurerm_virtual_network.weu_prod01.name
resource_group_name = data.azurerm_virtual_network.weu_prod01.resource_group_name
}
id = local.common.virtual_networks.weu.id
name = local.common.virtual_networks.weu.name
resource_group_name = local.common.virtual_networks.weu.resource_group_name
}

prod01 = {
id = local.common.virtual_networks.prod01.id
name = local.common.virtual_networks.prod01.name
resource_group_name = local.common.virtual_networks.prod01.resource_group_name
}
}
}
Expand All @@ -23,10 +29,10 @@ output "pep_subnets" {
EOF
value = {
itn = {
id = local.core.networking.itn.pep_snet.id
id = local.common.pep_subnets.itn.id
},
weu = {
id = local.core.networking.weu.pep_snet.id
id = local.common.pep_subnets.weu.id
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/common/prod/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,10 @@ No inputs.

## Outputs

No outputs.
| Name | Description |
|------|-------------|
| <a name="output_apim"></a> [apim](#output\_apim) | n/a |
| <a name="output_pep_subnets"></a> [pep\_subnets](#output\_pep\_subnets) | n/a |
| <a name="output_private_endpoints"></a> [private\_endpoints](#output\_private\_endpoints) | n/a |
| <a name="output_virtual_networks"></a> [virtual\_networks](#output\_virtual\_networks) | n/a |
<!-- END_TF_DOCS -->
49 changes: 49 additions & 0 deletions src/common/prod/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
output "apim" {
value = {
itn = {
id = module.apim_itn.id
resource_group_common = local.resource_groups.itn.common
resource_group_internal = local.resource_groups.itn.internal
}
weu = {
id = module.apim_weu.id
resource_group_common = local.core.resource_groups.westeurope.common
resource_group_internal = local.core.resource_groups.westeurope.internal
}
}
}

output "private_endpoints" {
value = module.private_endpoints.private_endpoints
}

output "virtual_networks" {
value = {
weu = {
id = local.core.networking.weu.vnet_common.id
name = local.core.networking.weu.vnet_common.name
resource_group_name = local.core.networking.weu.vnet_common.resource_group_name
}
itn = {
id = local.core.networking.itn.vnet_common.id
name = local.core.networking.itn.vnet_common.name
resource_group_name = local.core.networking.itn.vnet_common.resource_group_name
}
prod01 = {
id = data.azurerm_virtual_network.weu_prod01.id
name = data.azurerm_virtual_network.weu_prod01.name
resource_group_name = data.azurerm_virtual_network.weu_prod01.resource_group_name
}
}
}

output "pep_subnets" {
value = {
itn = {
id = local.core.networking.itn.pep_snet.id
},
weu = {
id = local.core.networking.weu.pep_snet.id
}
}
}

0 comments on commit d938505

Please sign in to comment.