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

feat: nuovo endpoint apisix #2554

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions src/next-core/00_key_vault.tf
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ data "azurerm_key_vault_certificate" "kibana" {
key_vault_id = module.key_vault.id
}

data "azurerm_key_vault_certificate" "apisix" {
name = var.app_gateway_apisix_certificate_name
key_vault_id = module.key_vault.id
}

data "azurerm_key_vault_certificate" "wisp2govit" {
count = (var.app_gateway_wisp2govit_certificate_name == "") ? 0 : 1

Expand Down
10 changes: 10 additions & 0 deletions src/next-core/01_dns_public.tf
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ resource "azurerm_dns_a_record" "dns_a_kibana" {
records = [azurerm_public_ip.appgateway_public_ip.ip_address]
tags = var.tags
}

resource "azurerm_dns_a_record" "dns_a_apisix" {
count = var.env_short == "d" ? 1 : 0
name = "apisix"
zone_name = azurerm_dns_zone.public[0].name
resource_group_name = azurerm_resource_group.rg_vnet.name
ttl = var.dns_default_ttl_sec
records = [azurerm_public_ip.appgateway_public_ip.ip_address]
tags = var.tags
}
# #####################
# Replicate to PRF env
# #####################
Expand Down
41 changes: 41 additions & 0 deletions src/next-core/04_appgw.tf
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,23 @@ locals {
)
}
}

apisix = {
protocol = "Https"
host = format("apisix.%s.%s", var.dns_zone_prefix, var.external_domain)
port = 443
ssl_profile_name = format("%s-ssl-profile", local.product)
firewall_policy_id = null

certificate = {
name = var.app_gateway_apisix_certificate_name
id = replace(
data.azurerm_key_vault_certificate.apisix.secret_id,
"/${data.azurerm_key_vault_certificate.apisix.version}",
""
)
}
}
}
public_listeners_apiprf = {
apiprf = {
Expand Down Expand Up @@ -199,6 +216,13 @@ locals {
rewrite_rule_set_name = "rewrite-rule-set-kibana"
priority = 40
}

apisix = {
listener = "apisix"
backend = "apisix"
rewrite_rule_set_name = "rewrite-rule-set-apisix"
priority = 70
}
}

public_routes_apiprf = {
Expand Down Expand Up @@ -288,6 +312,18 @@ locals {
request_timeout = 10
pick_host_name_from_backend = false
}

apisix = {
protocol = "Https"
host = var.env == "prod" ? "weu${var.env}.apisix.internal.platform.pagopa.it" : "weu${var.env}.apisix.internal.${var.env}.platform.pagopa.it"
port = 443
ip_addresses = [var.ingress_elk_load_balancer_ip]
fqdns = [var.env == "prod" ? "weu${var.env}.apisix.internal.platform.pagopa.it" : "weu${var.env}.apisix.internal.${var.env}.platform.pagopa.it"]
probe = "/v1/healthcheck"
probe_name = "probe-apisix"
request_timeout = 10
pick_host_name_from_backend = false
}
}

public_backends_upload = {
Expand Down Expand Up @@ -557,6 +593,11 @@ module "app_gw" {
},
]
},
{
name = "rewrite-rule-set-apisix"
rewrite_rules = [
]
},

]
# TLS
Expand Down
6 changes: 6 additions & 0 deletions src/next-core/99_variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,12 @@ variable "app_gateway_kibana_certificate_name" {
default = ""
}

variable "app_gateway_apisix_certificate_name" {
type = string
description = "Application gateway api certificate name on Key Vault"
default = ""
}

variable "app_gateway_sku_name" {
type = string
description = "The Name of the SKU to use for this Application Gateway. Possible values are Standard_Small, Standard_Medium, Standard_Large, Standard_v2, WAF_Medium, WAF_Large, and WAF_v2"
Expand Down
1 change: 1 addition & 0 deletions src/next-core/env/dev/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,7 @@ app_gateway_wisp2_certificate_name = "dev-wisp2-pagopa-it"
app_gateway_wisp2govit_certificate_name = ""
app_gateway_wfespgovit_certificate_name = ""
app_gateway_kibana_certificate_name = "kibana-dev-platform-pagopa-it"
app_gateway_apisix_certificate_name = "apisix-dev-platform-pagopa-it"
app_gateway_sku_name = "Standard_v2"
app_gateway_sku_tier = "Standard_v2"
app_gateway_waf_enabled = false
Expand Down
Loading