Skip to content

Commit

Permalink
Merge pull request #1468 from ksamoray/tz_realized_id
Browse files Browse the repository at this point in the history
Add realized_id attribute to nsxt_policy_transport_zone data source
  • Loading branch information
salv-orlando authored Nov 29, 2024
2 parents e6686bd + 800e328 commit 319d98f
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 transport zone object. This id should be used in `nsxt_edge_transport_node` resource.

0 comments on commit 319d98f

Please sign in to comment.