Git Product home page Git Product logo

daria-barsukova / terraform-provider-virtualbox Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mixdone/terraform-provider-virtualbox

1.0 1.0 0.0 25.86 MB

The main goal of our project is to create a Terraform provider to work with VirtualBox, which will allow users of our add-on to comfortably use the resources of virtual machines in full.

License: Apache License 2.0

Go 93.53% Makefile 3.30% HCL 3.17%

terraform-provider-virtualbox's Introduction

Terraform logo VirtualBox logo

terraform-provider-virtualbox

Release Installs Registry License
Go Status Lint Status Go Report Card

The Terraform Provider allows Terraform to manage VirtualBox resources.

Requirements

Provider Capabilities

The provider provides the following features:

  1. Creating a virtual machine:

    • Accept input parameters such as the name of the virtual machine, the path to the image, the size of memory, the number of processors and other configuration parameters.
    • Create a folder for the virtual machine in the specified folder.
    • Assign a status to the VM (for example, "running" or "poweroff").
    • Configure the network adapter with a specific operating mode, type of NIC, whether the cable is connected and port forwarding settings.
    • Transfer user data (for example, configuration scripts) inside the virtual machine.
  2. Updating the virtual machine:

    • Update the parameters of the virtual machine.
    • Change the configuration of the network adapter, including the operating mode and port settings.
    • Update user data.
  3. Deleting a virtual machine:

    • Remove a VM from the infrastructure.
    • Clear the folder with the virtual machine data.
  4. Network Settings Management:

    • Add/remove port forwarding settings for the virtual machine.
  5. Getting information about a virtual machine:

    • Return information about the current state of the virtual machine, such as status, memory usage, number of processors, and other parameters.
  6. Working with images:

    • Upload images from the specified URL.
    • Manage paths to images and their sizes.
  7. Managing virtual machine snapshots, including creating new snapshots, editing snapshot descriptions, and deleting existing snapshots.

Example usage

# Define a VirtualBox server resource for creating VMs with network configurations
resource "virtualbox_server" "VM_network" {
  count   = 0
  name    = format("VM_network-%02d", count.index + 1)  # Name of the VM
  basedir = format("VM_network-%02d", count.index + 1)  # Base directory for VM files
  cpus    = 3                                           # Number of CPUs for the VM
  memory  = 500                                         # Amount of memory in MB for the VM

  # Network adapter configurations
  network_adapter {
    network_mode = "nat"                                # NAT mode for network adapter
    port_forwarding {
      name      = "rule1"
      hostip    = ""                                    # Host IP address for port forwarding
      hostport  = "80"                                  # Host port for port forwarding
      guestip   = ""                                    # Guest IP address for port forwarding
      guestport = "63222"                               # Guest port for port forwarding
    }
  }
  network_adapter {
    network_mode    = "nat"                             # NAT mode for network adapter
    nic_type        = "82540EM"                         # Type of network interface controller
    cable_connected = true                              # Whether the cable is connected
  }
  network_adapter {
    network_mode = "hostonly"                          # Host-only mode for network adapter
  }
  network_adapter {
    network_mode = "bridged"                            # Bridged mode for network adapter
    nic_type     = "virtio"                             # Type of network interface controller
  }

  status = "poweroff"                                   # Initial status of the VM
}

# Define a VirtualBox server resource for creating VMs with snapshots
resource "virtualbox_server" "VM_Shapshots" {
  count   = 0
  name    = format("VM_Snapshots-%02d", count.index + 1)  # Name of the VM
  basedir = format("VM_Snapshots-%02d", count.index + 1)  # Base directory for VM files
  cpus    = 4                                              # Number of CPUs for the VM
  memory  = 2000                                           # Amount of memory in MB for the VM

  # Define snapshots for the VM
  snapshot {
    name        = "first"                                  # Name of the snapshot
    description = "example"                                # Description of the snapshot
  }

  snapshot {
    name     = "second"                                    # Name of the snapshot
    description = "example"                                # Description of the snapshot
    current  = true                                        # Set this snapshot as current
  }
}

Support

For any issues or questions related to this provider, please open an issue on the GitHub repository

License

The Terraform Provider VirtualBox is available to everyone under the terms of the Apache Public License Version 2.0. Take a look the LICENSE file.

terraform-provider-virtualbox's People

Contributors

fojnk avatar daria-barsukova avatar an-mrv avatar mixdone avatar

Stargazers

Pavel Lashkevych avatar

Watchers

Pavel Lashkevych 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.