Skip to content

Instantly share code, notes, and snippets.

@gowatana
Last active July 2, 2025 16:36
Show Gist options
  • Select an option

  • Save gowatana/3cdc3f9d46e496b0e479ab420935fe17 to your computer and use it in GitHub Desktop.

Select an option

Save gowatana/3cdc3f9d46e496b0e479ab420935fe17 to your computer and use it in GitHub Desktop.
resource "nutanix_virtual_machine_v2" "vm1" {
name = "vm01"
description = null
cluster {
ext_id = data.nutanix_clusters_v2.cluster1.cluster_entities[0].ext_id
}
num_sockets = 1
num_cores_per_socket = 1
memory_size_bytes = (1024 * 1024 * 1024) * 1 # GiB
disks {
backing_info {
vm_disk {
data_source {
reference {
image_reference {
image_ext_id = data.nutanix_images_v2.image1.images[0].ext_id
}
}
}
}
}
}
nics {
network_info {
subnet { ext_id = data.nutanix_subnets_v2.subnet1.subnets[0].ext_id }
}
}
boot_config {
legacy_boot {
boot_order = ["CDROM", "DISK"]
}
}
guest_customization {
config {
cloud_init {
cloud_init_script {
user_data {
value = <<EOF
I2Nsb3VkLWNvbmZpZwoKZGlzYWJsZV9yb290OiB0cnVlCnNzaF9wd2F1dGg6IHRydWUKcGFja2Fn
ZV91cGdyYWRlOiBmYWxzZQoKdXNlcnM6Ci0gbmFtZTogbnV0YW5peAogIHNoZWxsOiAvYmluL2Jh
c2gKICBsb2NrLXBhc3N3ZDogZmFsc2UKICBzdWRvOiBBTEw9KEFMTCkgTk9QQVNTV0Q6QUxMCgpj
aHBhc3N3ZDoKICBsaXN0OiB8CiAgICBudXRhbml4Om51dGFuaXgvNHUKICBleHBpcmU6IGZhbHNl
Cg==
EOF
}
}
}
}
}
lifecycle {
ignore_changes = [
cd_roms,
guest_customization
]
}
}
@gowatana
Copy link
Author

gowatana commented Jun 20, 2025

下記の投稿むけ。

Terraform の Nutanix Provider v2 を使用してみる。Part-03:仮想マシンの作成
https://blog.ntnx.jp/entry/2025/05/21/234610

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