diff --git a/blueprints/README.md b/blueprints/README.md
index 2aa985a6d..b99441868 100644
--- a/blueprints/README.md
+++ b/blueprints/README.md
@@ -9,7 +9,7 @@ Currently available blueprints:
- **data solutions** - [GCE and GCS CMEK via centralized Cloud KMS](./data-solutions/cmek-via-centralized-kms), [Cloud SQL instance with multi-region read replicas](./data-solutions/cloudsql-multiregion), [Data Platform](./data-solutions/data-platform-foundations), [Minimal Data Platform](./data-solutions/data-platform-minimal), [Spinning up a foundation data pipeline on Google Cloud using Cloud Storage, Dataflow and BigQuery](./data-solutions/gcs-to-bq-with-least-privileges), [#SQL Server Always On Groups blueprint](./data-solutions/sqlserver-alwayson), [Data Playground](./data-solutions/data-playground), [MLOps with Vertex AI](./data-solutions/vertex-mlops), [Shielded Folder](./data-solutions/shielded-folder), [BigQuery ML and Vertex AI Pipeline](./data-solutions/bq-ml)
- **factories** - [Fabric resource factories](./factories)
- **GKE** - [Binary Authorization Pipeline Blueprint](./gke/binauthz), [Storage API](./gke/binauthz/image), [Multi-cluster mesh on GKE (fleet API)](./gke/multi-cluster-mesh-gke-fleet-api), [GKE Multitenant](../fast/stages/3-gke-dev), [Shared VPC with GKE support](./networking/shared-vpc-gke/), [GKE Autopilot](./gke/autopilot)
-- **networking** - [Calling a private Cloud Function from On-premises](./networking/private-cloud-function-from-onprem), [HA VPN over Interconnect](./networking/ha-vpn-over-interconnect/), [GLB and multi-regional daisy-chaining through hybrid NEGs](./networking/glb-hybrid-neg-internal), [Hybrid connectivity to on-premise services through PSC](./networking/psc-hybrid), [HTTP Load Balancer with Cloud Armor](./networking/glb-and-armor), [Internal Load Balancer as Next Hop](./networking/ilb-next-hop), On-prem DNS and Google Private Access, [PSC Producer](./networking/psc-hybrid/psc-producer), [PSC Consumer](./networking/psc-hybrid/psc-consumer), [Shared VPC with optional GKE cluster](./networking/shared-vpc-gke), [VPC Connectivity Lab](./networking/vpc-connectivity-lab/)
+- **networking** - [Calling a private Cloud Function from On-premises](./networking/private-cloud-function-from-onprem), [HA VPN over Interconnect](./networking/ha-vpn-over-interconnect/), [GLB and multi-regional daisy-chaining through hybrid NEGs](./networking/glb-hybrid-neg-internal), [Hybrid connectivity to on-premise services through PSC](./networking/psc-hybrid), [HTTP Load Balancer with Cloud Armor](./networking/glb-and-armor), On-prem DNS and Google Private Access, [PSC Producer](./networking/psc-hybrid/psc-producer), [PSC Consumer](./networking/psc-hybrid/psc-consumer), [Shared VPC with optional GKE cluster](./networking/shared-vpc-gke), [VPC Connectivity Lab](./networking/vpc-connectivity-lab/)
- **SecOps** - [SecOps GKE Forwarder](./secops/secops-gke-forwarder)
- **serverless** - [Cloud Run series](./serverless/cloud-run-explore)
- **third party solutions** - [OpenShift on GCP user-provisioned infrastructure](./third-party-solutions/openshift), [Wordpress deployment on Cloud Run](./third-party-solutions/wordpress/cloudrun)
diff --git a/blueprints/networking/README.md b/blueprints/networking/README.md
index d9b20c652..96b569a75 100644
--- a/blueprints/networking/README.md
+++ b/blueprints/networking/README.md
@@ -30,12 +30,6 @@ They are meant to be used as minimal but complete starting points to create actu
-### Internal Network LB as next hop
-
-
This [blueprint](./ilb-next-hop/) allows testing [Internal Network LB as next hop](https://cloud.google.com/load-balancing/docs/internal/ilb-next-hop-overview) using simple Linux gateway VMS between two VPCs, to emulate virtual appliances. An optional additional Internal Network LB can be enabled to test multiple load balancer configurations and hashing.
-
-
-
+
## Recipes
- [Cross-region internal Application Load Balancer with VM instance group backends](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/blob/master/modules/net-lb-app-int-cross-region/recipe-cross-reg-int-app-lb-vm-dns)
diff --git a/modules/net-lb-int/README.md b/modules/net-lb-int/README.md
index 567d04c43..5b6de2fa3 100644
--- a/modules/net-lb-int/README.md
+++ b/modules/net-lb-int/README.md
@@ -13,6 +13,8 @@ This module allows managing a GCE Internal Load Balancer and integrates the forw
- [End to end example](#end-to-end-example)
- [Deploying changes to load balancer configurations](#deploying-changes-to-load-balancer-configurations)
- [Issues](#issues)
+- [Recipes](#recipes)
+- [Recipes](#recipes)
- [Variables](#variables)
- [Outputs](#outputs)
@@ -349,8 +351,8 @@ module "ilb" {
```
## Deploying changes to load balancer configurations
-For deploying changes to load balancer configuration please refer to [net-lb-app-ext README.md](../net-lb-app-ext/README.md#deploying-changes-to-load-balancer-configurations)
+For deploying changes to load balancer configuration please refer to [net-lb-app-ext README.md](../net-lb-app-ext/README.md#deploying-changes-to-load-balancer-configurations)
## Issues
@@ -359,7 +361,15 @@ There are some corner cases where Terraform raises a cycle error on apply, for e
+
+## Recipes
+
+- [Internal load balancer as next hop](./recipe-ilb-next-hop/)
+## Recipes
+
+- [Internal Network Load Balancer as Next Hop](https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/blob/master/modules/net-lb-int/recipe-ilb-next-hop)
+
## Variables
| name | description | type | required | default |
diff --git a/blueprints/networking/ilb-next-hop/OWNERS b/modules/net-lb-int/recipe-ilb-next-hop/OWNERS
similarity index 100%
rename from blueprints/networking/ilb-next-hop/OWNERS
rename to modules/net-lb-int/recipe-ilb-next-hop/OWNERS
diff --git a/blueprints/networking/ilb-next-hop/README.md b/modules/net-lb-int/recipe-ilb-next-hop/README.md
similarity index 86%
rename from blueprints/networking/ilb-next-hop/README.md
rename to modules/net-lb-int/recipe-ilb-next-hop/README.md
index 009d6404f..3f712eb83 100644
--- a/blueprints/networking/ilb-next-hop/README.md
+++ b/modules/net-lb-int/recipe-ilb-next-hop/README.md
@@ -1,6 +1,6 @@
# Internal Network Load Balancer as Next Hop
-This blueprint bootstraps a minimal infrastructure for testing [ILB as next hop](https://cloud.google.com/load-balancing/docs/internal/ilb-next-hop-overview), using simple Linux gateway VMS between two VPCs to emulate virtual appliances.
+This recipe shows how to bootstraps a minimal infrastructure for testing [ILB as next hop](https://cloud.google.com/load-balancing/docs/internal/ilb-next-hop-overview), using simple Linux gateway VMS between two VPCs to emulate virtual appliances.
The following diagram shows the resources created by this blueprint
@@ -60,19 +60,17 @@ A sample testing session using `tmux`:
-
## Variables
| name | description | type | required | default |
|---|---|:---:|:---:|:---:|
| [prefix](variables.tf#L38) | Prefix used for resource names. | string | ✓ | |
-| [project_id](variables.tf#L53) | Existing project id. | string | ✓ | |
+| [project_id](variables.tf#L47) | Existing project id. | string | ✓ | |
| [ilb_right_enable](variables.tf#L17) | Route right to left traffic through ILB. | bool | | false |
| [ilb_session_affinity](variables.tf#L23) | Session affinity configuration for ILBs. | string | | "CLIENT_IP" |
| [ip_ranges](variables.tf#L29) | IP CIDR ranges used for VPC subnets. | map(string) | | {…} |
-| [project_create](variables.tf#L47) | Create project instead of using an existing one. | bool | | false |
-| [region](variables.tf#L58) | Region used for resources. | string | | "europe-west1" |
-| [zones](variables.tf#L64) | Zone suffixes used for instances. | list(string) | | ["b", "c"] |
+| [region](variables.tf#L52) | Region used for resources. | string | | "europe-west1" |
+| [zones](variables.tf#L58) | Zone suffixes used for instances. | list(string) | | ["b", "c"] |
## Outputs
@@ -84,17 +82,18 @@ A sample testing session using `tmux`:
| [ssh_gw](outputs.tf#L48) | Command-line login to gateway VMs. | |
| [ssh_vm_left](outputs.tf#L56) | Command-line login to left VMs. | |
| [ssh_vm_right](outputs.tf#L64) | Command-line login to right VMs. | |
-
-
## Test
```hcl
module "test" {
- source = "./fabric/blueprints/networking/ilb-next-hop"
- prefix = "test"
- project_create = true
- project_id = "project-1"
+ source = "./fabric/modules/net-lb-int/recipe-ilb-next-hop"
+ prefix = "test"
+ project_id = "project-1"
+ _testing = {
+ name = "project-1"
+ number = 1234567890
+ }
}
-# tftest modules=18 resources=49
+# tftest modules=18 resources=48
```
diff --git a/blueprints/networking/ilb-next-hop/assets/gw.yaml b/modules/net-lb-int/recipe-ilb-next-hop/assets/gw.yaml
similarity index 100%
rename from blueprints/networking/ilb-next-hop/assets/gw.yaml
rename to modules/net-lb-int/recipe-ilb-next-hop/assets/gw.yaml
diff --git a/blueprints/networking/ilb-next-hop/backend.tf.sample b/modules/net-lb-int/recipe-ilb-next-hop/backend.tf.sample
similarity index 100%
rename from blueprints/networking/ilb-next-hop/backend.tf.sample
rename to modules/net-lb-int/recipe-ilb-next-hop/backend.tf.sample
diff --git a/blueprints/networking/ilb-next-hop/diagram.png b/modules/net-lb-int/recipe-ilb-next-hop/diagram.png
similarity index 100%
rename from blueprints/networking/ilb-next-hop/diagram.png
rename to modules/net-lb-int/recipe-ilb-next-hop/diagram.png
diff --git a/blueprints/networking/ilb-next-hop/gateways.tf b/modules/net-lb-int/recipe-ilb-next-hop/gateways.tf
similarity index 100%
rename from blueprints/networking/ilb-next-hop/gateways.tf
rename to modules/net-lb-int/recipe-ilb-next-hop/gateways.tf
diff --git a/blueprints/networking/ilb-next-hop/main.tf b/modules/net-lb-int/recipe-ilb-next-hop/main.tf
similarity index 90%
rename from blueprints/networking/ilb-next-hop/main.tf
rename to modules/net-lb-int/recipe-ilb-next-hop/main.tf
index 66ca6ac4d..efdc0f08b 100644
--- a/blueprints/networking/ilb-next-hop/main.tf
+++ b/modules/net-lb-int/recipe-ilb-next-hop/main.tf
@@ -23,9 +23,12 @@ locals {
}
module "project" {
- source = "../../../modules/project"
- name = var.project_id
- project_reuse = var.project_create ? null : {}
+ source = "../../../modules/project"
+ name = var.project_id
+ project_reuse = {
+ use_data_source = var._testing == null
+ project_attributes = var._testing
+ }
services = [
"compute.googleapis.com",
"dns.googleapis.com",
diff --git a/blueprints/networking/ilb-next-hop/outputs.tf b/modules/net-lb-int/recipe-ilb-next-hop/outputs.tf
similarity index 100%
rename from blueprints/networking/ilb-next-hop/outputs.tf
rename to modules/net-lb-int/recipe-ilb-next-hop/outputs.tf
diff --git a/blueprints/networking/ilb-next-hop/test_session.png b/modules/net-lb-int/recipe-ilb-next-hop/test_session.png
similarity index 100%
rename from blueprints/networking/ilb-next-hop/test_session.png
rename to modules/net-lb-int/recipe-ilb-next-hop/test_session.png
diff --git a/blueprints/networking/ilb-next-hop/variables.tf b/modules/net-lb-int/recipe-ilb-next-hop/variables.tf
similarity index 86%
rename from blueprints/networking/ilb-next-hop/variables.tf
rename to modules/net-lb-int/recipe-ilb-next-hop/variables.tf
index 51a7c03ef..be59b2177 100644
--- a/blueprints/networking/ilb-next-hop/variables.tf
+++ b/modules/net-lb-int/recipe-ilb-next-hop/variables.tf
@@ -14,6 +14,16 @@
* limitations under the License.
*/
+variable "_testing" {
+ description = "Populate this variable to avoid triggering the data source."
+ type = object({
+ name = string
+ number = number
+ services_enabled = optional(list(string), [])
+ })
+ default = null
+}
+
variable "ilb_right_enable" {
description = "Route right to left traffic through ILB."
type = bool
@@ -44,12 +54,6 @@ variable "prefix" {
}
}
-variable "project_create" {
- description = "Create project instead of using an existing one."
- type = bool
- default = false
-}
-
variable "project_id" {
description = "Existing project id."
type = string
diff --git a/blueprints/networking/ilb-next-hop/vms.tf b/modules/net-lb-int/recipe-ilb-next-hop/vms.tf
similarity index 100%
rename from blueprints/networking/ilb-next-hop/vms.tf
rename to modules/net-lb-int/recipe-ilb-next-hop/vms.tf
diff --git a/blueprints/networking/ilb-next-hop/vpc-left.tf b/modules/net-lb-int/recipe-ilb-next-hop/vpc-left.tf
similarity index 100%
rename from blueprints/networking/ilb-next-hop/vpc-left.tf
rename to modules/net-lb-int/recipe-ilb-next-hop/vpc-left.tf
diff --git a/blueprints/networking/ilb-next-hop/vpc-right.tf b/modules/net-lb-int/recipe-ilb-next-hop/vpc-right.tf
similarity index 100%
rename from blueprints/networking/ilb-next-hop/vpc-right.tf
rename to modules/net-lb-int/recipe-ilb-next-hop/vpc-right.tf
diff --git a/tools/check_documentation.py b/tools/check_documentation.py
index 957f18f29..7a6f79628 100755
--- a/tools/check_documentation.py
+++ b/tools/check_documentation.py
@@ -177,13 +177,15 @@ def main(dirs, exclude_file=None, files=False, show_diffs=False,
print(f'[{state.label}] {readme_path}')
if errors:
- if show_diffs:
- print('Errored diffs:')
- print('\n'.join([e[1] for e in errors]))
- else:
- print('Errored modules:')
- print('\n'.join([e[0] for e in errors]))
- print(errors)
+ print('\nErrored modules:\n')
+ for e in errors:
+ module, diff = e
+ print(f'- {module}')
+ if show_diffs:
+ print()
+ print(''.join(diff))
+ print()
+ print()
raise SystemExit('Errors found.')