diff --git a/nsxt/data_source_nsxt_policy_gateway_interface_realization_info.go b/nsxt/data_source_nsxt_policy_gateway_interface_realization_info.go index fe80e7685..1c89a47a0 100644 --- a/nsxt/data_source_nsxt_policy_gateway_interface_realization_info.go +++ b/nsxt/data_source_nsxt_policy_gateway_interface_realization_info.go @@ -38,14 +38,14 @@ func dataSourceNsxtPolicyGatewayInterfaceRealizationInfo() *schema.Resource { Type: schema.TypeInt, Description: "Realization timeout in seconds", Optional: true, - Default: 1200, + Default: 600, ValidateFunc: validation.IntAtLeast(1), }, "delay": { Type: schema.TypeInt, Description: "Initial delay to start realization checks in seconds", Optional: true, - Default: 1, + Default: 5, ValidateFunc: validation.IntAtLeast(0), }, "state": { @@ -118,6 +118,14 @@ func dataSourceNsxtPolicyGatewayInterfaceRealizationInfoRead(d *schema.ResourceD } } + if id == "" && displayName == "" && len(result.Results) > 0 { + // If neither ID nor displayName is provided and there is no entity contains IpAddresses, + // return the first one. + obj := result.Results[0] + setGatewayInterfaceRealizationInfoInSchema(obj, d) + return result, *obj.State, nil + } + if len(perfectMatch) > 1 { return result, "", fmt.Errorf("Found multiple gateway interfaces with name '%s'", displayName) } diff --git a/nsxt/resource_nsxt_policy_tier0_gateway_interface_test.go b/nsxt/resource_nsxt_policy_tier0_gateway_interface_test.go index b44320124..4c4a2a0fa 100644 --- a/nsxt/resource_nsxt_policy_tier0_gateway_interface_test.go +++ b/nsxt/resource_nsxt_policy_tier0_gateway_interface_test.go @@ -662,11 +662,19 @@ func testAccNsxtPolicyTier0InterfaceRealizationTemplate() string { data "nsxt_policy_realization_info" "realization_info" { path = nsxt_policy_tier0_gateway_interface.test.path site_path = data.nsxt_policy_site.test.path +} + +data "nsxt_policy_gateway_interface_realization_info" "gw_realization_info" { + gateway_path = nsxt_policy_tier0_gateway_interface.test.path }` } return ` data "nsxt_policy_realization_info" "realization_info" { path = nsxt_policy_tier0_gateway_interface.test.path +} + +data "nsxt_policy_gateway_interface_realization_info" "gw_realization_info" { + gateway_path = nsxt_policy_tier0_gateway_interface.test.path }` }