diff --git a/cloud-operations/scheduled-asset-inventory-export-bq/README.md b/cloud-operations/scheduled-asset-inventory-export-bq/README.md
index 40fe75a5..44c6ecbb 100644
--- a/cloud-operations/scheduled-asset-inventory-export-bq/README.md
+++ b/cloud-operations/scheduled-asset-inventory-export-bq/README.md
@@ -44,14 +44,14 @@ You can also create a dashboard connecting [Datalab](https://datastudio.google.c
| name | description | type | required | default |
|---|---|:---: |:---:|:---:|
| billing_account | Billing account id used as default for new projects. | string
| ✓ | |
-| cai_config | Cloud Asset inventory export config. | object({...})
| ✓ | |
+| cai_config | Cloud Asset inventory export config. | object({...})
| ✓ | |
| project_id | Project id that references existing project. | string
| ✓ | |
-| root_node | The resource name of the parent Folder or Organization. Must be of the form folders/folder_id or organizations/org_id. | string
| ✓ | |
| *bundle_path* | Path used to write the intermediate Cloud Function code bundle. | string
| | ./bundle.zip
|
| *location* | Appe Engine location used in the example. | string
| | europe-west
|
| *name* | Arbitrary string used to name created resources. | string
| | asset-inventory
|
| *project_create* | Create project instead ofusing an existing one. | bool
| | true
|
| *region* | Compute region used in the example. | string
| | europe-west1
|
+| *root_node* | The resource name of the parent folder or organization for project creation, in 'folders/folder_id' or 'organizations/org_id' format. | string
| | null
|
## Outputs
diff --git a/cloud-operations/scheduled-asset-inventory-export-bq/variables.tf b/cloud-operations/scheduled-asset-inventory-export-bq/variables.tf
index 80e5be85..9011b328 100644
--- a/cloud-operations/scheduled-asset-inventory-export-bq/variables.tf
+++ b/cloud-operations/scheduled-asset-inventory-export-bq/variables.tf
@@ -28,8 +28,8 @@ variable "bundle_path" {
variable "cai_config" {
description = "Cloud Asset inventory export config."
type = object({
- bq_dataset = string
- bq_table = string
+ bq_dataset = string
+ bq_table = string
})
}
@@ -64,6 +64,7 @@ variable "region" {
}
variable "root_node" {
- description = "The resource name of the parent Folder or Organization. Must be of the form folders/folder_id or organizations/org_id."
+ description = "The resource name of the parent folder or organization for project creation, in 'folders/folder_id' or 'organizations/org_id' format."
type = string
+ default = null
}
diff --git a/tests/cloud_operations/scheduled_asset_inventory_export_bq/__init__.py b/tests/cloud_operations/scheduled_asset_inventory_export_bq/__init__.py
new file mode 100644
index 00000000..6913f02e
--- /dev/null
+++ b/tests/cloud_operations/scheduled_asset_inventory_export_bq/__init__.py
@@ -0,0 +1,13 @@
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
diff --git a/tests/cloud_operations/scheduled_asset_inventory_export_bq/fixture/cf/README b/tests/cloud_operations/scheduled_asset_inventory_export_bq/fixture/cf/README
new file mode 100644
index 00000000..e69de29b
diff --git a/tests/cloud_operations/scheduled_asset_inventory_export_bq/fixture/main.tf b/tests/cloud_operations/scheduled_asset_inventory_export_bq/fixture/main.tf
new file mode 100644
index 00000000..f928266a
--- /dev/null
+++ b/tests/cloud_operations/scheduled_asset_inventory_export_bq/fixture/main.tf
@@ -0,0 +1,23 @@
+/**
+ * Copyright 2020 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+module "test" {
+ source = "../../../../cloud-operations/scheduled-asset-inventory-export-bq"
+ billing_account = var.billing_account
+ cai_config = var.cai_config
+ project_create = var.project_create
+ project_id = var.project_id
+}
diff --git a/tests/cloud_operations/scheduled_asset_inventory_export_bq/fixture/variables.tf b/tests/cloud_operations/scheduled_asset_inventory_export_bq/fixture/variables.tf
new file mode 100644
index 00000000..9d0ec21a
--- /dev/null
+++ b/tests/cloud_operations/scheduled_asset_inventory_export_bq/fixture/variables.tf
@@ -0,0 +1,39 @@
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+variable "billing_account" {
+ type = string
+ default = "1234-ABCD-1234"
+}
+
+variable "cai_config" {
+ type = object({
+ bq_dataset = string
+ bq_table = string
+ })
+ default = {
+ bq_dataset = "my-dataset"
+ bq_table = "my_table"
+ }
+}
+
+variable "project_create" {
+ type = bool
+ default = true
+}
+
+variable "project_id" {
+ type = string
+ default = "project-1"
+}
diff --git a/tests/cloud_operations/scheduled_asset_inventory_export_bq/test_plan.py b/tests/cloud_operations/scheduled_asset_inventory_export_bq/test_plan.py
new file mode 100644
index 00000000..bd791a09
--- /dev/null
+++ b/tests/cloud_operations/scheduled_asset_inventory_export_bq/test_plan.py
@@ -0,0 +1,27 @@
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+import os
+import pytest
+
+
+FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'fixture')
+
+
+def test_resources(e2e_plan_runner):
+ "Test that plan works and the numbers of resources is as expected."
+ modules, resources = e2e_plan_runner(FIXTURES_DIR)
+ assert len(modules) == 5
+ assert len(resources) == 17