---
title: "Vagrant new features enables security group creation"
description: "Vagrant new features enables security group creation"
date: 2014-02-27
tags: ["vagrant","cloudstack","compute"]
url: https://www.exoscale.com/blog/vagrant-updates/
---
# Vagrant new features enables security group creation

> [!NOTE]
> **Vagrant-CloudStack is deprecated**
>
> Please consider the following ways of managing Exoscale instances as
> better alternatives:
>
> - [Exoscale command-line client](https://www.exoscale.com/blog/exoscale-cli-release/) for simple interactions
> - [Terraform](https://www.exoscale.com/blog/managing-existing-infrastructure-with-terraform/) from medium to big setups
> - [Rancher RKE](https://rancher.com/docs/rke/latest/en/) for Kubernetes cluster

A short while ago, we wrote about the [vagrant-cloudstack](https://www.exoscale.com/blog/exoscale-vagrant/)
plugin and its compatibility with Exoscale Open Cloud.

Community efforts have since then bumped features in play with 2 new additions:

## Ability to specify security groups by name

By replacing the property cloudstack.security_group_ids by the new 
cloudstack.security_group_names you can define an array of names you want your 
instances to belong to.

However you still need to have defined the security groups and rules prior to lunching
your `vagrant up`command.

## Ability to create a security group

Therefore the name, description and rules can be created directly from you
Vagrantfile.
Here is an example from the [Pull Request](https://github.com/schubergphilis/vagrant-cloudstack/pull/24)
bringing this feature:

    [...]
    config.vm.provider :cloudstack do |cloudstack, override|
        cloudstack.host = "api.exoscale.ch"
        cloudstack.path = "/compute"
        cloudstack.port = "443"
        cloudstack.scheme = "https"
        cloudstack.keypair = "exoscale"

        cloudstack.api_key = "your_api_key"
        cloudstack.secret_key = "your_secret_key"


        cloudstack.template_id = "a17b40d6-83e4-4f2a-9ef0-dce6af575789" #Ubuntu 12.04
        cloudstack.service_offering_id = "71004023-bb72-4a97-b1e9-bc66dfce9470" # Micro instance with 10GB disk
        cloudstack.zone_id = "1128bd56-b4d9-4ac6-a7b9-c715b187ce11" #GV2
        cloudstack.network_type = "Basic"
        cloudstack.security_groups = [
          { 
            :name         => "common", 
            :description  => "created in the Vagrantfile", 
            :rules        => [
              {:type => "ingress", :protocol => "TCP", :startport => 22, :endport => 22, :cidrlist => "0.0.0.0/0"}, 
              {:type => "egress",  :protocol => "TCP", :startport => 23, :endport => 23, :cidrlist => "0.0.0.0/0"}
            ]
          }, 
          { :name         => "test",
            :description  => "Also created in Vagrantfile",
            :rules        => [
              {:type => "ingress", :protocol => "TCP", :startport => 80, :endport => 80, :cidrlist => "0.0.0.0/0"}, 
              {:type => "ingress", :protocol => "TCP", :startport => 443, :endport => 443, :cidrlist => "0.0.0.0/0"}, 
              {:type => "egress", :protocol => "TCP", :startport => 8080, :endport => 8080, :cidrlist => "0.0.0.0/0"}
            ]
          }
        ]
      end

    [...]

This makes it a nice and easier alternative for quick multi machines setups.

Thank you to community member [@nicolasbrechet](https://github.com/nicolasbrechet) for publishing those
patches.

