Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EC-216] Move io-selfcare resource groups in their own configuration #914

Merged
merged 5 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove rgs from core
  • Loading branch information
Krusty93 committed Mar 19, 2024
commit 57a0e695154e5dca34c127a0b9b313ad210b12ab
4 changes: 2 additions & 2 deletions src/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,6 @@
| [azurerm_resource_group.rg_linux](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource |
| [azurerm_resource_group.rg_vnet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource |
| [azurerm_resource_group.sec_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource |
| [azurerm_resource_group.selfcare_be_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource |
| [azurerm_resource_group.selfcare_fe_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource |
| [azurerm_resource_group.services_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource |
| [azurerm_resource_group.shared_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource |
| [azurerm_resource_group.weu_beta_vnet_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource |
Expand Down Expand Up @@ -534,6 +532,8 @@
| [azurerm_linux_web_app.cms_backoffice_app](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/linux_web_app) | data source |
| [azurerm_linux_web_app.firmaconio_selfcare_web_app](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/linux_web_app) | data source |
| [azurerm_resource_group.notifications_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/resource_group) | data source |
| [azurerm_resource_group.selfcare_be_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/resource_group) | data source |
| [azurerm_resource_group.selfcare_fe_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/resource_group) | data source |
| [azurerm_storage_account.citizen_auth_common](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/storage_account) | data source |
| [azurerm_storage_account.iopstapp](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/storage_account) | data source |
| [azurerm_storage_account.logs](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/storage_account) | data source |
Expand Down
2 changes: 1 addition & 1 deletion src/core/devportal.tf
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ module "appservice_devportal_be" {
source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//app_service?ref=v7.61.0"

name = format("%s-app-devportal-be", local.project)
resource_group_name = azurerm_resource_group.selfcare_be_rg.name
resource_group_name = data.azurerm_resource_group.selfcare_be_rg.name

plan_type = "external"
plan_id = azurerm_service_plan.selfcare_be_common.id
Expand Down
2 changes: 1 addition & 1 deletion src/core/function_devportal_service_data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ locals {
// we share some resources
app_context = {
name = "devportalsrvdata" # devportalservicedata would result in a name too long
resource_group = azurerm_resource_group.selfcare_be_rg
resource_group = data.azurerm_resource_group.selfcare_be_rg
app_service_plan = azurerm_service_plan.selfcare_be_common
snet = module.selfcare_be_common_snet
vnet = module.vnet_common
Expand Down
2 changes: 1 addition & 1 deletion src/core/function_subscription_migrations.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ locals {
// we share some resources
app_context = {
name = "subsmigrations"
resource_group = azurerm_resource_group.selfcare_be_rg
resource_group = data.azurerm_resource_group.selfcare_be_rg
app_service_plan = azurerm_service_plan.selfcare_be_common
snet = module.selfcare_be_common_snet
vnet = module.vnet_common
Expand Down
28 changes: 11 additions & 17 deletions src/core/selfcare.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ locals {
}

### Frontend common resources
resource "azurerm_resource_group" "selfcare_fe_rg" {
name = "${local.project}-selfcare-fe-rg"
location = var.location

tags = var.tags
data "azurerm_resource_group" "selfcare_fe_rg" {
name = "${local.project}-selfcare-fe-rg"
}

### Frontend resources
Expand All @@ -26,8 +23,8 @@ module "selfcare_cdn" {

name = "selfcare"
prefix = local.project
resource_group_name = azurerm_resource_group.selfcare_fe_rg.name
location = azurerm_resource_group.selfcare_fe_rg.location
resource_group_name = data.azurerm_resource_group.selfcare_fe_rg.name
location = data.azurerm_resource_group.selfcare_fe_rg.location
hostname = "${var.dns_zone_io_selfcare}.${var.external_domain}"
https_rewrite_enabled = true

Expand Down Expand Up @@ -76,11 +73,8 @@ module "selfcare_cdn" {
}

### Backend common resources
resource "azurerm_resource_group" "selfcare_be_rg" {
name = format("%s-selfcare-be-rg", local.project)
location = var.location

tags = var.tags
data "azurerm_resource_group" "selfcare_be_rg" {
name = format("%s-selfcare-be-rg", local.project)
}

## key vault
Expand Down Expand Up @@ -129,8 +123,8 @@ module "selfcare_jwt" {

resource "azurerm_service_plan" "selfcare_be_common" {
name = format("%s-plan-selfcare-be-common", local.project)
location = azurerm_resource_group.selfcare_be_rg.location
resource_group_name = azurerm_resource_group.selfcare_be_rg.name
location = data.azurerm_resource_group.selfcare_be_rg.location
resource_group_name = data.azurerm_resource_group.selfcare_be_rg.name

os_type = "Linux"
sku_name = var.selfcare_plan_sku_size
Expand Down Expand Up @@ -176,7 +170,7 @@ module "appservice_selfcare_be" {
source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//app_service?ref=v7.61.0"

name = format("%s-app-selfcare-be", local.project)
resource_group_name = azurerm_resource_group.selfcare_be_rg.name
resource_group_name = data.azurerm_resource_group.selfcare_be_rg.name

plan_type = "external"
plan_id = azurerm_service_plan.selfcare_be_common.id
Expand Down Expand Up @@ -275,8 +269,8 @@ module "appservice_selfcare_be" {

resource "azurerm_monitor_autoscale_setting" "appservice_selfcare_be_common" {
name = format("%s-autoscale", azurerm_service_plan.selfcare_be_common.name)
resource_group_name = azurerm_resource_group.selfcare_be_rg.name
location = azurerm_resource_group.selfcare_be_rg.location
resource_group_name = data.azurerm_resource_group.selfcare_be_rg.name
location = data.azurerm_resource_group.selfcare_be_rg.location
target_resource_id = azurerm_service_plan.selfcare_be_common.id

profile {
Expand Down