Skip to content

kolosovpetro/blue-green-deployment

Repository files navigation

Blue-green deployment

Example of how to implement blue-green deployment using Linux VMs and Azure Load Balancer (L4)

Pre-commit configuration

  • Install python3 via windows store
  • pip install --upgrade pip
  • pip install pre-commit
  • Update PATH variable
  • pre-commit install

Install terraform docs

  • choco install terraform-docs

Install tflint

  • choco install tflint

Documentation

Storage account configuration file

storage_account_name = "storage_account_name"
container_name       = "container_name"
key                  = "terraform.tfstate"
sas_token            = "sas_token"

Deploy storage account for terraform state

Module documentation

Requirements

Name Version
azurerm =3.71.0

Providers

Name Version
azurerm 3.71.0

Modules

Name Source Version
blue_slot_ubuntu ./modules/ubuntu-vm-public-key-auth n/a
green_slot_ubuntu ./modules/ubuntu-vm-public-key-auth n/a
lb ./modules/load_balancer n/a
network ./modules/network n/a

Resources

Name Type
azurerm_lb_nat_rule.blue_ssh_nat resource
azurerm_lb_nat_rule.green_ssh_nat resource
azurerm_lb_probe.http_probe resource
azurerm_lb_rule.http_rule_blue resource
azurerm_network_interface_backend_address_pool_association.blue_slot_lb_association resource
azurerm_network_interface_backend_address_pool_association.green_slot_lb_association resource
azurerm_network_interface_nat_rule_association.blue_ssh_association resource
azurerm_network_interface_nat_rule_association.green_ssh_association resource
azurerm_resource_group.public resource
azurerm_client_config.current data source

Inputs

Name Description Type Default Required
ip_configuration_name Name of the IP configuration string n/a yes
network_interface_name Name of the network interface string n/a yes
nsg_name Name of the network security group string n/a yes
os_profile_admin_public_key_path Specifies the public key of the administrator account. string n/a yes
os_profile_admin_username Specifies the name of the administrator account. string n/a yes
os_profile_computer_name Specifies the host OS name of the virtual machine. string n/a yes
prefix Resources name prefix string n/a yes
resource_group_location Location of the resource group. string n/a yes
resource_group_name Resource group name string n/a yes
storage_image_reference_offer Specifies the offer of the platform image or marketplace image used to create the virtual machine. string n/a yes
storage_image_reference_publisher The publisher of the image used to create the virtual machine. string n/a yes
storage_image_reference_sku Specifies the SKU of the platform image or marketplace image used to create the virtual machine. string n/a yes
storage_image_reference_version Specifies the version of the platform image or marketplace image used to create the virtual machine. string n/a yes
storage_os_disk_caching Specifies the caching requirements for the OS disk. string n/a yes
storage_os_disk_create_option Specifies how the virtual machine should be created. string n/a yes
storage_os_disk_managed_disk_type Specifies the storage account type for the managed disk. string n/a yes
storage_os_disk_name The name of the OS disk. string n/a yes
subnet_name Name of the subnet string n/a yes
vm_name Name of the virtual machine string n/a yes
vm_size The size of the virtual machine. string n/a yes
vnet_name Name of the virtual network string n/a yes

Outputs

Name Description
lb_public_ip n/a

About

Example of how to implement blue-green deployment using Linux VMs and Azure Load Balancer (L4)

Topics

Resources

License

Stars

Watchers

Forks