-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1064 from qiyueyao/datasource-dns-forwarder
Datasource Gateway DNS Forwarder
- Loading branch information
Showing
5 changed files
with
87 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* Copyright © 2023 VMware, Inc. All Rights Reserved. | ||
SPDX-License-Identifier: MPL-2.0 */ | ||
|
||
package nsxt | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
) | ||
|
||
func dataSourceNsxtPolicyGatewayDNSForwarder() *schema.Resource { | ||
return &schema.Resource{ | ||
Read: dataSourceNsxtPolicyGatewayDNSForwarderRead, | ||
|
||
Schema: map[string]*schema.Schema{ | ||
"id": getDataSourceIDSchema(), | ||
"display_name": getDataSourceDisplayNameSchema(), | ||
"description": getDataSourceDescriptionSchema(), | ||
"path": getPathSchema(), | ||
"gateway_path": getPolicyPathSchema(false, false, "Gateway path"), | ||
"context": getContextSchema(), | ||
}, | ||
} | ||
} | ||
|
||
func dataSourceNsxtPolicyGatewayDNSForwarderRead(d *schema.ResourceData, m interface{}) error { | ||
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 | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
subcategory: "DNS" | ||
layout: "nsxt" | ||
page_title: "NSXT: policy_gateway_dns_forwarder" | ||
description: A policy gateway DNS forwarder data source. | ||
--- | ||
|
||
# nsxt_policy_gateway_dns_forwarder | ||
|
||
This data source provides information about policy gateways DNS forwarder. | ||
|
||
This data source is applicable to NSX Policy Manager, NSX Global Manager and VMC. | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
data "nsxt_policy_gateway_dns_forwarder" "my_dns_forwarder" { | ||
display_name = "dns-forwarder1" | ||
gateway_path = data.nsxt_policy_tier1_gateway.path | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
* `id` - (Optional) The ID of gateway DNS forwarder to retrieve. | ||
* `display_name` - (Optional) The Display Name of the gateway DNS forwarder to retrieve. | ||
* `gateway_path` - (Optional) Gateway Path for this Service. | ||
* `context` - (Optional) The context which the object belongs to | ||
* `project_id` - (Required) The ID of the project which the object belongs to | ||
|
||
## Attributes Reference | ||
|
||
In addition to arguments listed above, the following attributes are exported: | ||
|
||
* `description` - The description of the resource. | ||
* `path` - The NSX path of the policy resource. |