Giter Club home page Giter Club logo

terraform-kvm's Introduction

terraform-kvm

Example file for managing 2 ubuntu servers on KVM by terraform.

NOTE: This is for my reference. I do not recommend to use it in a production environment.

Topology

For simplifying the explanation, the figure omits some technical details, for instance, the interface name connected to the external network, etc.

topology

Each VM has 2 interfaces: end3 and ens4.

  • ens3 is connected to the external network
  • ens4 is for the management interface.
    • Terraform automatically create a virtual network named mgmt0.
    • br-mgmt0 will be automatically created on host OS by terraform.

We assume that host OS has br0 interface (it is used for bridging external network)

  • Network range is 192.168.128.0/24
  • Gateway address is 192.168.128.1
  • No DHCP

By default, terraform creates 2 users (defined in cloud_init.cfg in each directory)

  • user (with sudo): terraform / UserPassword!
  • root: root / RootPassword!

Run

Before running this, you need to install terraform-provider-libvirt.

All the following command should be run as root.

Setup VM and network

terraform init
terraform apply

Delete VM and network created by terraform

terraform destroy

terraform-kvm's People

Contributors

skjune12 avatar

Watchers

 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.