<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>vSphere Archives - OVHcloud Blog</title>
	<atom:link href="https://blog.ovhcloud.com/tag/vsphere/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.ovhcloud.com/tag/vsphere/</link>
	<description>Innovation for Freedom</description>
	<lastBuildDate>Wed, 08 Jan 2020 09:47:06 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://blog.ovhcloud.com/wp-content/uploads/2019/07/cropped-cropped-nouveau-logo-ovh-rebranding-32x32.gif</url>
	<title>vSphere Archives - OVHcloud Blog</title>
	<link>https://blog.ovhcloud.com/tag/vsphere/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>OVH Private Cloud and HashiCorp Terraform &#8211; Part 1</title>
		<link>https://blog.ovhcloud.com/private_cloud_and_hashicorp_terraform_part1/</link>
		
		<dc:creator><![CDATA[Erwan Quelin]]></dc:creator>
		<pubDate>Fri, 03 May 2019 08:59:46 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Automation]]></category>
		<category><![CDATA[DevOps]]></category>
		<category><![CDATA[HashiCorp]]></category>
		<category><![CDATA[IaaC]]></category>
		<category><![CDATA[Private Cloud]]></category>
		<category><![CDATA[Terraform]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[vSphere]]></category>
		<guid isPermaLink="false">https://blog.ovh.com/fr/blog/?p=15407</guid>

					<description><![CDATA[When discussing the concepts of DevOps and Infrastructure-as-a-Code, the tools developed by HashiCorp quickly come up. With Terraform, HashiCorp offers a simple way to automate infrastructure provisioning in both public clouds and on-premises. Terraform has a long history of deploying and managing OVH&#8217;s Public Cloud resources. For example, you can find a complete guide on [&#8230;]<img src="//blog.ovhcloud.com/wp-content/plugins/matomo/app/matomo.php?idsite=1&amp;rec=1&amp;url=https%3A%2F%2Fblog.ovhcloud.com%2Fprivate_cloud_and_hashicorp_terraform_part1%2F&amp;action_name=OVH%20Private%20Cloud%20and%20HashiCorp%20Terraform%20%26%238211%3B%20Part%201&amp;urlref=https%3A%2F%2Fblog.ovhcloud.com%2Ffeed%2F" style="border:0;width:0;height:0" width="0" height="0" alt="" />]]></description>
										<content:encoded><![CDATA[
<p><span class="tlid-translation translation" lang="en">When discussing the concepts of DevOps and Infrastructure-as-a-Code, the tools developed by <a href="https://www.hashicorp.com/" data-wpel-link="external" target="_blank" rel="nofollow external noopener noreferrer">HashiCorp</a> quickly come up. With Terraform, HashiCorp offers a simple way to automate infrastructure provisioning in both public clouds and on-premises. Terraform has a long history of deploying and managing <a href="https://www.ovh.co.uk/public-cloud/" data-wpel-link="external" target="_blank" rel="nofollow external noopener noreferrer">OVH&#8217;s Public Cloud</a> resources. For example, you can find a complete guide on <a href="https://github.com/ovh/terraform-ovh-commons" data-wpel-link="external" target="_blank" rel="nofollow external noopener noreferrer">GitHub</a>. In this article, we will focus on using Terraform to interact with another OVH solution:&nbsp;<a href="https://www.ovh.co.uk/private-cloud/" data-wpel-link="external" target="_blank" rel="nofollow external noopener noreferrer">Private Cloud</a>.</span></p>



<div class="wp-block-image"><figure class="aligncenter"><img fetchpriority="high" decoding="async" width="900" height="450" src="/blog/wp-content/uploads/2019/04/IMG_0225.jpg" alt="" class="wp-image-15430" srcset="https://blog.ovhcloud.com/wp-content/uploads/2019/04/IMG_0225.jpg 900w, https://blog.ovhcloud.com/wp-content/uploads/2019/04/IMG_0225-300x150.jpg 300w, https://blog.ovhcloud.com/wp-content/uploads/2019/04/IMG_0225-768x384.jpg 768w" sizes="(max-width: 900px) 100vw, 900px" /></figure></div>



<p><span class="tlid-translation translation" lang="en"><br>Private Cloud enables customers to benefit from a VMware vSphere infrastructure, hosted and managed by OVH. Terraform lets you automate the creation of resources and their life cycle. In this first article, we will explore the basic notions of Terraform. After reading it, you should be able to write a Terraform configuration file to deploy and customise a virtual machine from a template. In a second article, we will build on this example, and modify it so that it is more generic and can be easily adapted to your needs.</span></p>



<h3 class="wp-block-heading">Installation</h3>



<p><span class="tlid-translation translation" lang="en"><span title="">Terraform is available on the <a href="https://www.terraform.io/downloads.html" data-wpel-link="external" target="_blank" rel="nofollow external noopener noreferrer">HashiCorp website</a> for almost all OSs as a simple binary. Just download it and copy it into a directory in</span> <span title=""> your operating system PATH.</span> <span class="" title="">To test that everything is working properly, run the <strong>terraform</strong> command.</span></span></p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">$ terraform
Usage: terraform [-version] [-help] &lt;command> [args]

The available commands for execution are listed below.
The most common, useful commands are shown first, followed by
less common or more advanced commands. If you're just getting
started with Terraform, stick with the common commands. For the
other commands, please read the help and docs before usage.

Common commands:
    apply              Builds or changes infrastructure
    console            Interactive console for Terraform interpolations
    destroy            Destroy Terraform-managed infrastructure</code></pre>



<h3 class="wp-block-heading">Folders and files</h3>



<p><span class="tlid-translation translation" lang="en">Like other Infrastructure-as- a-Code tools, Terraform uses simple files to define the target configuration. To begin, we will create a directory and place a file named <code>main.tf</code>. By default, Terraform will read all the files in the working directory with the <code>.tf</code> extension, but to simplify things, we will start with a single file. We will see in a future article how to organise the data into several files.</span></p>



<p>Similarly, to make it easier to understand Terraform operations, we will specify all the necessary information directly in the files. This includes usernames, passwords and names of different resources (vCenter, cluster, etc.). It is obviously not advisable to do this in order to use Terraform in production. The second article will also be an opportunity to improve this part of the code. But for now, let&#8217;s keep it simple!</p>



<h3 class="wp-block-heading">Providers</h3>



<p><span class="tlid-translation translation" lang="en"><span title="">The providers let you specify how Terraform will communicate with the outside world.</span> <span title="">In our example, the vSphere provider will be in charge of connecting with your Private Cloud&#8217;s vCenter.</span> <span title="">We declare a provider as follows:</span><br></span></p>



<pre class="wp-block-code"><code lang="json" class="language-json">provider "vsphere" {
    user = "admin"
    password = "MyAwesomePassword"
    vsphere_server = "pcc-XXX-XXX-XXX-XXX.ovh.com"
}</code></pre>



<p><span class="tlid-translation translation" lang="en"><span class="" title="">We see here that Terraform uses its own way of structuring data (it is also possible to write everything in <a href="https://www.terraform.io/docs/configuration/syntax-json.html" data-wpel-link="external" target="_blank" rel="nofollow external noopener noreferrer">JSON</a>&nbsp; to facilitate the automatic generation of files!</span> <span title="">)</span><span class="" title="">.</span> <span class="" title="">Data is grouped in blocks (here a block named <strong>vsphere</strong>, which is of the&nbsp;<strong>provider </strong>type) and the data relating to the block are in the form of keys/values.</span></span></p>



<h3 class="wp-block-heading">Data</h3>



<p><span class="tlid-translation translation" lang="en"><span title="">Now that Terraform is able to connect to the vCenter, we need to retrieve information about the vSphere infrastructure.</span> <span title="">Since we want to deploy a virtual machine, we need to know the datacentre, cluster, template, etc., and where we are going to create it.</span> <span title="">To do this, we will use <strong>data</strong>-type blocks:</span><br></span></p>



<pre class="wp-block-code"><code lang="json" class="language-json">data "vsphere_datacenter" "dc" {
  name = "pcc-XXX-XXX-XXX-XXX_datacenter3113"
}

data "vsphere_datastore" "datastore" {
  name          = "pcc-001234"
  datacenter_id = "${data.vsphere_datacenter.dc.id}"
}

data "vsphere_virtual_machine" "template" {
  name          = "UBUNTU"
  datacenter_id = "${data.vsphere_datacenter.dc.id}"
}</code></pre>



<p><span class="tlid-translation translation" lang="en"><span class="" title="">In the above example, we are trying to get information about the datacentre named <code>pcc-XXX-XXX-XXX-XXX_datacenter3113</code> and get the information from the datastore named <code>pcc-001234</code> and a template whose name</span> <span title="">is <code>UBUNTU</code>.</span> <span class="" title="">We see here that we use the datacentre id to get information about an object associated with it.</span></span></p>



<h3 class="wp-block-heading">Resources</h3>



<p><span class="tlid-translation translation" lang="en"><span title="">The resources will be used to create and/or manage elements of the infrastructure.</span> <span class="" title="">In our example, we will use a resource of type <code>virtual_machine</code>, which as its name suggests, will help us to create a VM.</span><br></span></p>



<pre class="wp-block-code"><code lang="json" class="language-json">resource "vsphere_virtual_machine" "vm" {
  name             = "vm01"
  resource_pool_id = "${data.vsphere_compute_cluster.cluster.resource_pool_id}"
  datastore_id     = "${data.vsphere_datastore.datastore.id}"
  guest_id         = "${data.vsphere_virtual_machine.template.guest_id}"
  scsi_type        = "${data.vsphere_virtual_machine.template.scsi_type}"

  network_interface {
    network_id = "${data.vsphere_network.network.id}"
  }

  disk {
    label = "disk0"
    size  = "${data.vsphere_virtual_machine.template.disks.0.size}"
  }

  clone {
    template_uuid = "${data.vsphere_virtual_machine.template.id}"

    customize {
      linux_options {
        host_name = "vm01"
        domain     = "example.com"
      }

      network_interface {
        ipv4_address = "192.168.1.2"
        ipv4_netmask = 24
      }

      ipv4_gateway    = "192.168.1.254"
      dns_suffix_list = ["example.com"]
      dns_server_list = ["192.168.1.1"]
    }
  }
}</code></pre>



<p><span class="tlid-translation translation" lang="en"><br><span class="" title="">The structure of this resource is a little more complex, because it is composed of several sub-blocks.</span> <span class="" title="">We see that we will first define the name of the virtual machine.</span> <span class="" title="">We then provide information about its configuration (Resource pool, datastore, etc.).</span> <span class="" title="">The <code>network_interface</code> and <code>disk</code> blocks are used to specify the configuration of its virtual devices.</span> <span class="" title="">The <code>clone</code> sub-block will let you specify which template you wish to use to create the VM, and also to specify the configuration information of the operating system installed on the VM.</span> <span class="" title="">The <code>customize</code> sub-block is specific to the type of OS you want to clone.</span> <span class="" title="">At all levels, we use information previously obtained in the <code>data</code> blocks.</span></span></p>



<h3 class="wp-block-heading">Full example</h3>



<pre class="wp-block-code"><code lang="json" class="language-json">provider "vsphere" {
    user = "admin"
    password = "MyAwesomePassword"
    vsphere_server = "pcc-XXX-XXX-XXX-XXX.ovh.com"
}

data "vsphere_datacenter" "dc" {
  name = "pcc-XXX-XXX-XXX-XXX_datacenter3113"
}

data "vsphere_datastore" "datastore" {
  name          = "pcc-001234"
  datacenter_id = "${data.vsphere_datacenter.dc.id}"
}

data "vsphere_compute_cluster" "cluster" {
  name          = "Cluster1"
  datacenter_id = "${data.vsphere_datacenter.dc.id}"
}

data "vsphere_network" "network" {
  name          = "vxw-dvs-57-virtualwire-2-sid-5001-Dc3113_5001"
  datacenter_id = "${data.vsphere_datacenter.dc.id}"
}

data "vsphere_virtual_machine" "template" {
  name          = "UBUNTU"
  datacenter_id = "${data.vsphere_datacenter.dc.id}"
}

resource "vsphere_virtual_machine" "vm" {
  name             = "vm01"
  resource_pool_id = "${data.vsphere_compute_cluster.cluster.resource_pool_id}"
  datastore_id     = "${data.vsphere_datastore.datastore.id}"
  guest_id         = "${data.vsphere_virtual_machine.template.guest_id}"
  scsi_type        = "${data.vsphere_virtual_machine.template.scsi_type}"

  network_interface {
    network_id = "${data.vsphere_network.network.id}"
  }

  disk {
    label = "disk0"
    size  = "${data.vsphere_virtual_machine.template.disks.0.size}"
  }

  clone {
    template_uuid = "${data.vsphere_virtual_machine.template.id}"

    customize {
      linux_options {
        host_name = "vm01"
        domain     = "example.com"
      }

      network_interface {
        ipv4_address = "192.168.1.2"
        ipv4_netmask = 24
      }

      ipv4_gateway    = "192.168.1.254"
      dns_suffix_list = ["example.com"]
      dns_server_list = ["192.168.1.1"]
    }
  }
}</code></pre>



<h3 class="wp-block-heading">3&#8230; 2&#8230; 1&#8230; Ignition</h3>



<p>Let&#8217;s look at how to use our new config file with Terraform&#8230;</p>



<div class="wp-block-image"><figure class="aligncenter is-resized"><img decoding="async" src="https://www.ovh.com/blog/wp-content/uploads/2019/04/IMG_0223-1024x405.jpg" alt="OVH Private Cloud and HashiCorp Terraform" class="wp-image-15429" width="768" height="304" srcset="https://blog.ovhcloud.com/wp-content/uploads/2019/04/IMG_0223-1024x405.jpg 1024w, https://blog.ovhcloud.com/wp-content/uploads/2019/04/IMG_0223-300x119.jpg 300w, https://blog.ovhcloud.com/wp-content/uploads/2019/04/IMG_0223-768x303.jpg 768w, https://blog.ovhcloud.com/wp-content/uploads/2019/04/IMG_0223-1200x474.jpg 1200w, https://blog.ovhcloud.com/wp-content/uploads/2019/04/IMG_0223.jpg 2048w" sizes="(max-width: 768px) 100vw, 768px" /></figure></div>



<h4 class="wp-block-heading">Initialisation</h4>



<p><span class="tlid-translation translation" lang="en"><span class="" title="">Now that our configuration file is ready, we will be able to use it to create our virtual machine.</span> <span class="" title="">Let&#8217;s start by initialising the working environment with the <code>terraform init</code> command.</span> <span class="" title="">This will take care of downloading the vSphere provider and create the different files that Terraform needs to work.</span></span></p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">$ terraform init

Initializing provider plugins...
- Checking for available provider plugins on https://releases.hashicorp.com...
- Downloading plugin for provider "vsphere" (1.10.0)...

The following providers do not have any version constraints in configuration,
so the latest version was installed.

...

* provider.vsphere: version = "~> 1.10"

Terraform has been successfully initialized!
...</code></pre>



<h4 class="wp-block-heading">Plan</h4>



<p><span class="tlid-translation translation" lang="en"><span title="">The next step is to execute the <code>terraform plan</code> command to validate that our configuration file contains no errors and to visualise all the actions that Terraform will perform.</span><br></span></p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">$ terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

data.vsphere_datacenter.dc: Refreshing state...
data.vsphere_compute_cluster.cluster: Refreshing state...
data.vsphere_network.network: Refreshing state...
data.vsphere_datastore.datastore: Refreshing state...
data.vsphere_virtual_machine.template: Refreshing state...

------------------------------------------------------------------------

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  + vsphere_virtual_machine.vm
      id:                                                   &lt;computed>
      boot_retry_delay:                                     "10000"
      change_version:                                       &lt;computed>
      clone.#:                                              "1"
      clone.0.customize.#:                                  "1"
      clone.0.customize.0.dns_server_list.#:                "1"
      clone.0.customize.0.dns_server_list.0:                "192.168.1.1"
      clone.0.customize.0.dns_suffix_list.#:                "1"
      clone.0.customize.0.dns_suffix_list.0:                "example.com"
      clone.0.customize.0.ipv4_gateway:                     "172.16.0.1"
      clone.0.customize.0.linux_options.#:                  "1"
      clone.0.customize.0.linux_options.0.domain:           "example.com"
      clone.0.customize.0.linux_options.0.host_name:        "vm01"
      clone.0.customize.0.linux_options.0.hw_clock_utc:     "true"
      clone.0.customize.0.network_interface.#:              "1"
      clone.0.customize.0.network_interface.0.ipv4_address: "192.168.1.2"
      clone.0.customize.0.network_interface.0.ipv4_netmask: "16"
      clone.0.customize.0.timeout:                          "10"
      clone.0.template_uuid:                                "42061bc5-fdec-03f3-67fd-b709ec06c7f2"
      clone.0.timeout:                                      "30"
      cpu_limit:                                            "-1"
      cpu_share_count:                                      &lt;computed>
      cpu_share_level:                                      "normal"
      datastore_id:                                         "datastore-93"
      default_ip_address:                                   &lt;computed>
      disk.#:                                               "1"
      disk.0.attach:                                        "false"
      disk.0.datastore_id:                                  "&lt;computed>"
      disk.0.device_address:                                &lt;computed>
      ...

Plan: 1 to add, 0 to change, 0 to destroy.</code></pre>



<p><span class="tlid-translation translation" lang="en"><br><span class="" title="">It is important to take time to check all information returned by the <code>plan</code> command before proceeding.</span> <span class="" title="">It would be a mess to delete virtual machines in production due to an error in the configuration file&#8230; In the example below, we see that Terraform will create a new resource (here a VM) and not modify or delete anything,</span> <span class="" title="">which is exactly the goal!</span></span></p>



<h4 class="wp-block-heading">Apply</h4>



<p><span class="tlid-translation translation" lang="en"><span title="">In the last step, the <code>terraform apply</code> command will actually configure the infrastructure according to the information present in the configuration file.</span> <span title="">As a first step, the <code>plan</code> command will be executed, and Terraform will ask you to validate by typing <code>yes</code>.</span><br></span></p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">$ terraform apply
...

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

vsphere_virtual_machine.vm: Creating...
  boot_retry_delay:                                     "" => "10000"
  change_version:                                       "" => "&lt;computed>"
  clone.#:                                              "" => "1"
  clone.0.customize.#:                                  "" => "1"
  clone.0.customize.0.dns_server_list.#:                "" => "1"
  clone.0.customize.0.dns_server_list.0:                "" => "192.168.1.1"
  clone.0.customize.0.dns_suffix_list.#:                "" => "1"
  clone.0.customize.0.dns_suffix_list.0:                "" => "example.com"
  clone.0.customize.0.ipv4_gateway:                     "" => "192.168.1.254"
  clone.0.customize.0.linux_options.#:                  "" => "1"
  clone.0.customize.0.linux_options.0.domain:           "" => "example.com"
  clone.0.customize.0.linux_options.0.host_name:        "" => "terraform-test"
  clone.0.customize.0.linux_options.0.hw_clock_utc:     "" => "true"
  clone.0.customize.0.network_interface.#:              "" => "1"
  clone.0.customize.0.network_interface.0.ipv4_address: "" => "192.168.1.2"
  clone.0.customize.0.network_interface.0.ipv4_netmask: "" => "16"
  clone.0.customize.0.timeout:                          "" => "10"
  clone.0.template_uuid:                                "" => "42061bc5-fdec-03f3-67fd-b709ec06c7f2"
  clone.0.timeout:                                      "" => "30"
  cpu_limit:                                            "" => "-1"
  cpu_share_count:                                      "" => "&lt;computed>"
  cpu_share_level:                                      "" => "normal"
  datastore_id:                                         "" => "datastore-93"
  default_ip_address:                                   "" => "&lt;computed>"
  disk.#:                                               "" => "1"
...
vsphere_virtual_machine.vm: Still creating... (10s elapsed)
vsphere_virtual_machine.vm: Still creating... (20s elapsed)
vsphere_virtual_machine.vm: Still creating... (30s elapsed)
...
vsphere_virtual_machine.vm: Still creating... (1m50s elapsed)
vsphere_virtual_machine.vm: Creation complete after 1m55s (ID: 42068313-d169-03ff-9c55-a23e66a44b48)

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.</code></pre>



<p><span class="tlid-translation translation" lang="en"><span class="" title="">When you connect to the vCenter of your Private Cloud, you should see a new virtual machine in the inventory!<br></span></span></p>



<h4 class="wp-block-heading">Next steps</h4>



<p>Now that we have seen a standard Terraform workflow, you may want to test some modifications to your configuration file. For example, you can add another virtual disk to your VM by modifying the virtual_machine resource&#8217;s block like this:</p>



<pre class="wp-block-code"><code lang="json" class="language-json">disk {
  label = "disk0"
  size  = "${data.vsphere_virtual_machine.template.disks.0.size}"
}

disk {
  label = "disk1"
  size  = "${data.vsphere_virtual_machine.template.disks.0.size}"
  unit_number = 1
}</code></pre>



<p>Then run <code>terraform plan</code> to see what Terraform is going to do to in order to reconcile the infrastructure state with your configuration file.</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">$ terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

data.vsphere_datacenter.dc: Refreshing state...
data.vsphere_datastore.datastore: Refreshing state...
data.vsphere_network.network: Refreshing state...
data.vsphere_compute_cluster.cluster: Refreshing state...
data.vsphere_virtual_machine.template: Refreshing state...
vsphere_virtual_machine.vm: Refreshing state... (ID: 4206be6f-f462-c424-d386-7bd0a0d2cfae)

------------------------------------------------------------------------

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  ~ vsphere_virtual_machine.vm
      disk.#:                  "1" => "2"
      disk.1.attach:           "" => "false"
      disk.1.datastore_id:     "" => "&lt;computed>"
      ...


Plan: 0 to add, 1 to change, 0 to destroy.</code></pre>



<p>If you agree with terraform action&#8217;s proposal, you can rerun <code>terraform apply</code>, to add a new virtual disk to your virtual machine.</p>



<h4 class="wp-block-heading">Clean it up</h4>



<p><span class="tlid-translation translation" lang="en"><span title="">When you have finished your tests and you no longer require the utility of the infrastructure,</span>&nbsp;y<span class="" title="">ou can simply run the <code>terraform destroy</code> command to delete all previously-created resources. Be careful with this command, as there is no way to get your data back after that!<br></span></span></p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">$ terraform destroy

data.vsphere_datacenter.dc: Refreshing state...
data.vsphere_compute_cluster.cluster: Refreshing state...
data.vsphere_datastore.datastore: Refreshing state...
data.vsphere_network.network: Refreshing state...
data.vsphere_virtual_machine.template: Refreshing state...
vsphere_virtual_machine.vm: Refreshing state... (ID: 42068313-d169-03ff-9c55-a23e66a44b48)

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  - destroy

Terraform will perform the following actions:

  - vsphere_virtual_machine.vm


Plan: 0 to add, 0 to change, 1 to destroy.

Do you really want to destroy all resources?
  Terraform will destroy all your managed infrastructure, as shown above.
  There is no undo. Only 'yes' will be accepted to confirm.

  Enter a value: yes

vsphere_virtual_machine.vm: Destroying... (ID: 42068313-d169-03ff-9c55-a23e66a44b48)
vsphere_virtual_machine.vm: Destruction complete after 3s

Destroy complete! Resources: 1 destroyed.</code></pre>



<p><span class="tlid-translation translation" lang="en"><span class="" title="">In this article, we have seen how to deploy a virtual machine with a Terraform configuration file.</span> <span class="" title="">This allowed us to learn the basic commands <code>plan</code>, <code>apply</code> and <code>destroy</code>, as well as the notions of <code>provider</code>,&nbsp;<code>data</code> and <code>resource</code>.</span> <span class="" title="">In the next article, we will develop this example, by modifying it to make it more adaptable and generic.</span></span></p>
<img decoding="async" src="//blog.ovhcloud.com/wp-content/plugins/matomo/app/matomo.php?idsite=1&amp;rec=1&amp;url=https%3A%2F%2Fblog.ovhcloud.com%2Fprivate_cloud_and_hashicorp_terraform_part1%2F&amp;action_name=OVH%20Private%20Cloud%20and%20HashiCorp%20Terraform%20%26%238211%3B%20Part%201&amp;urlref=https%3A%2F%2Fblog.ovhcloud.com%2Ffeed%2F" style="border:0;width:0;height:0" width="0" height="0" alt="" />]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
