Skip to content

Commit

Permalink
added printit rg
Browse files Browse the repository at this point in the history
  • Loading branch information
mamari90 committed Dec 11, 2024
1 parent 3423c1c commit c7f65a0
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 23 deletions.
48 changes: 28 additions & 20 deletions src/domains/printit-app/01_app_service_pdf_engine_clone.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
resource "azurerm_resource_group" "printit_pdf_engine_app_service_rg_clone" {
count = var.is_feature_enabled.pdf_engine_clone ? 1 : 0
name = "${local.project}-pdf-engine-clone-rg"
location = var.location

tags = var.tags
}

################
# node
################
Expand All @@ -8,7 +16,7 @@ module "printit_pdf_engine_app_service_clone" {
count = var.is_feature_enabled.pdf_engine_clone ? 1 : 0

vnet_integration = false
resource_group_name = azurerm_resource_group.printit_pdf_engine_app_service_rg.name
resource_group_name = azurerm_resource_group.printit_pdf_engine_app_service_rg_clone[0].name
location = var.location

# App service plan vars
Expand Down Expand Up @@ -52,7 +60,7 @@ module "printit_pdf_engine_slot_staging_clone" {

# App service
name = "staging"
resource_group_name = azurerm_resource_group.printit_pdf_engine_app_service_rg.name
resource_group_name = azurerm_resource_group.printit_pdf_engine_app_service_rg_clone[0].name
location = var.location

always_on = true
Expand All @@ -78,8 +86,8 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_printit_pdf_
enabled = var.app_service_pdf_engine_autoscale_enabled

name = "${local.project}-autoscale-pdf-engine-clone"
resource_group_name = azurerm_resource_group.printit_pdf_engine_app_service_rg.name
location = azurerm_resource_group.printit_pdf_engine_app_service_rg.location
resource_group_name = azurerm_resource_group.printit_pdf_engine_app_service_rg_clone[0].name
location = azurerm_resource_group.printit_pdf_engine_app_service_rg_clone[0].location
target_resource_id = module.printit_pdf_engine_app_service_clone[0].plan_id

profile {
Expand All @@ -95,7 +103,7 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_printit_pdf_
rule {
metric_trigger {
metric_name = "Requests"
metric_resource_id = module.printit_pdf_engine_app_service[0].id
metric_resource_id = module.printit_pdf_engine_app_service_clone[0].id
metric_namespace = "microsoft.web/sites"
time_grain = "PT1M"
statistic = "Average"
Expand All @@ -117,7 +125,7 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_printit_pdf_
rule {
metric_trigger {
metric_name = "Requests"
metric_resource_id = module.printit_pdf_engine_app_service[0].id
metric_resource_id = module.printit_pdf_engine_app_service_clone[0].id
metric_namespace = "microsoft.web/sites"
time_grain = "PT1M"
statistic = "Average"
Expand All @@ -143,7 +151,7 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_printit_pdf_
rule {
metric_trigger {
metric_name = "HttpResponseTime"
metric_resource_id = module.printit_pdf_engine_app_service[0].id
metric_resource_id = module.printit_pdf_engine_app_service_clone[0].id
metric_namespace = "microsoft.web/sites"
time_grain = "PT1M"
statistic = "Average"
Expand All @@ -165,7 +173,7 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_printit_pdf_
rule {
metric_trigger {
metric_name = "HttpResponseTime"
metric_resource_id = module.printit_pdf_engine_app_service[0].id
metric_resource_id = module.printit_pdf_engine_app_service_clone[0].id
metric_namespace = "microsoft.web/sites"
time_grain = "PT1M"
statistic = "Average"
Expand All @@ -191,7 +199,7 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_printit_pdf_
rule {
metric_trigger {
metric_name = "CpuPercentage"
metric_resource_id = module.printit_pdf_engine_app_service[0].plan_id
metric_resource_id = module.printit_pdf_engine_app_service_clone[0].plan_id
metric_namespace = "microsoft.web/serverfarms"
time_grain = "PT1M"
statistic = "Average"
Expand All @@ -213,7 +221,7 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_printit_pdf_
rule {
metric_trigger {
metric_name = "CpuPercentage"
metric_resource_id = module.printit_pdf_engine_app_service[0].plan_id
metric_resource_id = module.printit_pdf_engine_app_service_clone[0].plan_id
metric_namespace = "microsoft.web/serverfarms"
time_grain = "PT1M"
statistic = "Average"
Expand Down Expand Up @@ -245,7 +253,7 @@ module "printit_pdf_engine_app_service_java_clone" {
count = var.is_feature_enabled.pdf_engine_clone ? 1 : 0

vnet_integration = false
resource_group_name = azurerm_resource_group.printit_pdf_engine_app_service_rg.name
resource_group_name = azurerm_resource_group.printit_pdf_engine_app_service_rg_clone[0].name
location = var.location

# App service plan vars
Expand Down Expand Up @@ -287,7 +295,7 @@ module "printit_pdf_engine_java_slot_staging_clone" {

# App service
name = "staging"
resource_group_name = azurerm_resource_group.printit_pdf_engine_app_service_rg.name
resource_group_name = azurerm_resource_group.printit_pdf_engine_app_service_rg_clone[0].name
location = var.location

always_on = true
Expand All @@ -313,8 +321,8 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_printit_pdf_


name = "${local.project}-autoscale-pdf-engine-java-clone"
resource_group_name = azurerm_resource_group.printit_pdf_engine_app_service_rg.name
location = azurerm_resource_group.printit_pdf_engine_app_service_rg.location
resource_group_name = azurerm_resource_group.printit_pdf_engine_app_service_rg_clone[0].name
location = azurerm_resource_group.printit_pdf_engine_app_service_rg_clone[0].location
target_resource_id = module.printit_pdf_engine_app_service_java_clone[0].plan_id
enabled = var.app_service_pdf_engine_autoscale_enabled

Expand All @@ -331,7 +339,7 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_printit_pdf_
rule {
metric_trigger {
metric_name = "Requests"
metric_resource_id = module.printit_pdf_engine_app_service_java[0].id
metric_resource_id = module.printit_pdf_engine_app_service_java_clone[0].id
metric_namespace = "microsoft.web/sites"
time_grain = "PT1M"
statistic = "Average"
Expand All @@ -353,7 +361,7 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_printit_pdf_
rule {
metric_trigger {
metric_name = "Requests"
metric_resource_id = module.printit_pdf_engine_app_service_java[0].id
metric_resource_id = module.printit_pdf_engine_app_service_java_clone[0].id
metric_namespace = "microsoft.web/sites"
time_grain = "PT1M"
statistic = "Average"
Expand All @@ -379,7 +387,7 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_printit_pdf_
rule {
metric_trigger {
metric_name = "HttpResponseTime"
metric_resource_id = module.printit_pdf_engine_app_service_java[0].id
metric_resource_id = module.printit_pdf_engine_app_service_java_clone[0].id
metric_namespace = "microsoft.web/sites"
time_grain = "PT1M"
statistic = "Average"
Expand All @@ -401,7 +409,7 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_printit_pdf_
rule {
metric_trigger {
metric_name = "HttpResponseTime"
metric_resource_id = module.printit_pdf_engine_app_service_java[0].id
metric_resource_id = module.printit_pdf_engine_app_service_java_clone[0].id
metric_namespace = "microsoft.web/sites"
time_grain = "PT1M"
statistic = "Average"
Expand All @@ -427,7 +435,7 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_printit_pdf_
rule {
metric_trigger {
metric_name = "CpuPercentage"
metric_resource_id = module.printit_pdf_engine_app_service_java[0].plan_id
metric_resource_id = module.printit_pdf_engine_app_service_java_clone[0].plan_id
metric_namespace = "microsoft.web/serverfarms"
time_grain = "PT1M"
statistic = "Average"
Expand All @@ -449,7 +457,7 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_printit_pdf_
rule {
metric_trigger {
metric_name = "CpuPercentage"
metric_resource_id = module.printit_pdf_engine_app_service_java[0].plan_id
metric_resource_id = module.printit_pdf_engine_app_service_java_clone[0].plan_id
metric_namespace = "microsoft.web/serverfarms"
time_grain = "PT1M"
statistic = "Average"
Expand Down
1 change: 1 addition & 0 deletions src/domains/printit-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ No outputs.
| [azurerm_monitor_scheduled_query_rules_alert.print-notice-retry-fn-error-alert](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_scheduled_query_rules_alert) | resource |
| [azurerm_private_dns_a_record.ingress](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/private_dns_a_record) | resource |
| [azurerm_resource_group.printit_pdf_engine_app_service_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource |
| [azurerm_resource_group.printit_pdf_engine_app_service_rg_clone](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource |
| [helm_release.cert_mounter](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_namespace.namespace](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource |
Expand Down
6 changes: 3 additions & 3 deletions src/domains/shared-app/01_app_service_pdf_engine.tf
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_shared_pdf_e
name = "default"

capacity {
default = 1
minimum = 1
maximum = 1
default = var.env_short == "p" ? 3 : 1
minimum = var.env_short == "p" ? 3 : 1
maximum = var.env_short == "p" ? 12 : 1
}

# Requests
Expand Down

0 comments on commit c7f65a0

Please sign in to comment.