Skip to content

Commit

Permalink
fix: routeros_ip_dns - new fields in 7.8
Browse files Browse the repository at this point in the history
Fixes #169
  • Loading branch information
vaerh committed Mar 23, 2023
1 parent 29ffa08 commit 651dc38
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
19 changes: 19 additions & 0 deletions routeros/resource_ip_dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,25 @@ func ResourceDns() *schema.Resource {
Computed: true,
Description: "Shows the currently used cache size in KiB.",
},
"doh_max_concurrent_queries": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
Description: "Specifies how many DoH concurrent queries are allowed.",
},
"doh_max_server_connections": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
Description: "Specifies how many concurrent connections to the DoH server are allowed.",
},
"doh_timeout": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Description: "Specifies how long to wait for query response from the DoH server.",
DiffSuppressFunc: TimeEquall,
},
"dynamic_servers": {
Type: schema.TypeString,
Computed: true,
Expand Down
23 changes: 17 additions & 6 deletions routeros/resource_ip_dns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@ func TestAccResourceDnsTest_basic(t *testing.T) {
ProviderFactories: testAccProviderFactories,
Steps: []resource.TestStep{
{
Config: testAccResourceDnsConfig(),
Config: testAccResourceDnsConfig(0),
Check: resource.ComposeTestCheckFunc(
testAccCheckResourceDnsExists(testResourceDnsTask),
resource.TestCheckResourceAttr(testResourceDnsTask, "allow_remote_requests", "true"),
),
},
{
Config: testAccResourceDnsConfig(1),
},
},
})

Expand All @@ -49,13 +52,15 @@ func testAccCheckResourceDnsExists(name string) resource.TestCheckFunc {
}
}

func testAccResourceDnsConfig() string {
return `
func testAccResourceDnsConfig(n int) string {
provider := `
provider "routeros" {
insecure = true
}
`

tests := []string{`
resource "routeros_dns" "test" {
allow_remote_requests = true
cache_max_ttl = "3d"
Expand All @@ -68,6 +73,12 @@ resource "routeros_dns" "test" {
servers = "1.1.1.1"
use_doh_server = "https://cloudflare-dns.com/dns-query"
verify_doh_cert = true
}
`
}`,
`
resource "routeros_ip_dns" "dns-server" {
allow_remote_requests = true
servers = "2606:4700:4700::1112,1.1.1.2,2606:4700:4700::1002,1.0.0.2"
}`,
}
return provider + tests[n]
}

0 comments on commit 651dc38

Please sign in to comment.