Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
Signed-off-by: Qiyue Yao <[email protected]>
  • Loading branch information
qiyueyao committed Jan 8, 2024
1 parent 4c9a4d4 commit 5500b01
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 131 deletions.
12 changes: 11 additions & 1 deletion nsxt/data_source_nsxt_policy_gateway_dns_forwarder.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package nsxt

import (
"fmt"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

Expand All @@ -16,13 +18,21 @@ func dataSourceNsxtPolicyGatewayDNSForwarder() *schema.Resource {
"display_name": getDataSourceDisplayNameSchema(),
"description": getDataSourceDescriptionSchema(),
"path": getPathSchema(),
"gateway_path": getPolicyPathSchema(false, false, "Gateway path"),
"context": getContextSchema(),
},
}
}

func dataSourceNsxtPolicyGatewayDNSForwarderRead(d *schema.ResourceData, m interface{}) error {
_, err := policyDataSourceResourceRead(d, getPolicyConnector(m), getSessionContext(d, m), "PolicyDnsForwarder", nil)
connector := getPolicyConnector(m)

gwPath := d.Get("gateway_path").(string)
query := make(map[string]string)
if len(gwPath) > 0 {
query["parent_path"] = fmt.Sprintf("%s*", gwPath)
}
_, err := policyDataSourceResourceReadWithValidation(d, connector, getSessionContext(d, m), "PolicyDnsForwarder", query, false)
if err != nil {
return err
}
Expand Down
129 changes: 0 additions & 129 deletions nsxt/data_source_nsxt_policy_gateway_dns_forwarder_test.go

This file was deleted.

9 changes: 8 additions & 1 deletion nsxt/resource_nsxt_policy_gateway_dns_forwarder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,14 @@ resource "nsxt_policy_gateway_dns_forwarder" "test" {
tag = "tag1"
}
}
`, context, attrMap["display_name"], attrMap["description"], whyDoesGoNeedToBeSoComplicated[isT0], attrMap["listener_ip"], attrMap["enabled"], attrMap["log_level"], attrMap["cache_size"])
data "nsxt_policy_gateway_dns_forwarder" "test" {
display_name = "%s"
gateway_path = nsxt_policy_tier%s_gateway.test.path
depends_on = [nsxt_policy_gateway_dns_forwarder.test]
}
`, context, attrMap["display_name"], attrMap["description"], whyDoesGoNeedToBeSoComplicated[isT0], attrMap["listener_ip"], attrMap["enabled"], attrMap["log_level"], attrMap["cache_size"], attrMap["display_name"], whyDoesGoNeedToBeSoComplicated[isT0])
}

func testAccNsxtPolicyGatewayDNSForwarderMinimalistic(isT0, withContext bool) string {
Expand Down
2 changes: 2 additions & 0 deletions website/docs/d/policy_gateway_dns_forwarder.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ This data source is applicable to NSX Policy Manager, NSX Global Manager and VMC
```hcl
data "nsxt_policy_gateway_dns_forwarder" "my_dns_forwarder" {
display_name = "dns-forwarder1"
gateway_path = data.nsxt_policy_tier1_gateway.path
}
```

## Argument Reference

* `gateway_path` - (Required) Path for the gateway.
* `id` - (Optional) The ID of gateway DNS forwarder to retrieve.
* `display_name` - (Optional) The Display Name of the gateway DNS forwarder to retrieve.
* `context` - (Optional) The context which the object belongs to
Expand Down

0 comments on commit 5500b01

Please sign in to comment.