Giter VIP home page Giter VIP logo

ned1313 / terraform-azurerm-vmss-cloudinit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from azure/terraform-azurerm-vmss-cloudinit

0.0 2.0 2.0 23 KB

Terraform AzureRM module registry to create a VM Scaleset initialized via cloud-init scripts

Home Page: https://registry.terraform.io/modules/Azure/vmss-cloudinit/azurerm/

License: MIT License

Dockerfile 8.84% Ruby 8.29% Smarty 1.05% HCL 59.24% Go 22.58%

terraform-azurerm-vmss-cloudinit's Introduction

Deploys a group of Cloud-Init enabled Virtual Machines in a Scale Set

Build Status

This Terraform module deploys a Virtual Machines Scale Set in Azure, initializes the VMs using Cloud-int for cloud-init-enabled virtual machine images, and returns the id of the VM scale set deployed.

This module requires a network and loadbalancer to be provided separately such as the "Azure/network/azurerm" and "Azure/loadbalancer/azurerm" modules.

Visit this website for more information about cloud-init. Some quick tips:

  • Troubleshoot logging via /var/log/cloud-init.log
  • Relevant applied cloud configuration information can be found in the /var/lib/cloud/instance directory
  • By default this module will create a new txt file /tmp/terraformtest to validate if cloud-init worked

To override the cloud-init configuration, place a file called cloudconfig.tpl in the root of the module directory with the cloud-init contents or update the cloudconfig_file variable with the location of the file containing the desired configuration.

Valid values for vm_os_simple are the latest versions of:

  • UbuntuServer = 16.04-LTS
  • UbuntuServer14 = 14.04.5-LTS
  • RHEL = RedHat Enterprise Linux 7
  • CentOS = CentOS 7
  • CoreOS = CoreOS Stable

Usage

provider "azurerm" {
  version = "~> 1.0"
}

variable "resource_group_name" {
  default = "terraform-vmss-cloudinit"
}

variable "location" {
  default = "eastus"
}

module "network" {
  source              = "Azure/network/azurerm"
  location            = "${var.location}"
  resource_group_name = "${var.resource_group_name}"
}

module "loadbalancer" {
  source              = "Azure/loadbalancer/azurerm"
  resource_group_name = "${var.resource_group_name}"
  location            = "${var.location}"
  prefix              = "terraform-test"

  "remote_port" {
    ssh = ["Tcp", "22"]
  }

  "lb_port" {
    http = ["80", "Tcp", "80"]
  }
}

module "vmss-cloudinit" {
  source                                 = "Azure/vmss-cloudinit/azurerm"
  resource_group_name                    = "${var.resource_group_name}"
  cloudconfig_file                       = "${path.module}/cloudconfig.tpl"
  location                               = "${var.location}"
  vm_size                                = "Standard_DS2_v2"
  admin_username                         = "azureuser"
  admin_password                         = "ComplexPassword"
  ssh_key                                = "~/.ssh/id_rsa.pub"
  nb_instance                            = 2
  vm_os_simple                           = "UbuntuServer"
  vnet_subnet_id                         = "${module.network.vnet_subnets[0]}"
  load_balancer_backend_address_pool_ids = "${module.loadbalancer.azurerm_lb_backend_address_pool_id}"
}

output "vmss_id" {
  value = "${module.vmss-cloudinit.vmss_id}"
}

Test

Configurations

We provide 2 ways to build, run, and test the module on a local development machine. Native (Mac/Linux) or Docker.

Native (Mac/Linux)

Prerequisites

Quick Run

We provide simple script to quickly set up module development environment:

$ curl -sSL https://raw.githubusercontent.com/Azure/terramodtest/master/tool/env_setup.sh | sudo bash

Then simply run it in local shell:

$ cd $GOPATH/src/{directory_name}/
$ bundle install
$ rake build
$ rake e2e

Docker

We provide a Dockerfile to build a new image based FROM the microsoft/terraform-test Docker hub image which adds additional tools / packages specific for this module (see Custom Image section). Alternatively use only the microsoft/terraform-test Docker hub image by using these instructions.

Prerequisites

Custom Image

This builds the custom image:

$ docker build --build-arg BUILD_ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID --build-arg BUILD_ARM_CLIENT_ID=$ARM_CLIENT_ID --build-arg BUILD_ARM_CLIENT_SECRET=$ARM_CLIENT_SECRET --build-arg BUILD_ARM_TENANT_ID=$ARM_TENANT_ID -t azure-vmss-cloudinit .

This runs the build and unit tests:

$ docker run --rm azure-vmss-cloudinit /bin/bash -c "bundle install && rake build"

This runs the end to end tests:

$ docker run --rm azure-vmss-cloudinit /bin/bash -c "bundle install && rake e2e"

This runs the full tests:

$ docker run --rm azure-vmss-cloudinit /bin/bash -c "bundle install && rake full"

Authors

Originally created by David Tesar

License

MIT

terraform-azurerm-vmss-cloudinit's People

Contributors

dtzar avatar microsoftopensource avatar metacpp avatar msftgits avatar foreverxzc avatar

Watchers

James Cloos avatar  avatar

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.