Skip to content

Commit

Permalink
adding disabled argument to log sinks
Browse files Browse the repository at this point in the history
  • Loading branch information
cgsyam committed Jan 10, 2024
1 parent 0261a13 commit 63ba739
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ so that all dependencies are met.
|------|-------------|------|---------|:--------:|
| bigquery\_options | (Optional) Options that affect sinks exporting data to BigQuery. use\_partitioned\_tables - (Required) Whether to use BigQuery's partition tables. | <pre>object({<br> use_partitioned_tables = bool<br> })</pre> | `null` | no |
| destination\_uri | The self\_link URI of the destination resource (This is available as an output coming from one of the destination submodules) | `string` | n/a | yes |
| disabled | (Optional) If set to true, then the sink is disabled and it does not export any log entries. | `bool` | `false` | no |
| exclusions | (Optional) A list of sink exclusion filters. | <pre>list(object({<br> name = string,<br> description = string,<br> filter = string,<br> disabled = bool<br> }))</pre> | `[]` | no |
| filter | The filter to apply when exporting logs. Only log entries that match the filter are exported. Default is '' which exports all logs. | `string` | `""` | no |
| include\_children | Only valid if 'organization' or 'folder' is chosen as var.parent\_resource.type. Determines whether or not to include children organizations/folders in the sink export. If true, logs associated with child projects are also exported; otherwise only logs relating to the provided organization/folder are included. | `bool` | `false` | no |
Expand Down
4 changes: 4 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ resource "google_logging_project_sink" "sink" {
filter = var.filter
destination = var.destination_uri
unique_writer_identity = var.unique_writer_identity
disabled = var.disabled
dynamic "bigquery_options" {
for_each = local.bigquery_options
content {
Expand All @@ -71,6 +72,7 @@ resource "google_logging_folder_sink" "sink" {
filter = var.filter
include_children = var.include_children
destination = var.destination_uri
disabled = var.disabled
dynamic "bigquery_options" {
for_each = local.bigquery_options
content {
Expand All @@ -97,6 +99,7 @@ resource "google_logging_organization_sink" "sink" {
filter = var.filter
include_children = var.include_children
destination = var.destination_uri
disabled = var.disabled
dynamic "bigquery_options" {
for_each = local.bigquery_options
content {
Expand All @@ -122,6 +125,7 @@ resource "google_logging_billing_account_sink" "sink" {
billing_account = var.parent_resource_id
filter = var.filter
destination = var.destination_uri
disabled = var.disabled
dynamic "bigquery_options" {
for_each = local.bigquery_options
content {
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,9 @@ variable "exclusions" {
disabled = bool
}))
}

variable "disabled" {
description = "(Optional) If set to true, then the sink is disabled and it does not export any log entries."
type = bool
default = false
}

0 comments on commit 63ba739

Please sign in to comment.