Skip to content

Commit

Permalink
dns e2e tests (#1944)
Browse files Browse the repository at this point in the history
  • Loading branch information
dibaskar-google authored Dec 23, 2023
1 parent 44b1115 commit 969111f
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 31 deletions.
30 changes: 15 additions & 15 deletions modules/dns/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ For DNSSEC configuration, refer to the [`dns_managed_zone` documentation](https:
```hcl
module "private-dns" {
source = "./fabric/modules/dns"
project_id = "myproject"
project_id = var.project_id
name = "test-example"
zone_config = {
domain = "test.example."
Expand All @@ -24,18 +24,18 @@ module "private-dns" {
"A myhost" = { ttl = 600, records = ["10.0.0.120"] }
}
iam = {
"roles/dns.admin" = ["group:[email protected]"]
"roles/dns.admin" = ["group:${var.group_email}"]
}
}
# tftest modules=1 resources=4 inventory=private-zone.yaml
# tftest modules=1 resources=4 inventory=private-zone.yaml e2e
```

### Forwarding Zone

```hcl
module "private-dns" {
source = "./fabric/modules/dns"
project_id = "myproject"
project_id = var.project_id
name = "test-example"
zone_config = {
domain = "test.example."
Expand All @@ -45,15 +45,15 @@ module "private-dns" {
}
}
}
# tftest modules=1 resources=1 inventory=forwarding-zone.yaml
# tftest modules=1 resources=1 inventory=forwarding-zone.yaml e2e
```

### Peering Zone

```hcl
module "private-dns" {
source = "./fabric/modules/dns"
project_id = "myproject"
project_id = var.project_id
name = "test-example"
zone_config = {
domain = "."
Expand All @@ -71,7 +71,7 @@ module "private-dns" {
```hcl
module "private-dns" {
source = "./fabric/modules/dns"
project_id = "myproject"
project_id = var.project_id
name = "test-example"
zone_config = {
domain = "test.example."
Expand Down Expand Up @@ -99,15 +99,15 @@ module "private-dns" {
}
}
}
# tftest modules=1 resources=4 inventory=routing-policies.yaml
# tftest modules=1 resources=4 inventory=routing-policies.yaml e2e
```

### Reverse Lookup Zone

```hcl
module "private-dns" {
source = "./fabric/modules/dns"
project_id = "myproject"
project_id = var.project_id
name = "test-example"
zone_config = {
domain = "0.0.10.in-addr.arpa."
Expand All @@ -116,28 +116,28 @@ module "private-dns" {
}
}
}
# tftest modules=1 resources=1 inventory=reverse-zone.yaml
# tftest modules=1 resources=1 inventory=reverse-zone.yaml e2e
```

### Public Zone

```hcl
module "public-dns" {
source = "./fabric/modules/dns"
project_id = "myproject"
name = "example"
project_id = var.project_id
name = "test-example"
zone_config = {
domain = "example.com."
domain = "test.example."
public = {}
}
recordsets = {
"A myhost" = { ttl = 300, records = ["127.0.0.1"] }
}
iam = {
"roles/dns.admin" = ["group:[email protected]"]
"roles/dns.admin" = ["group:${var.group_email}"]
}
}
# tftest modules=1 resources=3 inventory=public-zone.yaml
# tftest modules=1 resources=3 inventory=public-zone.yaml e2e
```
<!-- BEGIN TFDOC -->
## Variables
Expand Down
2 changes: 1 addition & 1 deletion tests/modules/dns/examples/forwarding-zone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ values:
- gke_clusters: []
networks:
- network_url: projects/xxx/global/networks/aaa
project: myproject
project: project-id
visibility: private

counts:
Expand Down
12 changes: 11 additions & 1 deletion tests/modules/dns/examples/peering-zone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@

values:
module.private-dns.google_dns_managed_zone.dns_managed_zone[0]:
cloud_logging_config:
- enable_logging: false
description: Terraform managed.
dns_name: .
dnssec_config: []
force_destroy: false
forwarding_config: []
labels: null
name: test-example
peering_config:
- target_network:
Expand All @@ -25,8 +30,13 @@ values:
- gke_clusters: []
networks:
- network_url: projects/xxx/global/networks/aaa
project: myproject
project: project-id
reverse_lookup: false
service_directory_config: []
timeouts: null
visibility: private

counts:
google_dns_managed_zone: 1
modules: 1
resources: 1
6 changes: 3 additions & 3 deletions tests/modules/dns/examples/private-zone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ values:
- gke_clusters: []
networks:
- network_url: projects/xxx/global/networks/aaa
project: myproject
project: project-id
visibility: private
module.private-dns.google_dns_record_set.dns_record_set["A localhost"]:
managed_zone: test-example
name: localhost.test.example.
project: myproject
project: project-id
routing_policy: []
rrdatas:
- 127.0.0.1
Expand All @@ -38,7 +38,7 @@ values:
module.private-dns.google_dns_record_set.dns_record_set["A myhost"]:
managed_zone: test-example
name: myhost.test.example.
project: myproject
project: project-id
routing_policy: []
rrdatas:
- 10.0.0.120
Expand Down
12 changes: 6 additions & 6 deletions tests/modules/dns/examples/public-zone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@

values:
module.public-dns.google_dns_managed_zone.dns_managed_zone[0]:
dns_name: example.com.
name: example
project: myproject
dns_name: test.example.
name: test-example
project: project-id
visibility: public
module.public-dns.google_dns_record_set.dns_record_set["A myhost"]:
managed_zone: example
name: myhost.example.com.
project: myproject
managed_zone: test-example
name: myhost.test.example.
project: project-id
routing_policy: []
rrdatas:
- 127.0.0.1
Expand Down
2 changes: 1 addition & 1 deletion tests/modules/dns/examples/reverse-zone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ values:
description: Terraform managed.
dns_name: 0.0.10.in-addr.arpa.
name: test-example
project: myproject
project: project-id
reverse_lookup: true
visibility: private

Expand Down
8 changes: 4 additions & 4 deletions tests/modules/dns/examples/routing-policies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ values:
module.private-dns.google_dns_managed_zone.dns_managed_zone[0]:
dns_name: test.example.
name: test-example
project: myproject
project: project-id
module.private-dns.google_dns_record_set.dns_record_set["A geo"]:
managed_zone: test-example
name: geo.test.example.
project: myproject
project: project-id
routing_policy:
- enable_geo_fencing: null
geo:
Expand All @@ -44,7 +44,7 @@ values:
module.private-dns.google_dns_record_set.dns_record_set["A regular"]:
managed_zone: test-example
name: regular.test.example.
project: myproject
project: project-id
routing_policy: []
rrdatas:
- 10.20.0.1
Expand All @@ -53,7 +53,7 @@ values:
module.private-dns.google_dns_record_set.dns_record_set["A wrr"]:
managed_zone: test-example
name: wrr.test.example.
project: myproject
project: project-id
routing_policy:
- enable_geo_fencing: null
geo: []
Expand Down

0 comments on commit 969111f

Please sign in to comment.