move ilb as next hop blueprint to module-level recipe

This commit is contained in:
Ludo
2025-02-20 16:26:38 +01:00
parent 82f1cf965f
commit 7aad81d97f
18 changed files with 52 additions and 38 deletions

View File

@@ -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)

View File

@@ -30,12 +30,6 @@ They are meant to be used as minimal but complete starting points to create actu
<br clear="left">
### Internal Network LB as next hop
<a href="./ilb-next-hop/" title="Internal Network LB as next hop"><img src="./ilb-next-hop/diagram.png" align="left" width="280px"></a> 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.
<br clear="left">
<!--
### Nginx-based reverse proxy cluster

View File

@@ -722,10 +722,12 @@ module "ilb-l7" {
```
## 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)
When 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)
<!-- TFDOC OPTS files:1 -->
<!-- BEGIN TFDOC -->
## 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)

View File

@@ -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)
<!-- END TOC -->
@@ -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
<!--
One other issue is a `Provider produced inconsistent final plan` error which is sometimes raised when switching template version. This seems to be related to this [open provider issue](https://github.com/terraform-providers/terraform-provider-google/issues/3937), but it's relatively harmless since the resource is updated, and subsequent applies raise no errors.
-->
## Recipes
- [Internal load balancer as next hop](./recipe-ilb-next-hop/)
<!-- BEGIN TFDOC -->
## 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 |

View File

@@ -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`:
<a href="https://raw.githubusercontent.com/terraform-google-modules/cloud-foundation-fabric/master/networking/ilb-next-hop/test_session.png" title="Test session screenshot"><img src="./test_session.png" width="640px" alt="Test session screenshot"></img>
<!-- BEGIN TFDOC -->
## Variables
| name | description | type | required | default |
|---|---|:---:|:---:|:---:|
| [prefix](variables.tf#L38) | Prefix used for resource names. | <code>string</code> | ✓ | |
| [project_id](variables.tf#L53) | Existing project id. | <code>string</code> | ✓ | |
| [project_id](variables.tf#L47) | Existing project id. | <code>string</code> | ✓ | |
| [ilb_right_enable](variables.tf#L17) | Route right to left traffic through ILB. | <code>bool</code> | | <code>false</code> |
| [ilb_session_affinity](variables.tf#L23) | Session affinity configuration for ILBs. | <code>string</code> | | <code>&#34;CLIENT_IP&#34;</code> |
| [ip_ranges](variables.tf#L29) | IP CIDR ranges used for VPC subnets. | <code>map&#40;string&#41;</code> | | <code title="&#123;&#10; left &#61; &#34;10.0.0.0&#47;24&#34;&#10; right &#61; &#34;10.0.1.0&#47;24&#34;&#10;&#125;">&#123;&#8230;&#125;</code> |
| [project_create](variables.tf#L47) | Create project instead of using an existing one. | <code>bool</code> | | <code>false</code> |
| [region](variables.tf#L58) | Region used for resources. | <code>string</code> | | <code>&#34;europe-west1&#34;</code> |
| [zones](variables.tf#L64) | Zone suffixes used for instances. | <code>list&#40;string&#41;</code> | | <code>&#91;&#34;b&#34;, &#34;c&#34;&#93;</code> |
| [region](variables.tf#L52) | Region used for resources. | <code>string</code> | | <code>&#34;europe-west1&#34;</code> |
| [zones](variables.tf#L58) | Zone suffixes used for instances. | <code>list&#40;string&#41;</code> | | <code>&#91;&#34;b&#34;, &#34;c&#34;&#93;</code> |
## 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. | |
<!-- END TFDOC -->
## 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
```

View File

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 88 KiB

View File

@@ -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",

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

@@ -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

View File

@@ -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.')