From f0631dc916220a4b991c18cb78d7eeb2b6371e7d Mon Sep 17 00:00:00 2001 From: Bohdan Yurov Date: Fri, 25 Oct 2019 11:40:49 +0200 Subject: [PATCH] Fixes #31: Remove unnecessary element code, double check TF 0.12 migration check-list https://github.com/terraform-google-modules/terraform-google-log-export/issues/31 Finished upgrade to TF0.12. --- Makefile | 2 +- README.md | 6 +++--- examples/bigquery/billing_account/main.tf | 2 +- examples/bigquery/billing_account/variables.tf | 2 ++ examples/bigquery/folder/main.tf | 6 +++--- examples/bigquery/folder/variables.tf | 2 ++ examples/bigquery/organization/main.tf | 6 +++--- examples/bigquery/organization/variables.tf | 2 ++ examples/bigquery/project/main.tf | 6 +++--- examples/bigquery/project/variables.tf | 2 ++ examples/pubsub/billing_account/main.tf | 4 ++-- examples/pubsub/billing_account/variables.tf | 2 ++ examples/pubsub/folder/main.tf | 8 ++++---- examples/pubsub/folder/variables.tf | 2 ++ examples/pubsub/organization/main.tf | 8 ++++---- examples/pubsub/organization/variables.tf | 2 ++ examples/pubsub/project/main.tf | 8 ++++---- examples/pubsub/project/variables.tf | 2 ++ examples/splunk-sink/main.tf | 2 +- examples/splunk-sink/variables.tf | 2 ++ examples/storage/billing_account/main.tf | 2 +- examples/storage/billing_account/variables.tf | 2 ++ examples/storage/folder/main.tf | 6 +++--- examples/storage/folder/variables.tf | 2 ++ examples/storage/organization/main.tf | 6 +++--- examples/storage/organization/variables.tf | 2 ++ examples/storage/project/main.tf | 6 +++--- examples/storage/project/variables.tf | 2 ++ modules/bigquery/README.md | 4 ++-- modules/bigquery/variables.tf | 11 +++++++++-- modules/pubsub/README.md | 6 +++--- modules/pubsub/variables.tf | 6 +++++- modules/storage/README.md | 2 +- modules/storage/variables.tf | 5 +++++ test/fixtures/bigquery/folder/variables.tf | 2 ++ test/fixtures/bigquery/organization/variables.tf | 2 ++ test/fixtures/bigquery/project/variables.tf | 2 ++ test/fixtures/computed_values/main.tf | 4 ++-- test/fixtures/computed_values/variables.tf | 3 +++ test/fixtures/pubsub/folder/variables.tf | 2 ++ test/fixtures/pubsub/organization/variables.tf | 2 ++ test/fixtures/pubsub/project/variables.tf | 2 ++ test/fixtures/storage/folder/variables.tf | 2 ++ test/fixtures/storage/organization/variables.tf | 2 ++ test/fixtures/storage/project/variables.tf | 2 ++ variables.tf | 11 +++++++++-- 46 files changed, 122 insertions(+), 52 deletions(-) diff --git a/Makefile b/Makefile index 0c4e0523..55e07282 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ # Make will use bash instead of sh SHELL := /usr/bin/env bash -DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0.1.0 +DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0.4.6 DOCKER_IMAGE_DEVELOPER_TOOLS := cft/developer-tools REGISTRY_URL := gcr.io/cloud-foundation-cicd diff --git a/README.md b/README.md index 10769669..cf3f47c2 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ module "log_export" { log_sink_name = "storage_example_logsink" parent_resource_id = "sample-project" parent_resource_type = "project" - unique_writer_identity = "true" + unique_writer_identity = true } module "destination" { @@ -49,11 +49,11 @@ so that all dependencies are met. |------|-------------|:----:|:-----:|:-----:| | 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 | | 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. | string | `"false"` | 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 | | log\_sink\_name | The name of the log sink to be created. | string | n/a | yes | | parent\_resource\_id | The ID of the GCP resource in which you create the log sink. If var.parent_resource_type is set to 'project', then this is the Project ID (and etc). | string | n/a | yes | | parent\_resource\_type | The GCP resource in which you create the log sink. The value must not be computed, and must be one of the following: 'project', 'folder', 'billing_account', or 'organization'. | string | `"project"` | no | -| unique\_writer\_identity | Whether or not to create a unique identity associated with this sink. If false (the default), then the writer_identity used is serviceAccount:cloud-logs@system.gserviceaccount.com. If true, then a unique service account is created and used for the logging sink. | string | `"false"` | no | +| unique\_writer\_identity | Whether or not to create a unique identity associated with this sink. If false (the default), then the writer_identity used is serviceAccount:cloud-logs@system.gserviceaccount.com. If true, then a unique service account is created and used for the logging sink. | bool | `"false"` | no | ## Outputs diff --git a/examples/bigquery/billing_account/main.tf b/examples/bigquery/billing_account/main.tf index 0ce69ffc..1350cee6 100644 --- a/examples/bigquery/billing_account/main.tf +++ b/examples/bigquery/billing_account/main.tf @@ -24,7 +24,7 @@ module "log_export" { log_sink_name = "bigquery_example_logsink" parent_resource_id = var.parent_resource_id parent_resource_type = "billing_account" - unique_writer_identity = "true" + unique_writer_identity = true } module "destination" { diff --git a/examples/bigquery/billing_account/variables.tf b/examples/bigquery/billing_account/variables.tf index 37b83238..be3d4bc2 100644 --- a/examples/bigquery/billing_account/variables.tf +++ b/examples/bigquery/billing_account/variables.tf @@ -16,8 +16,10 @@ variable "project_id" { description = "The ID of the project in which the log export will be created." + type = string } variable "parent_resource_id" { description = "The ID of the project in which BigQuery dataset destination will be created." + type = string } diff --git a/examples/bigquery/folder/main.tf b/examples/bigquery/folder/main.tf index a95d3cb6..3e03b9c8 100644 --- a/examples/bigquery/folder/main.tf +++ b/examples/bigquery/folder/main.tf @@ -20,8 +20,8 @@ provider "google" { resource "random_string" "suffix" { length = 4 - upper = "false" - special = "false" + upper = false + special = false } module "log_export" { @@ -31,7 +31,7 @@ module "log_export" { log_sink_name = "bigquery_folder_${random_string.suffix.result}" parent_resource_id = var.parent_resource_id parent_resource_type = "folder" - unique_writer_identity = "true" + unique_writer_identity = true } module "destination" { diff --git a/examples/bigquery/folder/variables.tf b/examples/bigquery/folder/variables.tf index 37b83238..be3d4bc2 100644 --- a/examples/bigquery/folder/variables.tf +++ b/examples/bigquery/folder/variables.tf @@ -16,8 +16,10 @@ variable "project_id" { description = "The ID of the project in which the log export will be created." + type = string } variable "parent_resource_id" { description = "The ID of the project in which BigQuery dataset destination will be created." + type = string } diff --git a/examples/bigquery/organization/main.tf b/examples/bigquery/organization/main.tf index eb5dfa46..c480e768 100644 --- a/examples/bigquery/organization/main.tf +++ b/examples/bigquery/organization/main.tf @@ -20,8 +20,8 @@ provider "google" { resource "random_string" "suffix" { length = 4 - upper = "false" - special = "false" + upper = false + special = false } module "log_export" { @@ -31,7 +31,7 @@ module "log_export" { log_sink_name = "bigquery_org_${random_string.suffix.result}" parent_resource_id = var.parent_resource_id parent_resource_type = "organization" - unique_writer_identity = "true" + unique_writer_identity = true } module "destination" { diff --git a/examples/bigquery/organization/variables.tf b/examples/bigquery/organization/variables.tf index 9b44d8ac..6177bc0f 100644 --- a/examples/bigquery/organization/variables.tf +++ b/examples/bigquery/organization/variables.tf @@ -16,9 +16,11 @@ variable "project_id" { description = "The ID of the project in which the log export will be created." + type = string } variable "parent_resource_id" { description = "The ID of the project in which BigQuery dataset destination will be created." + type = string } diff --git a/examples/bigquery/project/main.tf b/examples/bigquery/project/main.tf index 9fa562ec..959ed203 100644 --- a/examples/bigquery/project/main.tf +++ b/examples/bigquery/project/main.tf @@ -20,8 +20,8 @@ provider "google" { resource "random_string" "suffix" { length = 4 - upper = "false" - special = "false" + upper = false + special = false } module "log_export" { @@ -31,7 +31,7 @@ module "log_export" { log_sink_name = "bigquery_project_${random_string.suffix.result}" parent_resource_id = var.parent_resource_id parent_resource_type = "project" - unique_writer_identity = "true" + unique_writer_identity = true } module "destination" { diff --git a/examples/bigquery/project/variables.tf b/examples/bigquery/project/variables.tf index 9b44d8ac..6177bc0f 100644 --- a/examples/bigquery/project/variables.tf +++ b/examples/bigquery/project/variables.tf @@ -16,9 +16,11 @@ variable "project_id" { description = "The ID of the project in which the log export will be created." + type = string } variable "parent_resource_id" { description = "The ID of the project in which BigQuery dataset destination will be created." + type = string } diff --git a/examples/pubsub/billing_account/main.tf b/examples/pubsub/billing_account/main.tf index 0088c874..5f7b3e30 100644 --- a/examples/pubsub/billing_account/main.tf +++ b/examples/pubsub/billing_account/main.tf @@ -24,7 +24,7 @@ module "log_export" { log_sink_name = "pubsub_example_logsink" parent_resource_id = var.parent_resource_id parent_resource_type = "billing_account" - unique_writer_identity = "true" + unique_writer_identity = true } module "destination" { @@ -32,6 +32,6 @@ module "destination" { project_id = var.project_id topic_name = "pubsub-example" log_sink_writer_identity = module.log_export.writer_identity - create_subscriber = "true" + create_subscriber = true } diff --git a/examples/pubsub/billing_account/variables.tf b/examples/pubsub/billing_account/variables.tf index e7e6e19f..32551430 100644 --- a/examples/pubsub/billing_account/variables.tf +++ b/examples/pubsub/billing_account/variables.tf @@ -16,9 +16,11 @@ variable "project_id" { description = "The ID of the project in which the log export will be created." + type = string } variable "parent_resource_id" { description = "The ID of the project in which pubsub topic destination will be created." + type = string } diff --git a/examples/pubsub/folder/main.tf b/examples/pubsub/folder/main.tf index 1476314d..613b7ede 100644 --- a/examples/pubsub/folder/main.tf +++ b/examples/pubsub/folder/main.tf @@ -20,8 +20,8 @@ provider "google" { resource "random_string" "suffix" { length = 4 - upper = "false" - special = "false" + upper = false + special = false } module "log_export" { @@ -31,7 +31,7 @@ module "log_export" { log_sink_name = "pubsub_folder_${random_string.suffix.result}" parent_resource_id = var.parent_resource_id parent_resource_type = "folder" - unique_writer_identity = "true" + unique_writer_identity = true } module "destination" { @@ -39,6 +39,6 @@ module "destination" { project_id = var.project_id topic_name = "pubsub-folder-${random_string.suffix.result}" log_sink_writer_identity = module.log_export.writer_identity - create_subscriber = "true" + create_subscriber = true } diff --git a/examples/pubsub/folder/variables.tf b/examples/pubsub/folder/variables.tf index e7e6e19f..32551430 100644 --- a/examples/pubsub/folder/variables.tf +++ b/examples/pubsub/folder/variables.tf @@ -16,9 +16,11 @@ variable "project_id" { description = "The ID of the project in which the log export will be created." + type = string } variable "parent_resource_id" { description = "The ID of the project in which pubsub topic destination will be created." + type = string } diff --git a/examples/pubsub/organization/main.tf b/examples/pubsub/organization/main.tf index bc596e57..3a133411 100644 --- a/examples/pubsub/organization/main.tf +++ b/examples/pubsub/organization/main.tf @@ -20,8 +20,8 @@ provider "google" { resource "random_string" "suffix" { length = 4 - upper = "false" - special = "false" + upper = false + special = false } module "log_export" { @@ -31,7 +31,7 @@ module "log_export" { log_sink_name = "pubsub_org_${random_string.suffix.result}" parent_resource_id = var.parent_resource_id parent_resource_type = "organization" - unique_writer_identity = "true" + unique_writer_identity = true } module "destination" { @@ -39,6 +39,6 @@ module "destination" { project_id = var.project_id topic_name = "pubsub-org-${random_string.suffix.result}" log_sink_writer_identity = module.log_export.writer_identity - create_subscriber = "true" + create_subscriber = true } diff --git a/examples/pubsub/organization/variables.tf b/examples/pubsub/organization/variables.tf index e7e6e19f..32551430 100644 --- a/examples/pubsub/organization/variables.tf +++ b/examples/pubsub/organization/variables.tf @@ -16,9 +16,11 @@ variable "project_id" { description = "The ID of the project in which the log export will be created." + type = string } variable "parent_resource_id" { description = "The ID of the project in which pubsub topic destination will be created." + type = string } diff --git a/examples/pubsub/project/main.tf b/examples/pubsub/project/main.tf index 11c6849f..be8291cc 100644 --- a/examples/pubsub/project/main.tf +++ b/examples/pubsub/project/main.tf @@ -20,8 +20,8 @@ provider "google" { resource "random_string" "suffix" { length = 4 - upper = "false" - special = "false" + upper = false + special = false } module "log_export" { @@ -31,7 +31,7 @@ module "log_export" { log_sink_name = "pubsub_project_${random_string.suffix.result}" parent_resource_id = var.parent_resource_id parent_resource_type = "project" - unique_writer_identity = "true" + unique_writer_identity = true } module "destination" { @@ -39,6 +39,6 @@ module "destination" { project_id = var.project_id topic_name = "pubsub-project-${random_string.suffix.result}" log_sink_writer_identity = module.log_export.writer_identity - create_subscriber = "true" + create_subscriber = true } diff --git a/examples/pubsub/project/variables.tf b/examples/pubsub/project/variables.tf index e7e6e19f..32551430 100644 --- a/examples/pubsub/project/variables.tf +++ b/examples/pubsub/project/variables.tf @@ -16,9 +16,11 @@ variable "project_id" { description = "The ID of the project in which the log export will be created." + type = string } variable "parent_resource_id" { description = "The ID of the project in which pubsub topic destination will be created." + type = string } diff --git a/examples/splunk-sink/main.tf b/examples/splunk-sink/main.tf index 35320265..b0eea09f 100644 --- a/examples/splunk-sink/main.tf +++ b/examples/splunk-sink/main.tf @@ -31,6 +31,6 @@ module "destination" { project_id = var.project_id topic_name = "splunk-sink" log_sink_writer_identity = module.log_export.writer_identity - create_subscriber = "true" + create_subscriber = true } diff --git a/examples/splunk-sink/variables.tf b/examples/splunk-sink/variables.tf index e7e6e19f..32551430 100644 --- a/examples/splunk-sink/variables.tf +++ b/examples/splunk-sink/variables.tf @@ -16,9 +16,11 @@ variable "project_id" { description = "The ID of the project in which the log export will be created." + type = string } variable "parent_resource_id" { description = "The ID of the project in which pubsub topic destination will be created." + type = string } diff --git a/examples/storage/billing_account/main.tf b/examples/storage/billing_account/main.tf index b90fb6d7..1f45c788 100644 --- a/examples/storage/billing_account/main.tf +++ b/examples/storage/billing_account/main.tf @@ -24,7 +24,7 @@ module "log_export" { log_sink_name = "storage_example_logsink" parent_resource_id = var.parent_resource_id parent_resource_type = "billing_account" - unique_writer_identity = "true" + unique_writer_identity = true } module "destination" { diff --git a/examples/storage/billing_account/variables.tf b/examples/storage/billing_account/variables.tf index cbfb9f52..4e969d3a 100644 --- a/examples/storage/billing_account/variables.tf +++ b/examples/storage/billing_account/variables.tf @@ -16,9 +16,11 @@ variable "project_id" { description = "The ID of the project in which the log export will be created." + type = string } variable "parent_resource_id" { description = "The ID of the project in which storage bucket destination will be created." + type = string } diff --git a/examples/storage/folder/main.tf b/examples/storage/folder/main.tf index dad89120..635ef450 100644 --- a/examples/storage/folder/main.tf +++ b/examples/storage/folder/main.tf @@ -20,8 +20,8 @@ provider "google" { resource "random_string" "suffix" { length = 4 - upper = "false" - special = "false" + upper = false + special = false } module "log_export" { @@ -31,7 +31,7 @@ module "log_export" { log_sink_name = "storage_folder_${random_string.suffix.result}" parent_resource_id = var.parent_resource_id parent_resource_type = "folder" - unique_writer_identity = "true" + unique_writer_identity = true } module "destination" { diff --git a/examples/storage/folder/variables.tf b/examples/storage/folder/variables.tf index cbfb9f52..4e969d3a 100644 --- a/examples/storage/folder/variables.tf +++ b/examples/storage/folder/variables.tf @@ -16,9 +16,11 @@ variable "project_id" { description = "The ID of the project in which the log export will be created." + type = string } variable "parent_resource_id" { description = "The ID of the project in which storage bucket destination will be created." + type = string } diff --git a/examples/storage/organization/main.tf b/examples/storage/organization/main.tf index 025b1096..235cbad2 100644 --- a/examples/storage/organization/main.tf +++ b/examples/storage/organization/main.tf @@ -20,8 +20,8 @@ provider "google" { resource "random_string" "suffix" { length = 4 - upper = "false" - special = "false" + upper = false + special = false } module "log_export" { @@ -31,7 +31,7 @@ module "log_export" { log_sink_name = "storage_org_${random_string.suffix.result}" parent_resource_id = var.parent_resource_id parent_resource_type = "organization" - unique_writer_identity = "true" + unique_writer_identity = true } module "destination" { diff --git a/examples/storage/organization/variables.tf b/examples/storage/organization/variables.tf index cbfb9f52..4e969d3a 100644 --- a/examples/storage/organization/variables.tf +++ b/examples/storage/organization/variables.tf @@ -16,9 +16,11 @@ variable "project_id" { description = "The ID of the project in which the log export will be created." + type = string } variable "parent_resource_id" { description = "The ID of the project in which storage bucket destination will be created." + type = string } diff --git a/examples/storage/project/main.tf b/examples/storage/project/main.tf index 89bdaa6f..b99843c0 100644 --- a/examples/storage/project/main.tf +++ b/examples/storage/project/main.tf @@ -20,8 +20,8 @@ provider "google" { resource "random_string" "suffix" { length = 4 - upper = "false" - special = "false" + upper = false + special = false } module "log_export" { @@ -31,7 +31,7 @@ module "log_export" { log_sink_name = "storage_project_${random_string.suffix.result}" parent_resource_id = var.parent_resource_id parent_resource_type = "project" - unique_writer_identity = "true" + unique_writer_identity = true } module "destination" { diff --git a/examples/storage/project/variables.tf b/examples/storage/project/variables.tf index cbfb9f52..4e969d3a 100644 --- a/examples/storage/project/variables.tf +++ b/examples/storage/project/variables.tf @@ -16,9 +16,11 @@ variable "project_id" { description = "The ID of the project in which the log export will be created." + type = string } variable "parent_resource_id" { description = "The ID of the project in which storage bucket destination will be created." + type = string } diff --git a/modules/bigquery/README.md b/modules/bigquery/README.md index 70dbe15c..62bfa4f2 100644 --- a/modules/bigquery/README.md +++ b/modules/bigquery/README.md @@ -16,7 +16,7 @@ module "log_export" { log_sink_name = "bigquery_example_logsink" parent_resource_id = "sample-project" parent_resource_type = "project" - unique_writer_identity = "true" + unique_writer_identity = true } module "destination" { @@ -38,7 +38,7 @@ so that all dependencies are met. |------|-------------|:----:|:-----:|:-----:| | dataset\_name | The name of the bigquery dataset to be created and used for log entries matching the filter. | string | n/a | yes | | default\_table\_expiration\_ms | Default table expiration time (in ms) | string | `"3600000"` | no | -| delete\_contents\_on\_destroy | (Optional) If set to true, delete all the tables in the dataset when destroying the resource; otherwise, destroying the resource will fail if tables are present. | string | `"true"` | no | +| delete\_contents\_on\_destroy | (Optional) If set to true, delete all the tables in the dataset when destroying the resource; otherwise, destroying the resource will fail if tables are present. | bool | `"true"` | no | | description | A use-friendly description of the dataset | string | `"Log export dataset"` | no | | labels | Dataset labels | map | `` | no | | location | The location of the storage bucket. | string | `"US"` | no | diff --git a/modules/bigquery/variables.tf b/modules/bigquery/variables.tf index 8b1b372f..5a879376 100644 --- a/modules/bigquery/variables.tf +++ b/modules/bigquery/variables.tf @@ -16,38 +16,45 @@ variable "dataset_name" { description = "The name of the bigquery dataset to be created and used for log entries matching the filter." + type = string } variable "log_sink_writer_identity" { description = "The service account that logging uses to write log entries to the destination. (This is available as an output coming from the root module)." + type = string } variable "project_id" { description = "The ID of the project in which the bigquery dataset will be created." + type = string } variable "location" { description = "The location of the storage bucket." + type = string default = "US" } variable "delete_contents_on_destroy" { description = "(Optional) If set to true, delete all the tables in the dataset when destroying the resource; otherwise, destroying the resource will fail if tables are present." - default = "true" + type = bool + default = true } variable "default_table_expiration_ms" { description = "Default table expiration time (in ms)" + type = number default = 3600000 } variable "description" { description = "A use-friendly description of the dataset" + type = string default = "Log export dataset" } variable "labels" { description = "Dataset labels" - type = map + type = map(string) default = {} } diff --git a/modules/pubsub/README.md b/modules/pubsub/README.md index fb06025f..60e67648 100644 --- a/modules/pubsub/README.md +++ b/modules/pubsub/README.md @@ -16,7 +16,7 @@ module "log_export" { log_sink_name = "pubsub_example_logsink" parent_resource_id = "sample-project" parent_resource_type = "project" - unique_writer_identity = "true" + unique_writer_identity = true } module "destination" { @@ -24,7 +24,7 @@ module "destination" { project_id = "sample-project" topic_name = "sample-topic" log_sink_writer_identity = "${module.log_export.writer_identity}" - create_subscriber = "true" + create_subscriber = true } ``` @@ -37,7 +37,7 @@ so that all dependencies are met. | Name | Description | Type | Default | Required | |------|-------------|:----:|:-----:|:-----:| -| create\_subscriber | Whether to create a subscription to the topic that was created and used for log entries matching the filter. If 'true', a subscription is created along with a service account that is granted roles/pubsub.subscriber and roles/pubsub.viewer to the topic. | string | `"false"` | no | +| create\_subscriber | Whether to create a subscription to the topic that was created and used for log entries matching the filter. If 'true', a subscription is created along with a service account that is granted roles/pubsub.subscriber and roles/pubsub.viewer to the topic. | bool | `"false"` | no | | log\_sink\_writer\_identity | The service account that logging uses to write log entries to the destination. (This is available as an output coming from the root module). | string | n/a | yes | | project\_id | The ID of the project in which the pubsub topic will be created. | string | n/a | yes | | topic\_labels | A set of key/value label pairs to assign to the pubsub topic. | map(string) | `` | no | diff --git a/modules/pubsub/variables.tf b/modules/pubsub/variables.tf index 60ec01be..d1792d06 100644 --- a/modules/pubsub/variables.tf +++ b/modules/pubsub/variables.tf @@ -16,19 +16,23 @@ variable "create_subscriber" { description = "Whether to create a subscription to the topic that was created and used for log entries matching the filter. If 'true', a subscription is created along with a service account that is granted roles/pubsub.subscriber and roles/pubsub.viewer to the topic." - default = "false" + type = bool + default = false } variable "log_sink_writer_identity" { description = "The service account that logging uses to write log entries to the destination. (This is available as an output coming from the root module)." + type = string } variable "project_id" { description = "The ID of the project in which the pubsub topic will be created." + type = string } variable "topic_name" { description = "The name of the pubsub topic to be created and used for log entries matching the filter." + type = string } variable "topic_labels" { diff --git a/modules/storage/README.md b/modules/storage/README.md index 9747af12..d5bf711e 100644 --- a/modules/storage/README.md +++ b/modules/storage/README.md @@ -16,7 +16,7 @@ module "log_export" { log_sink_name = "storage_example_logsink" parent_resource_id = "sample-project" parent_resource_type = "project" - unique_writer_identity = "true" + unique_writer_identity = true } module "destination" { diff --git a/modules/storage/variables.tf b/modules/storage/variables.tf index 3cbfb770..1a859e29 100644 --- a/modules/storage/variables.tf +++ b/modules/storage/variables.tf @@ -16,23 +16,28 @@ variable "log_sink_writer_identity" { description = "The service account that logging uses to write log entries to the destination. (This is available as an output coming from the root module)." + type = string } variable "project_id" { description = "The ID of the project in which the storage bucket will be created." + type = string } variable "storage_bucket_name" { description = "The name of the storage bucket to be created and used for log entries matching the filter." + type = string } variable "location" { description = "The location of the storage bucket." + type = string default = "US" } variable "storage_class" { description = "The storage class of the storage bucket." + type = string default = "MULTI_REGIONAL" } diff --git a/test/fixtures/bigquery/folder/variables.tf b/test/fixtures/bigquery/folder/variables.tf index eb4aa857..00d7d733 100644 --- a/test/fixtures/bigquery/folder/variables.tf +++ b/test/fixtures/bigquery/folder/variables.tf @@ -16,9 +16,11 @@ variable "project_id" { description = "The ID of the project in which the log export will be created." + type = string } variable "parent_resource_folder" { description = "The ID of the parent resource folder in which the destination will be created." + type = string } diff --git a/test/fixtures/bigquery/organization/variables.tf b/test/fixtures/bigquery/organization/variables.tf index a2962e4f..271d98a9 100644 --- a/test/fixtures/bigquery/organization/variables.tf +++ b/test/fixtures/bigquery/organization/variables.tf @@ -16,9 +16,11 @@ variable "project_id" { description = "The ID of the project in which the log export will be created." + type = string } variable "parent_resource_organization" { description = "The ID of the parent resource organization in which the destination will be created." + type = string } diff --git a/test/fixtures/bigquery/project/variables.tf b/test/fixtures/bigquery/project/variables.tf index b661cd52..77cb3812 100644 --- a/test/fixtures/bigquery/project/variables.tf +++ b/test/fixtures/bigquery/project/variables.tf @@ -16,9 +16,11 @@ variable "project_id" { description = "The ID of the project in which the log export will be created." + type = string } variable "parent_resource_project" { description = "The ID of the parent resource project in which the destination will be created." + type = string } diff --git a/test/fixtures/computed_values/main.tf b/test/fixtures/computed_values/main.tf index 06addbb2..7ca92346 100644 --- a/test/fixtures/computed_values/main.tf +++ b/test/fixtures/computed_values/main.tf @@ -16,8 +16,8 @@ resource "random_string" "suffix" { length = 4 - upper = "false" - special = "false" + upper = false + special = false } resource "google_project" "computed" { diff --git a/test/fixtures/computed_values/variables.tf b/test/fixtures/computed_values/variables.tf index 097b4578..7bdfd01f 100644 --- a/test/fixtures/computed_values/variables.tf +++ b/test/fixtures/computed_values/variables.tf @@ -16,13 +16,16 @@ variable "project_id" { description = "The ID of the project in which the log export will be created." + type = string } variable "parent_resource_folder" { description = "The ID of the parent resource folder in which the destination and the test project will be created." + type = string } variable "parent_resource_billing_account" { description = "The ID of the billing account in which the test project will be created." + type = string } diff --git a/test/fixtures/pubsub/folder/variables.tf b/test/fixtures/pubsub/folder/variables.tf index eb4aa857..00d7d733 100644 --- a/test/fixtures/pubsub/folder/variables.tf +++ b/test/fixtures/pubsub/folder/variables.tf @@ -16,9 +16,11 @@ variable "project_id" { description = "The ID of the project in which the log export will be created." + type = string } variable "parent_resource_folder" { description = "The ID of the parent resource folder in which the destination will be created." + type = string } diff --git a/test/fixtures/pubsub/organization/variables.tf b/test/fixtures/pubsub/organization/variables.tf index a2962e4f..271d98a9 100644 --- a/test/fixtures/pubsub/organization/variables.tf +++ b/test/fixtures/pubsub/organization/variables.tf @@ -16,9 +16,11 @@ variable "project_id" { description = "The ID of the project in which the log export will be created." + type = string } variable "parent_resource_organization" { description = "The ID of the parent resource organization in which the destination will be created." + type = string } diff --git a/test/fixtures/pubsub/project/variables.tf b/test/fixtures/pubsub/project/variables.tf index b661cd52..77cb3812 100644 --- a/test/fixtures/pubsub/project/variables.tf +++ b/test/fixtures/pubsub/project/variables.tf @@ -16,9 +16,11 @@ variable "project_id" { description = "The ID of the project in which the log export will be created." + type = string } variable "parent_resource_project" { description = "The ID of the parent resource project in which the destination will be created." + type = string } diff --git a/test/fixtures/storage/folder/variables.tf b/test/fixtures/storage/folder/variables.tf index eb4aa857..00d7d733 100644 --- a/test/fixtures/storage/folder/variables.tf +++ b/test/fixtures/storage/folder/variables.tf @@ -16,9 +16,11 @@ variable "project_id" { description = "The ID of the project in which the log export will be created." + type = string } variable "parent_resource_folder" { description = "The ID of the parent resource folder in which the destination will be created." + type = string } diff --git a/test/fixtures/storage/organization/variables.tf b/test/fixtures/storage/organization/variables.tf index a2962e4f..271d98a9 100644 --- a/test/fixtures/storage/organization/variables.tf +++ b/test/fixtures/storage/organization/variables.tf @@ -16,9 +16,11 @@ variable "project_id" { description = "The ID of the project in which the log export will be created." + type = string } variable "parent_resource_organization" { description = "The ID of the parent resource organization in which the destination will be created." + type = string } diff --git a/test/fixtures/storage/project/variables.tf b/test/fixtures/storage/project/variables.tf index 7c8ba273..265bc18b 100644 --- a/test/fixtures/storage/project/variables.tf +++ b/test/fixtures/storage/project/variables.tf @@ -16,8 +16,10 @@ variable "project_id" { description = "The ID of the project in which the log export will be created." + type = string } variable "parent_resource_project" { description = "The ID of the parent resource project in which the destination will be created." + type = string } diff --git a/variables.tf b/variables.tf index 9885166e..ace9002b 100644 --- a/variables.tf +++ b/variables.tf @@ -16,32 +16,39 @@ variable "destination_uri" { description = "The self_link URI of the destination resource (This is available as an output coming from one of the destination submodules)" + type = string } variable "filter" { description = "The filter to apply when exporting logs. Only log entries that match the filter are exported. Default is '' which exports all logs." + type = string default = "" } variable "include_children" { description = "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." - default = "false" + type = bool + default = false } variable "log_sink_name" { description = "The name of the log sink to be created." + type = string } variable "parent_resource_id" { description = "The ID of the GCP resource in which you create the log sink. If var.parent_resource_type is set to 'project', then this is the Project ID (and etc)." + type = string } variable "parent_resource_type" { description = "The GCP resource in which you create the log sink. The value must not be computed, and must be one of the following: 'project', 'folder', 'billing_account', or 'organization'." + type = string default = "project" } variable "unique_writer_identity" { description = "Whether or not to create a unique identity associated with this sink. If false (the default), then the writer_identity used is serviceAccount:cloud-logs@system.gserviceaccount.com. If true, then a unique service account is created and used for the logging sink." - default = "false" + type = bool + default = false }