Skip to content

Commit

Permalink
feat!: add cloud logging option for public DNS (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
imrannayer committed Feb 2, 2023
1 parent da0c0c0 commit c441d5c
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 5 deletions.
5 changes: 3 additions & 2 deletions README.md
Expand Up @@ -21,7 +21,7 @@ Basic usage of this module for a private zone is as follows:
```hcl
module "dns-private-zone" {
source = "terraform-google-modules/cloud-dns/google"
version = "3.0.0"
version = "4.0"
project_id = "my-project"
type = "private"
name = "example-com"
Expand Down Expand Up @@ -65,6 +65,7 @@ Functional examples are included in the [examples](./examples/) directory.
| description | zone description (shown in console) | `string` | `"Managed by Terraform"` | no |
| dnssec\_config | Object containing : kind, non\_existence, state. Please see https://www.terraform.io/docs/providers/google/r/dns_managed_zone#dnssec_config for futhers details | `any` | `{}` | no |
| domain | Zone domain, must end with a period. | `string` | n/a | yes |
| enable\_logging | Enable query logging for this ManagedZone | `bool` | `false` | no |
| force\_destroy | Set this true to delete all records in the zone. | `bool` | `false` | no |
| labels | A set of key/value label pairs to assign to this ManagedZone | `map(any)` | `{}` | no |
| name | Zone name, must be unique within the project. | `string` | n/a | yes |
Expand Down Expand Up @@ -96,7 +97,7 @@ These sections describe requirements for using this module.
The following dependencies must be available:

- [Terraform](https://www.terraform.io/downloads.html) >= 0.13.0
- [Terraform Provider for GCP][terraform-provider-gcp] plugin v2.14
- [Terraform Provider for GCP][terraform-provider-gcp] plugin >= v4.40

### Service Account

Expand Down
2 changes: 2 additions & 0 deletions examples/public-zone/main.tf
Expand Up @@ -23,6 +23,8 @@ module "dns-public-zone" {
labels = var.labels
private_visibility_config_networks = [var.network_self_links]

enable_logging = true

recordsets = [
{
name = "ns"
Expand Down
4 changes: 4 additions & 0 deletions main.tf
Expand Up @@ -124,6 +124,10 @@ resource "google_dns_managed_zone" "public" {
}
}
}

cloud_logging_config {
enable_logging = var.enable_logging
}
}

resource "google_dns_managed_zone" "reverse_lookup" {
Expand Down
6 changes: 6 additions & 0 deletions test/fixtures/public_zone/variables.tf
Expand Up @@ -29,3 +29,9 @@ variable "region" {
type = string
default = "us-east4"
}

variable "enable_logging" {
description = "Enable query logging for this ManagedZone"
default = false
type = bool
}
2 changes: 1 addition & 1 deletion test/fixtures/shared/network.tf
Expand Up @@ -18,7 +18,7 @@ resource "random_string" "suffix" {
length = 4
upper = "false"
lower = "true"
number = "false"
numeric = "false"
special = "false"
}

Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Expand Up @@ -112,3 +112,9 @@ variable "recordsets" {
description = "List of DNS record objects to manage, in the standard terraform dns structure."
default = []
}

variable "enable_logging" {
description = "Enable query logging for this ManagedZone"
default = false
type = bool
}
4 changes: 2 additions & 2 deletions versions.tf
Expand Up @@ -20,11 +20,11 @@ terraform {

google = {
source = "hashicorp/google"
version = ">= 3.53, < 5.0"
version = ">= 4.40, < 5.0"
}
google-beta = {
source = "hashicorp/google-beta"
version = ">= 3.53, < 5.0"
version = ">= 4.40, < 5.0"
}
}

Expand Down

0 comments on commit c441d5c

Please sign in to comment.