Skip to content

Commit

Permalink
Add VPC subnet realization data source
Browse files Browse the repository at this point in the history
This is an alias to segment realization data source, but with
naming that is consistent with VPC.

Signed-off-by: Anna Khmelnitsky <akhmelnitsky@vmware.com>
  • Loading branch information
annakhm committed Dec 17, 2024
1 parent 2cf5b50 commit 3f15161
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions nsxt/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ func Provider() *schema.Provider {
"nsxt_vpc_ip_address_allocation": dataSourceNsxtVpcIpAddressAllocation(),
"nsxt_policy_gateway_connection": dataSourceNsxtPolicyGatewayConnection(),
"nsxt_policy_distributed_vlan_connection": dataSourceNsxtPolicyDistributedVlanConnection(),
"nsxt_vpc_subnet_realization": dataSourceNsxtPolicySegmentRealization(),
},

ResourcesMap: map[string]*schema.Resource{
Expand Down
52 changes: 52 additions & 0 deletions website/docs/d/vpc_subnet_realization.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
subcategory: "VPC"
layout: "nsxt"
page_title: "NSXT: vpc_subnet_realization"
description: State of VPC subnet realization on hypervisors.
---

# nsxt_vpc_subnet_realization

This data source provides information about the realization of VPC subnet or hypervisor.
This data source will wait until realization is complete with either success, partial success or error.
It is recommended to use this data source in conjunction with vsphere provider, in order to ensure subnet is realized
on hypervisor before VM is created on same network.

This data source is applicable to NSX Policy Manager.

## Example Usage

```hcl
resource "nsxt_vpc_subnet" "s1" {
context {
project_id = data.nsxt_policy_project.demoproj.id
vpc_id = data.nsxt_vpc.demovpc.id
}
display_name = "test-subnet"
description = "Test VPC subnet"
ipv4_subnet_size = 32
ip_addresses = ["192.168.240.0/24"]
access_mode = "Isolated"
}
data "nsxt_vpc_subnet_realization" "s1" {
path = nsxt_vpc_subnet.s1.path
}
# usage in vsphere provider
data "vsphere_network" "net" {
name = nsxt_vpc_subnet_realization.s1.network_name
datacenter_id = data.vsphere_datacenter.datacenter.id
}
## Argument Reference
* `path` - (Required) The policy path of the subnet.
## Attributes Reference
In addition to arguments listed above, the following attributes are exported:
* `state` - The realization state of the resource: `success`, `partial_success`, `orphaned`, `failed` or `error`.
* `network_name` - Network name on the hypervisor. This attribute can be used in vsphere provider in order to ensure implicit dependency on segment realization.

0 comments on commit 3f15161

Please sign in to comment.