Skip to content

Commit cdea34a

Browse files
authored
add tfdocs (#11)
1 parent e1f2aca commit cdea34a

File tree

7 files changed

+98
-9
lines changed

7 files changed

+98
-9
lines changed

README.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
11
# Terraform WinDNS Provider
22

3-
This provider allows Terraform to manage DNS records in a Windows DNS server.
43

4+
This Terraform provider allows you to manage your Windows DNS server resources through Terraform. Currently, it supports
5+
managing records of type `AAAA`, `A`, `CNAME`, `TXT` and `PTR`.
6+
7+
## Prerequisites
8+
This provider requires a remote Windows server exposed with SSH and with the
9+
[DnsService](https://learn.microsoft.com/en-us/powershell/module/dnsserver/?view=windowsserver2022-ps)
10+
PowerShell module installed. This server could be the DNS server itself.
11+
12+
## Why use this provider?
513
Other Terraform providers have implemented similar functionality, but they either require a local Windows installation
6-
with Powershell or utilize WinRM to execute Powershell remotely. Both these things are not preferable.
14+
running PowerShell or utilize WinRM to execute PowerShell remotely. In many environments, this is not preferable or
15+
possible.
16+
17+
The PowerShell module, which this and other providers rely on
18+
[DnsService](https://learn.microsoft.com/en-us/powershell/module/dnsserver/?view=windowsserver2022-ps)
19+
is using WinRM internally as the transport when talking to the DNS Server.
20+
21+
In an environment where the DNS server is running on a locked down Domain Controller with WinRM is disabled, one will thus
22+
run into problems with second hop WinRM. We have not been able to find a solution to making the second hop securely and easily.
723

8-
This provider supports all Terraform platforms and avoids WinRM limitations by using SSH as the transport.
9-
This provider establishes the SSH transport to a (Windows) jump server running Powershell with the DNSServer module
10-
installed or directly to the server running the DNS server.
24+
This provider avoids the whole second hop problem by using SSH as the transport for the first hop when running PowerShell.
1125

12-
If the DNS server is running on a Domain Controller, you may not want to log in directly to that server.
1326

1427
## Getting started
1528

docs/index.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "windns Provider"
4+
subcategory: ""
5+
description: |-
6+
7+
---
8+
9+
# windns Provider
10+
11+
This Terraform provider allows you to manage your Windows DNS server resources through Terraform. Currently, it supports
12+
managing records of type `AAAA`, `A`, `CNAME`, `TXT` and `PTR`.
13+
14+
## Prerequisites
15+
16+
This provider requires a remote Windows server exposed with SSH and with the
17+
[DnsService](https://learn.microsoft.com/en-us/powershell/module/dnsserver/?view=windowsserver2022-ps)
18+
PowerShell module installed. This server could be the DNS server itself.
19+
20+
## Why use this provider?
21+
Other Terraform providers have implemented similar functionality, but they either require a local Windows installation
22+
running PowerShell or utilize WinRM to execute PowerShell remotely. In many environments, this is not preferable or
23+
possible.
24+
25+
The PowerShell module, which this and other providers rely on
26+
[DnsService](https://learn.microsoft.com/en-us/powershell/module/dnsserver/?view=windowsserver2022-ps)
27+
is using WinRM internally as the transport when talking to the DNS Server.
28+
29+
In an environment where the DNS server is running on a locked down Domain Controller with WinRM is disabled, one will thus
30+
run into problems with second hop WinRM. We have not been able to find a solution to making the second hop securely and easily.
31+
32+
This provider avoids the whole second hop problem by using SSH as the transport for the first hop when running PowerShell.
33+
34+
35+
<!-- schema generated by tfplugindocs -->
36+
## Schema
37+
38+
### Optional
39+
40+
- `dns_server` (String) The hostname of the DNS server. (Environment variable: WINDNS_DNS_SERVER_HOSTNAME)
41+
- `ssh_hostname` (String) The hostname of the server we will use to run powershell scripts over SSH. (Environment variable: WINDNS_SSH_HOSTNAME)
42+
- `ssh_password` (String) The password used to authenticate to the server's SSH service. (Environment variable: WINDNS_SSH_PASSWORD)
43+
- `ssh_username` (String) The username used to authenticate to the server's ssh service. (Environment variable: WINDNS_SSH_USERNAME)

docs/resources/record.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "windns_record Resource - terraform-provider-windns"
4+
subcategory: ""
5+
description: |-
6+
windns_record manages DNS Records in a Windows DNS Server.
7+
---
8+
9+
# windns_record (Resource)
10+
11+
`windns_record` manages DNS Records in a Windows DNS Server.
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Required
19+
20+
- `name` (String) The name of the dns records.
21+
- `records` (Set of String) A list of records.
22+
- `type` (String) The type of the dns records. (AAAA, A, CNAME, TXT or PTR)
23+
- `zone_name` (String) The zone name for the dns records.
24+
25+
### Read-Only
26+
27+
- `id` (String) The ID of this resource.
28+
29+

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ require (
4242
github.com/hashicorp/terraform-registry-address v0.2.0 // indirect
4343
github.com/hashicorp/terraform-svchost v0.1.0 // indirect
4444
github.com/hashicorp/yamux v0.1.1 // indirect
45+
github.com/imdario/mergo v0.3.13 // indirect
4546
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
4647
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
4748
github.com/jcmturner/gofork v1.7.6 // indirect

go.sum

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,9 @@ github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbg
118118
github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
119119
github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
120120
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
121-
github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
122121
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
122+
github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk=
123+
github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg=
123124
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
124125
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
125126
github.com/jcmturner/aescts/v2 v2.0.0 h1:9YKLH6ey7H4eDBXW8khjYslgyqG2xZikXP0EQFKrle8=
@@ -343,6 +344,7 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
343344
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
344345
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
345346
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
347+
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
346348
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
347349
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
348350
honnef.co/go/tools v0.4.3 h1:o/n5/K5gXqk8Gozvs2cnL0F2S1/g1vcGCAx2vETjITw=

internal/provider/provider.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ func Provider(version string) func() *schema.Provider {
3636
Type: schema.TypeString,
3737
Optional: true,
3838
DefaultFunc: schema.EnvDefaultFunc("WINDNS_DNS_SERVER_HOSTNAME", nil),
39-
Description: "The hostname of the server we will use to run powershell scripts over SSH. (Environment variable: WINDNS_DNS_SERVER_HOSTNAME)",
39+
Default: "",
40+
Description: "The hostname of the DNS server. (Environment variable: WINDNS_DNS_SERVER_HOSTNAME)",
4041
},
4142
},
4243
DataSourcesMap: map[string]*schema.Resource{},

internal/provider/resource_win_dns_record.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313

1414
func resourceDNSRecord() *schema.Resource {
1515
return &schema.Resource{
16-
Description: "`windns_record` manages DNS Records in an Windows DNS Server.",
16+
Description: "`windns_record` manages DNS Records in a Windows DNS Server.",
1717
Importer: &schema.ResourceImporter{
1818
StateContext: schema.ImportStatePassthroughContext,
1919
},

0 commit comments

Comments
 (0)