Coder Social home page Coder Social logo

azure-terraform's Introduction

README

Revised for Terraform AzureRM v2.1

Sample architecture

sample architecture

N-Tier architecture service with a jumphost and a NAT instance. NAT instance is used for SNATing outbound from VMs in app-subnet.

Other samples:

How to run

Preparation

Download and install terraform: https://www.terraform.io/downloads.html

Update variables such as subscription_id and admin_name in variables.tf

Azure Service principal

Run following command to get a service principal info. Note that if you have multiple subscriptions then you should set right default subscription.

az account set -s <subscription_id>
az ad sp create-for-rbac --role="Contributor" --scopes="/subscriptions/<subscription_id>"

You don't need to create SP if you're using Azure CLI environment, such as Azure Shell. See Authenticating using the Azure CLI for more information

You can also enable MSI to run terraform witout SP on your Azure VM. See Authenticating using managed identities for Azure resources and please refer (MSI documentation)[https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/tutorial-linux-vm-access-arm] for how to setup MSI.

Run terraform

Initialize first,

terraform init

Then apply terraform

terraform apply

Feature highlight

  1. VM login - ssh public key or password
  2. Disk - OS disk with >30GiB and datadisk
  3. OS image - default or custom image for building custom image, refer packer
  4. Create multiple VMs
  5. Setting LB
  6. NAT Gateway - no more NAT instance
  7. ASG - create and apply ASG
  8. Blob - create blob account and upload a file

For more information, please refer DOC.md

SNAT test

After provisioned, login to one of app vm through jump box and test source ip using following command

curl ipinfo.io

Reference

Azure

Terraform

Tips

azure-terraform's People

Contributors

iljoong avatar

Watchers

 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.