This stack deploy the common infrastructure, mainly the exposition of service to Internet.
Generate the wildcard SSL certiticate for the domain you want to use. Push it in the key vault as certificate.
It is also possible to use multiple certificates for différents domains or for different dedicated records. Just adapt the application gateway configuration (http_listener, request_routing_rule) accordingly.
Check the variables of the stack in the file variables.tf.
Name of the domain to use:
variable "domain" {
type = string
default = "linkbynet.com"
}
The name of the wildcard certificate corresponding to the domain if you want to use the Application Gateay for SSL termination:
variable "certificate_wildcard_name_in_vault" {
type = string
default = "wildcard-linkbynet-com"
}
Note: It is used only if you set the
ssl_certificate
block in the application gateway resource.
the list of the DNS of your applications that you have pointed to the public IP of the gateway application and need to be redirected to the right AKS environments:
variable "exposed_dns" {
type = map
default = {
"app-dev" = {
"dns" = "dev.linkbynet.com"
"env" = "dev"
"protocol" = "Http"
}
}
}
Note:
- In this example I use a http listner because I don't have control over the domain I'm using
- If you configure the SSL termination on the Application Gateway, you should indicate the
Https
protocol instead- These DNS are also the ones used in the ingress rules when deploying application in the different environments
Adapt the list of vnets you want to peer with the hub:
# The name corresponds to both vnet name and resource group name
variable "vnet_spoke_to_peer" {
type = list
default = [
"hub-and-spoke-aks-dev"
]
}
Note: All vnets in the list must exist or you may have errors when executing the stack.
Apply differences with the live infrastructure:
$ cd terraform/hub
$ terraform apply
Check the backend health of the Application Gateway.
As long as the backend is not indicated as healthy the Application Gateway will never forward requests and you will get an HTTP 502 error (Bad Gateway).