Skip to content

Instantly share code, notes, and snippets.

@gowatana
Created May 8, 2024 23:57
Show Gist options
  • Save gowatana/9bff6492f345895d6373797481e4bc47 to your computer and use it in GitHub Desktop.
Save gowatana/9bff6492f345895d6373797481e4bc47 to your computer and use it in GitHub Desktop.
data "vsphere_datacenter" "datacenter" {
name = "infra-dc-01"
}
data "vsphere_datastore" "datastore" {
name = "vsanDatastore"
datacenter_id = data.vsphere_datacenter.datacenter.id
}
data "vsphere_datastore" "iso_datastore" {
name = "datastore1"
datacenter_id = data.vsphere_datacenter.datacenter.id
}
data "vsphere_compute_cluster" "cluster" {
name = "infra-cluster-01"
datacenter_id = data.vsphere_datacenter.datacenter.id
}
data "vsphere_network" "network" {
name = "dvpg-0011-dhcp"
datacenter_id = data.vsphere_datacenter.datacenter.id
}
resource "vsphere_virtual_machine" "vm" {
name = "testvm99"
resource_pool_id = data.vsphere_compute_cluster.cluster.resource_pool_id
datastore_id = data.vsphere_datastore.datastore.id
firmware = "efi"
num_cpus = 4
memory = 4096
guest_id = "ubuntu64Guest"
cdrom {
datastore_id = data.vsphere_datastore.iso_datastore.id
path = "ISO/Ubuntu-ja-22.04-desktop-amd64.iso"
}
network_interface {
network_id = data.vsphere_network.network.id
adapter_type = "vmxnet3"
}
disk {
label = "disk0"
size = 20
}
wait_for_guest_net_timeout = 0
}
@gowatana
Copy link
Author

gowatana commented May 9, 2024

下記の投稿むけ。

Avi Load Balancer を Terraform で操作してみる。(vSphere といっしょに)
https://vm.gowatana.jp/entry/2024/05/09/235916

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment