terratest icon indicating copy to clipboard operation
terratest copied to clipboard

Add integration with Vagrant

Open jdpleiness opened this issue 1 year ago • 1 comments

Add new integration with Vagrant via modules folder. Some systems programming workflows cannot rely on Docker for local iteration. Having Vagrant supported as a first class package in terratest would help streamline these kinds of workflows.

Examples such as:

  • vagrant up
  • vagrant halt
  • vagrant ssh
  • vagrant down
  • Works with packer module in similar fashion to docker module

Example workflow:

package test

import (
	"testing"

	"github.com/gruntwork-io/terratest/modules/vagrant"
	"github.com/gruntwork-io/terratest/modules/packer"
	"github.com/stretchr/testify/assert"
)

func TestPackerHelloWorldExample(t *testing.T) {
	packerOptions := &packer.Options{
		Template: "../examples/packer-hello-world-example/build.pkr.hcl",
	}

	packer.BuildArtifact(t, packerOptions) // Build the Packer template which will create a Vagrant box

	output := vagrant.up(t, "gruntwork/packer-hello-world-example", opts) // Run Vagrant box
}

jdpleiness avatar Mar 16 '23 18:03 jdpleiness

Might also need modules for VirtualBox or KVM depending on the Vagrant box.

oxr463 avatar Apr 14 '23 23:04 oxr463