Add count to toggle optional modules
This commit is contained in:
@@ -59,6 +59,7 @@ This is an optional part, and if it is expressed with correct variables, the hig
|
||||
| *billing_account* | Billing account id used as default for new projects. | <code title="">string</code> | | <code title="">null</code> |
|
||||
| *bundle_path* | Path used to write the intermediate Cloud Function code bundle. | <code title="">string</code> | | <code title="">./bundle.zip</code> |
|
||||
| *bundle_path_cffile* | Path used to write the intermediate Cloud Function code bundle. | <code title="">string</code> | | <code title="">./bundle_cffile.zip</code> |
|
||||
| *cai_gcs_export* | Enable optional part to export tables to GCS | <code title="">bool</code> | | <code title="">false</code> |
|
||||
| *file_config* | Optional BQ table as a file export function config. | <code title="object({ bucket = string filename = string format = string bq_dataset = string bq_table = string })">object({...})</code> | | <code title="{ bucket = null filename = null format = null bq_dataset = null bq_table = null }">...</code> |
|
||||
| *location* | Appe Engine location used in the example. | <code title="">string</code> | | <code title="">europe-west</code> |
|
||||
| *name* | Arbitrary string used to name created resources. | <code title="">string</code> | | <code title="">asset-inventory</code> |
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Projects #
|
||||
###############################################################################
|
||||
@@ -106,6 +108,7 @@ module "cf" {
|
||||
}
|
||||
|
||||
module "cffile" {
|
||||
count = var.cai_gcs_export ? 1 : 0
|
||||
source = "../../modules/cloud-function"
|
||||
project_id = module.project.project_id
|
||||
region = var.region
|
||||
@@ -164,6 +167,7 @@ resource "google_cloud_scheduler_job" "job" {
|
||||
}
|
||||
|
||||
resource "google_cloud_scheduler_job" "job_file" {
|
||||
count = var.cai_gcs_export ? 1 : 0
|
||||
project = google_app_engine_application.app.project
|
||||
region = var.region
|
||||
name = "file-export-job"
|
||||
|
||||
@@ -26,12 +26,6 @@ variable "bundle_path" {
|
||||
default = "./bundle.zip"
|
||||
}
|
||||
|
||||
variable "bundle_path_cffile" {
|
||||
description = "Path used to write the intermediate Cloud Function code bundle."
|
||||
type = string
|
||||
default = "./bundle_cffile.zip"
|
||||
}
|
||||
|
||||
variable "cai_config" {
|
||||
description = "Cloud Asset Inventory export config."
|
||||
type = object({
|
||||
@@ -42,24 +36,6 @@ variable "cai_config" {
|
||||
})
|
||||
}
|
||||
|
||||
variable "file_config" {
|
||||
description = "Optional BQ table as a file export function config."
|
||||
type = object({
|
||||
bucket = string
|
||||
filename = string
|
||||
format = string
|
||||
bq_dataset = string
|
||||
bq_table = string
|
||||
})
|
||||
default = {
|
||||
bucket = null
|
||||
filename = null
|
||||
format = null
|
||||
bq_dataset = null
|
||||
bq_table = null
|
||||
}
|
||||
}
|
||||
|
||||
variable "location" {
|
||||
description = "Appe Engine location used in the example."
|
||||
type = string
|
||||
@@ -73,13 +49,6 @@ variable "name" {
|
||||
default = "asset-inventory"
|
||||
}
|
||||
|
||||
|
||||
variable "name_cffile" {
|
||||
description = "Arbitrary string used to name created resources."
|
||||
type = string
|
||||
default = "cffile-exporter"
|
||||
}
|
||||
|
||||
variable "project_create" {
|
||||
description = "Create project instead ofusing an existing one."
|
||||
type = bool
|
||||
@@ -102,3 +71,40 @@ variable "root_node" {
|
||||
type = string
|
||||
default = null
|
||||
}
|
||||
|
||||
variable "cai_gcs_export" {
|
||||
description = "Enable optional part to export tables to GCS"
|
||||
type = bool
|
||||
default = false
|
||||
}
|
||||
|
||||
|
||||
variable "name_cffile" {
|
||||
description = "Arbitrary string used to name created resources."
|
||||
type = string
|
||||
default = "cffile-exporter"
|
||||
}
|
||||
|
||||
variable "file_config" {
|
||||
description = "Optional BQ table as a file export function config."
|
||||
type = object({
|
||||
bucket = string
|
||||
filename = string
|
||||
format = string
|
||||
bq_dataset = string
|
||||
bq_table = string
|
||||
})
|
||||
default = {
|
||||
bucket = null
|
||||
filename = null
|
||||
format = null
|
||||
bq_dataset = null
|
||||
bq_table = null
|
||||
}
|
||||
}
|
||||
|
||||
variable "bundle_path_cffile" {
|
||||
description = "Path used to write the intermediate Cloud Function code bundle."
|
||||
type = string
|
||||
default = "./bundle_cffile.zip"
|
||||
}
|
||||
@@ -18,6 +18,7 @@ module "test" {
|
||||
source = "../../../../cloud-operations/scheduled-asset-inventory-export-bq"
|
||||
billing_account = var.billing_account
|
||||
cai_config = var.cai_config
|
||||
cai_gcs_export = var.cai_gcs_export
|
||||
file_config = var.file_config
|
||||
project_create = var.project_create
|
||||
project_id = var.project_id
|
||||
|
||||
@@ -32,6 +32,11 @@ variable "cai_config" {
|
||||
}
|
||||
}
|
||||
|
||||
variable "cai_gcs_export" {
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
|
||||
variable "file_config" {
|
||||
type = object({
|
||||
bucket = string
|
||||
|
||||
Reference in New Issue
Block a user