Skip to content

Commit

Permalink
Add realized_id attribute to nsxt_policy_transport_zone data source
Browse files Browse the repository at this point in the history
This data source is replacing MP nsxt_transport_zone which is deprecated.
The nsxt_edge_transport_node resource requires this value, as it's not a policy resource and it is provided by nsxt_policy_transport_zone resource but not by the data source.

Signed-off-by: Kobi Samoray <kobi.samoray@broadcom.com>
  • Loading branch information
ksamoray committed Nov 21, 2024
1 parent 04eeea9 commit 9b75c8f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions nsxt/data_source_nsxt_policy_transport_zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ func dataSourceNsxtPolicyTransportZone() *schema.Resource {
Optional: true,
ValidateFunc: validatePolicyPath(),
},
"realized_id": {
Type: schema.TypeString,
Description: "The ID of the realized resource",
Computed: true,
},
},
}
}
Expand Down Expand Up @@ -90,6 +95,7 @@ func dataSourceNsxtPolicyTransportZoneRead(d *schema.ResourceData, m interface{}
d.Set("is_default", transportZoneResource.IsDefault)
d.Set("transport_type", transportZoneResource.TzType)
d.Set("site_path", transportZoneResource.ParentPath)
d.Set("realized_id", transportZoneResource.RealizationId)
return nil
}
connector := getPolicyConnector(m)
Expand Down Expand Up @@ -159,5 +165,6 @@ func dataSourceNsxtPolicyTransportZoneRead(d *schema.ResourceData, m interface{}
d.Set("path", obj.Path)
d.Set("is_default", obj.IsDefault)
d.Set("transport_type", obj.TzType)
d.Set("realized_id", obj.RealizationId)
return nil
}
1 change: 1 addition & 0 deletions nsxt/data_source_nsxt_policy_transport_zone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func TestAccDataSourceNsxtPolicyTransportZone_basic(t *testing.T) {
resource.TestCheckResourceAttrSet(testResourceName, "id"),
resource.TestCheckResourceAttrSet(testResourceName, "path"),
resource.TestCheckResourceAttrSet(testResourceName, "is_default"),
resource.TestCheckResourceAttrSet(testResourceName, "realized_id"),
resource.TestCheckResourceAttr(testResourceName, "transport_type", "VLAN_BACKED"),
),
},
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/policy_transport_zone.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ In addition to arguments listed above, the following attributes are exported:
* `is_default` - A boolean flag indicating if this Transport Zone is the default.
* `transport_type` - The transport type of this transport zone.
* `path` - The NSX path of the policy resource.
* `realized_id` - The id of realized pool object. This id should be used in `nsxt_edge_transport_node` resource.

0 comments on commit 9b75c8f

Please sign in to comment.