Git Product home page Git Product logo

terraform-azurerm-compute's Introduction

Deploys 1+ Virtual Machines to your provided VNet

This Terraform module deploys Virtual Machines in Azure with the following characteristics:

  • Ability to specify a simple string to get the latest marketplace image using var.vm_os_simple
  • All VMs use managed disks
  • Network Security Group (NSG) created and only if var.remote_port specified, then remote access rule created and opens this port to all nics
  • VM nics attached to a single virtual network subnet of your choice (new or existing) via var.vnet_subnet_id.
  • Public IP is created and attached only to the first VM's nic. Once into this VM, connection can be make to the other vms using the private ip on the VNet.

Usage

Provisions 2 Windows 2016 Datacenter Server VMs using vm_os_simple to a new VNet and opens up port 3389 for RDP access:

module "mycompute" {
  source = "Azure/compute/azurerm"
  resource_group_name = "mycompute"
  location = "East US 2"
  admin_password = "ComplxP@ssw0rd!"
  vm_os_simple = "WindowsServer"
  public_ip_dns = "mywinsrv252"
  remote_port = "3389"
  nb_instances = 2
  vnet_subnet_id = "${module.network.vnet_subnets[0]}"
}

module "network" {
  source = "Azure/network/azurerm"
  location = "East US 2"
  resource_group_name = "mycompute"
}

output "vm_public_name"{
  value = "${module.mycompute.public_ip_dns_name}"
}

output "vm_public_ip" {
  value = "${module.mycompute.public_ip_address}"
}

output "vm_private_ips" {
  value = "${module.mycompute.network_interface_private_ip}"
}

Provisions 2 Ubuntu 14.04 Server VMs using vm_os_publisher, vm_os_offer and vm_os_sku to a new VNet and opens up port 22 for SSH access with ~/.ssh/id_rsa.pub :

module "mycompute2" { 
    source              = "Azure/compute/azurerm"
    resource_group_name = "mycompute2"
    location            = "westus"
    public_ip_dns       = "myubuntuservers225"
    remote_port         = "22"
    nb_instances        = 2
    vm_os_publisher     = "Canonical"
    vm_os_offer         = "UbuntuServer"
    vm_os_sku           = "14.04.2-LTS"
    vnet_subnet_id      = "${module.network.vnet_subnets[0]}"
    tags                = {
                            environment = "dev"
                            costcenter  = "it"
                          }
}
  module "network" {
    source 		= "Azure/network/azurerm"
    location 		= "westus"
    resource_group_name = "mycompute2"
}

Authors

Originally created by David Tesar

License

MIT

terraform-azurerm-compute's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.