Complete the code to define the active environment variable for blue-green deployment.
variable "active_environment" { type = string default = "[1]" }
The default active environment is set to "blue" to start the blue-green deployment.
Complete the code to create a resource group for the green environment.
resource "azurerm_resource_group" "green" { name = "rg-[1]" location = var.location }
The resource group name includes "green" to represent the green environment.
Fix the error in the code to select the inactive environment correctly.
locals {
inactive_environment = var.active_environment == "blue" ? "[1]" : "blue"
}If the active environment is "blue", the inactive one should be "green" for blue-green deployment.
Fill both blanks to define the load balancer backend pool for the active environment.
resource "azurerm_lb_backend_address_pool" "active_pool" { name = "lb-backend-[1]" resource_group_name = azurerm_resource_group.[2].name loadbalancer_id = azurerm_lb.main.id }
The backend pool name uses the active environment name ("blue"), and the resource group name is referenced from the active environment variable.
Fill all three blanks to switch traffic to the inactive environment by updating the active environment variable and resource group references.
variable "active_environment" { default = "[1]" } resource "azurerm_resource_group" "[2]" { name = "rg-[3]" location = var.location }
To switch traffic, set the active environment variable to "green" and create the resource group for "green" environment.