Terraform vsphere网络接口bond0配置

时间:2017-04-24 18:55:26

标签: redhat vsphere terraform

我有一个Terraform配置,我想用它来从Vsphere模板(Redhat 7)创建VM,但我需要能够指定网络接口来应用自定义(静态IP,子网,网关,DNS)。

provider "vsphere" {
  user           = "${var.vsphere_user}"
  password       = "${var.vsphere_password}"
  vsphere_server = "${var.vsphere_server}"
  allow_unverified_ssl = true
}

resource "vsphere_virtual_machine" "vm1" {

  name   = "vm1"
  folder = "${var.vsphere_folder}"
  vcpu   = 2
  memory = 32768
  datacenter = "dc1"
  cluster = "cluster1"
  skip_customization =  false

  disk {
    template = "${var.vsphere_folder}/${var.template_redhat}"
    datastore = "${var.template_datastore}"
    type = "thin"
  }

  network_interface {
    label = "${var.vlan}"
    ipv4_address = "10.1.1.1"
    ipv4_prefix_length = 16
    ipv4_gateway = "10.1.1.254"
  }

  dns_servers = ["10.1.1.254"]
  time_zone = "004"

}

我想将静态IP应用于bond0而不是eth0,这可以在Terraform中实现吗?

感谢。

0 个答案:

没有答案