-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.tf
50 lines (44 loc) · 1.21 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Define Variables
variable "prov_username" {}
variable "prov_password" {}
variable "prov_endpoint" {}
variable "prov_cluster_name" {}
variable "prov_vmname_prefix" {}
variable "prov_num" {}
variable "prov_subnet_name" {}
variable "prov_vcpu" {}
variable "prov_sock" {}
variable "prov_mem" {}
variable "parent_uuid" {}
variable "parent_name" {}
# Provider
provider "nutanix" {
username = var.prov_username
password = var.prov_password
endpoint = var.prov_endpoint
insecure = true
port = 9440
}
data "nutanix_cluster" "cluster" {
name = var.prov_cluster_name
}
data "nutanix_subnet" "ahv_network" {
subnet_name = var.prov_subnet_name
}
resource "nutanix_virtual_machine" "nutanix_virtual_machine"{
# General Information
count = var.prov_num
name = "${var.prov_vmname_prefix}${format("%03d",count.index+1)}"
description = "Provisioned by Terraform"
parent_reference = {
"kind" = "vm"
"name" = var.parent_name
"uuid" = var.parent_uuid
}
# Configure Cluster
cluster_uuid = data.nutanix_cluster.cluster.metadata.uuid
# Configure Network
nic_list {
subnet_uuid = data.nutanix_subnet.ahv_network.metadata.uuid
}
}