I have NSX 4.1.2 and vsphere 8
I use terraform for deploy resources
The code from NSX part:
resource "nsxt_policy_segment" "seg-dc" {
display_name = "DC-seg"
description = "Terraform provisioned Segment"
transport_zone_path = data.nsxt_policy_transport_zone.tz1.path
connectivity_path = nsxt_policy_tier1_gateway.tier1_gw.path
subnet {
cidr = "1.1.1.1/24"
}
}
The code from Vsphere part:
# create VM
resource "vsphere_virtual_machine" "vm" {
name = "ter-test-01"
resource_pool_id = "test-001"
datastore_id = data.vsphere_datastore.datastore.id
folder = "test-folder"
num_cpus = 1
memory = 1024
guest_id = "other3xLinux64Guest"
network_interface {
network_id = data.nsxt_policy_segment.seg-dc.id
}
disk {
label = "disk0"
size = 15
}
wait_for_guest_net_timeout = -1
wait_for_guest_ip_timeout = -1
depends_on = [nsxt_policy_segment.seg-dc]
}
End I recive an error about "No such network with name DC-seg"
Can you give a consistent naming convention for the policy_segment, display_name, and retry the task?
resource "nsxt_policy_segment" "seg-dc" { display_name = "DC-seg"
What do you mean under "consistent naming convention"? I've written my code above, and it looks exactly like that.
resource "nsxt_policy_segment" "seg-dc" {
display_name = "DC-seg"
description = "Terraform provisioned Segment"
transport_zone_path = data.nsxt_policy_transport_zone.tz1.path
connectivity_path = nsxt_policy_tier1_gateway.tier1_gw.path
}
The segments are created with the names I specified. In the NSX GUI, I can see them, and I can manually attach these segments to any VM.
I try to create the data object:
data "nsxt_policy_segment" "seg-dc" {
id = "${nsxt_policy_segment.seg-dc.id}"
depends_on = [nsxt_policy_segment.seg-dc]
}
and use it in VM configuration -this give me an error about incorect network...