LetsCreatProjects / bootcamp-terraform-IaC-azure-weigth-app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

alt text

Diagram:

alt text

Installation:

1- Install Terraform (https://learn.hashicorp.com/tutorials/terraform/install-cli?in=terraform/aws-get-started)
2- Create azure account
3- Install the Azure CLI and authenticate with Azure with the following command:
az login

Configuration

terraform_creating_elastic_scaleset_with_postgres is template that building an Elastic High Availability virtual network on azure with terraform code. On that infrastructure we are going to deploy a Node.js Weight Tracker App. input for variables for via .tfvars:

  • instance_num =
  • VnetName = ""
  • ScaleSetName = ""
  • admin_user_name = ""
  • admin_password = ""
  • pg_user = ""
  • pg_pass = ""

blob_creation template create container inside blob storage and stores terraform.tfstate file in there (inside RG).

Input variables for port creation via .tfvars:

  • resource_group_name = ""
  • location = ""
  • storage_account_name = ""
  • storage_container_name = ""

The second template blob_insert_into_container inserts file terraform.state inside blob storage container. In order to do that, inset in this folder terraform.state.

Commands to run templates:

  • // init
  • terraform init
  • // plan
  • terraform plan
  • // apply
  • terraform apply

please notice if .tfvars file is needed to add to command: -var-file="{filename}.tfvars"

Requirements

Name Version
terraform >= 1.2.2
azurerm ~> 2.65

Providers

Name Version
azurerm 2.99.0

Modules

Name Source Version
Scale_set_module ./Scalsetmodule n/a

Resources

Name Type
azurerm_lb.App-LoadBalacer resource
azurerm_lb_backend_address_pool.Scale_set_module resource
azurerm_lb_outbound_rule.http resource
azurerm_lb_probe.Helthprobe resource
azurerm_lb_rule.AcceseRole resource
azurerm_lb_rule.ssh resource
azurerm_network_security_group.NSG_backend resource
azurerm_network_security_group.NSG_frontend resource
azurerm_postgresql_flexible_server.PosrgreSQLFlexibleDataServer resource
azurerm_postgresql_flexible_server_configuration.flexible_server_configuration resource
azurerm_postgresql_flexible_server_database.db resource
azurerm_postgresql_flexible_server_firewall_rule.example resource
azurerm_private_dns_zone.Flexibale_Postgres_DataBase_DNS resource
azurerm_private_dns_zone_virtual_network_link.someTestingWithDnsLink resource
azurerm_public_ip.LoadBalacerPublicIp resource
azurerm_resource_group.RG resource
azurerm_subnet.Data_Tier resource
azurerm_subnet.Web_Tier resource
azurerm_subnet_network_security_group_association.NSG_backend_association resource
azurerm_subnet_network_security_group_association.NSG_frontend resource
azurerm_virtual_network.vnet resource

Inputs

Name Description Type Default Required
RG RG_VMSS_with_postgresSQL string "RG_VMSS_with_postgresSQL" no
ScaleSetName ScaleSetName string "AppScaleSet" no
Vnet Vnet string "Vnet" no
VnetName VnetName string "Vnet" no
address_space n/a list(any)
[
"10.10.0.0/16"
]
no
admin_password password for vm login string "Input your password here" no
admin_user_name user name for vm login string "" no
instance_num scale set min instance num to differ the Staging and Production workspaces number 2 no
location Azure location of terraform server environment string "australiaeast" no
pg_pass pg_pass string "" no
pg_user pg_user string "" no
tags tags string "enviroment" no

Outputs

Name Description
password_VMSS n/a

About


Languages

Language:HCL 97.1%Language:Shell 2.9%