Hello, I am looking for some resources to instruct how to build VM using terraform, Linux CentOs7 any help will be appreciated.
--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-too...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/23a26c08-9575-4092-85b9-59f0ebee8b65%40googlegroups.com.
Hi guys, can someone please assist, I want to create a VM attached with an ISO file in my datastore. In my configuration however whenever i tried to assisgn a static IP to the VM then my configuration gives Error: Unsopported arguement.
<<<Just to make sure that I am getting the right answers>>>
I am not using a module, also I am only creating a fresh VM but i need to assign/mention a static IP to the machine while provisioning in my Terraform code just like when using Terraform module (https://registry.terraform.io/modules/Terraform-VMWare-Modules/vm/vsphere/latest).
provider "vsphere" {
user = var.vsphere_user
password = var.vsphere_password
vsphere_server = var.vsphere_server
# If you have a self-signed cert
allow_unverified_ssl = true
}
data "vsphere_datacenter" "dc" {
name = "dc1"
}
data "vsphere_datastore" "datastore" {
name = "datastore1"
datacenter_id = data.vsphere_datacenter.dc.id
}
data "vsphere_resource_pool" "pool" {
name = "cluster1/Resources"
datacenter_id = data.vsphere_datacenter.dc.id
}
data "vsphere_network" "network" {
name = "public"
datacenter_id = data.vsphere_datacenter.dc.id
}
resource "vsphere_virtual_machine" "vm" {
name = "terraform-test"
resource_pool_id = data.vsphere_resource_pool.pool.id
datastore_id = data.vsphere_datastore.datastore.id
num_cpus = 2
memory = 1024
guest_id = "other3xLinux64Guest"
network_interface {
network_id = data.vsphere_network.network.id
}
disk {
label = "disk0"
size = 20
}
}
This template above from Terraform seems not to solve my problem because there was no static IP assigned. https://registry.terraform.io/providers/hashicorp/vsphere/latest/docs
:::same data source:::
resource "vsphere_virtual_machine" "vm" { #count = 1 name = "terraform-test" resource_pool_id = data.vsphere_resource_pool.pool.id host_system_id = data.vsphere_host.host.id datastore_id = data.vsphere_datastore.datastore.id folder = "known-DC" wait_for_guest_net_timeout = 0 wait_for_guest_ip_timeout = 0 num_cpus = 2 memory = 4096 guest_id = "centos7_64Guest" network_interface { ipv4_address = "192.168.2.18" ipv4_netmask = 24 dns_server_list = ["192.168.2.10", "8.8.8.8"] network_id = data.vsphere_network.network.id } cdrom { datastore_id = data.vsphere_datastore.datastore.id path = "CentOS-8.iso" } disk { label = "disk0" size = 20 } }
As you can see, an ISO file is attached above. So, I want something like that code above. Do i need to declare a new data for the network interface??
In such that whenever i want to create a VM, I can assign a static IP address to the new VM.
I will appreciate this.
many thanks
Cheers!