Terraform Vmware Fusion

Posted onby admin
  1. Terraform Vmware Fusion Login
  2. Ansible Vs Terraform Vmware
  3. Terraform Provider Vsphere
  4. Terraform Vmware Fusion Download
  5. Terraform With Vmware Fusion

Terraform provider for VMWare Fusion Professional (macOS) and/or VMWare WorkStation Professional (Windows). With Terraform Provider for VMware Cloud on AWS generating a lot of buzz, this article dives into technical detail around how to set up your environment ready for provisioning your SDDC. It also walks you through how to scale up or down your SDDC using the Terraform Provider. This blog was originally published here. The VMware vSphere provider gives Terraform the ability to work with VMware vSphere Products, notably vCenter Server and ESXi. This provider can be used to manage many aspects of a VMware vSphere environment, including virtual machines, standard and distributed networks, datastores, and more. In this case, the Vagrant plugin for VMware delegates all the virtualization features to the VMware installation, removing the need for VirtualBox. There's more If VMware is your primary hypervisor, you'll soon be tired to always specify the provider in the command line.

This article will provide step by step procedure for building “CentOS” /”Redhat Linux” Virtual Machine using Terraform tool on the VMware vSphere environment. Terraform is an excellent tool to build VM’s on VMware vSphere environment. Terraform doesn’t require any dedicated host. You could download an opensource/free version of Terraform on your laptop or desktop and trigger the VM builds. Terraform uses HCL (Hasicorp Language) which requires very few lines to create VM. Terraform is developed widely by the open source community and HashiCorp. It is an open source tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.

Environment:

  • Windows 7 Laptop
  • VMware vSphere: 6.0 / 6.5

Terraform – VM build – CentOS

1. Download Terraform executable from Terraform.io. I have downloaded windows 64-bit Terraform executable.

Terraform Vmware Fusion

2. Create a new directory and copy terraform.exe into that.

Fusion

3. Download the attached Terraform JSON file and save it in the same directory with “*.tf” file extension. Edit the following fields according to your requirement.

  • STACK-BLR” – DataCenter Name
  • DATASTORE-BLR” – Datastore Name
  • UA-ResPool” – Resource Pool. (If you do not have resource pool, remove the code block)
  • VM Network” – vSphere VM network
  • CentOS-Template” – VM template name
  • terraform-test” – New Virtual Machine Name
  • terraform-test” – Hostname (OS Level)
  • ncpu“, “Memory“, “disk (size )” adjust as per your requirement.
Terraform vmware esxi

4. Create one more file to accommodate the variables (file name- “terraform.tfvars”). This is just to separate the credentials from actual code.

5. List the directory contents.

Terraform

Terraform – Resources

  • Open a command prompt and navigate to the terraform directory.

6. Initialize the terraform resources. This will download the required terraform plugins which are required for VM build.

7. Let’s run the dry run. – Terraform plan.

8. Build the VM if the dry run looks good. Trigger the “terraform apply” to create the resource.

VMware vCenter Console:

Terraform Vmware Fusion Login

During the build, you can navigate to the vCenter console to check the build progress. Log in to the vCenter console.

1. Check the current tasks (Check immediately after triggering the terraform apply.).

2. Here you can see that VM is created and build is in progress.

Once the terraform Job is completed, you are good to login to the VM and check the status.

We have successfully built CentOS 7.x / RHEL 7.x using Terraform code. Using Terraform Provisioners, we can also perform the post-build steps if needed.

VMWare Fusion PC Migration: A secure connection to the server could not be established

I was given a MacBook to replace my Desktop PC at work. Seeing as I do most of my work in Windows and Visual Studio, I used the Migration Assistant that comes with VMWare Fusion 5 to bring my Windows 7 desktop over to the MacBook as a VM.

Unfortunately this didn't go as well as planned. In the end I was able to get the migration process working, but it took some time.

References:

  • Converting a physical machine for Fusion, Workstation, or Player using Converter Standalone (2005129) [kb.vmware.com]
  • Best practices for using and troubleshooting Migration Assistant (1017993) [kb.vmware.com
  • Migrate an Existing Physical PC to a Virtual Machine [http://pubs.vmware.com]

I've used Macs for 15 years now. After about OS 10.6 (Snow Leopard for the felinely inclined) I found the OS to be too much like iOS and switched over to a combination of Windows and Linux VMs. At work I was given a MacBook and I wanted to keep the state from my Desktop Windows PC so I fired up VMWare fusion's PC migrator.

Ansible Vs Terraform Vmware

It seemed to be a pretty straight forward process: Disable firewalls, Install the migrator agent on the PC, follow the wizard on the Mac side and in a few hours I should have things copied over. When it didn't go down that way I was kind of annoyed. All I saw was a message indicating that a secure connection to the server could not be established. No log files, no other details, no helpful that could help me figure out what to do next.

After googling for awhile I found an old page discussing Fusion 4.0's migration assitant which helped me fill in the gaps. After reading that document I came up with the following set of steps that worked for me to get my PC to migrate to a VM on the Mac:

PC Side:

  • Uninstall all VMWare products from the PC
  • Disable simple file sharing on the PC
  • Disable UAC on the PC
  • Disable the firewall unless you want to track down what ports you need to open up
  • Install the VMWare Fusion PC Migration Agent on the PC
  • Restart the computer
  • Login as an Administrator account
  • Start the PC Migration Agent if it doesn't automatically start

Mac Side:

Terraform Provider Vsphere

  • Disable the firewall or allow SMB (Windows File sharing) exclusions to your firewall
  • Enable Windows File Sharing for the user you are currently logged in as
  • Open VMWare Fusion
  • On the Virtual Machine Library screen click the Add button and select Migrate your PC...
  • Follow the wizard screens and provide all requested information (Username and password of the PC, Activation code or IP address and port, Name of the new VM)
  • You may be prompted with a message box indicating that your PC isn't trusted and asking you if you want to continue. Select the option that allows you to continue.

I'm thinking that the 'secure server' error had something to do with SMB configuration. I'm just glad that the thing is migrating and should be done in a couple of hours.

Terraform Vmware Fusion Download

Looks like that copy failed at 98%. I installed the VMWare Stand Alone Converter and converted the PC to a VMWare Workstation image.

Terraform With Vmware Fusion

After getting the VMDK over to the Mac and attaching it to a VM I had to get the Windows 7 x64 ISO and 'repair' the installation since it was blue screening.