From 2cdb8e61407279cb8ce0ad10bd01b27e0031798b Mon Sep 17 00:00:00 2001 From: Abhishek Tiwari Date: Tue, 29 Oct 2024 07:30:24 +0000 Subject: [PATCH] Rename lb-http-backend to backend and similar for frontend --- .../README.md | 8 ++--- .../main.tf | 36 +++++++++---------- .../mig.tf | 22 ++++++------ .../outputs.tf | 2 +- .../variables.tf | 22 +----------- .../versions.tf | 2 +- metadata.yaml | 10 +++--- .../{lb-http-backend => backend}/README.md | 2 +- modules/{lb-http-backend => backend}/main.tf | 0 .../metadata.display.yaml | 4 +-- .../metadata.yaml | 4 +-- .../{lb-http-backend => backend}/outputs.tf | 0 .../{lb-http-backend => backend}/variables.tf | 2 +- .../{lb-http-backend => backend}/versions.tf | 6 ++-- .../{lb-http-frontend => frontend}/README.md | 2 +- .../{lb-http-frontend => frontend}/main.tf | 2 +- .../metadata.display.yaml | 10 ++---- .../metadata.yaml | 12 ++----- .../{lb-http-frontend => frontend}/outputs.tf | 2 +- .../variables.tf | 2 +- .../versions.tf | 6 ++-- 21 files changed, 61 insertions(+), 95 deletions(-) rename modules/{lb-http-backend => backend}/README.md (97%) rename modules/{lb-http-backend => backend}/main.tf (100%) rename modules/{lb-http-backend => backend}/metadata.display.yaml (97%) rename modules/{lb-http-backend => backend}/metadata.yaml (99%) rename modules/{lb-http-backend => backend}/outputs.tf (100%) rename modules/{lb-http-backend => backend}/variables.tf (99%) rename modules/{lb-http-backend => backend}/versions.tf (93%) rename modules/{lb-http-frontend => frontend}/README.md (95%) rename modules/{lb-http-frontend => frontend}/main.tf (99%) rename modules/{lb-http-frontend => frontend}/metadata.display.yaml (92%) rename modules/{lb-http-frontend => frontend}/metadata.yaml (95%) rename modules/{lb-http-frontend => frontend}/outputs.tf (98%) rename modules/{lb-http-frontend => frontend}/variables.tf (99%) rename modules/{lb-http-frontend => frontend}/versions.tf (92%) diff --git a/examples/lb-http-separate-frontend-and-backend/README.md b/examples/lb-http-separate-frontend-and-backend/README.md index b15aa3b1..fca2cb59 100644 --- a/examples/lb-http-separate-frontend-and-backend/README.md +++ b/examples/lb-http-separate-frontend-and-backend/README.md @@ -2,8 +2,8 @@ [![button](http://gstatic.com/cloudssh/images/open-btn.png)](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/terraform-google-lb-http&working_dir=examples/lb-http-separate-frontend-and-backend&page=shell&tutorial=README.md) -This example creates a global HTTP forwarding rule to forward traffic to instance groups in the us-west1 and us-east1 regions. The `google_compute_backend_service` and its dependencies are created as part of `lb-http-backend` module. -The forwarding rules and its dependecies are created as part of `lb-http-frontend` modules. +This example creates a global HTTP forwarding rule to forward traffic to instance groups in the us-west1 and us-east1 regions. The `google_compute_backend_service` and its dependencies are created as part of `backend` module. +The forwarding rules and its dependecies are created as part of `frontend` modules. ## Change to the example directory @@ -83,11 +83,7 @@ terraform destroy | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| -| group1\_region | n/a | `string` | `"us-west1"` | no | -| group2\_region | n/a | `string` | `"us-east1"` | no | -| network\_prefix | n/a | `string` | `"lb-http-separate-frontend-and-backend"` | no | | project\_id | n/a | `string` | n/a | yes | -| target\_size | n/a | `number` | `2` | no | ## Outputs diff --git a/examples/lb-http-separate-frontend-and-backend/main.tf b/examples/lb-http-separate-frontend-and-backend/main.tf index 02e6de5d..8ba29ca4 100644 --- a/examples/lb-http-separate-frontend-and-backend/main.tf +++ b/examples/lb-http-separate-frontend-and-backend/main.tf @@ -1,5 +1,5 @@ /** - * Copyright 2017 Google LLC + * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,23 +15,23 @@ */ resource "google_compute_network" "default" { - name = var.network_prefix + name = "lb-http-separate-frontend-and-backend" auto_create_subnetworks = "false" } resource "google_compute_subnetwork" "group1" { - name = "${var.network_prefix}-group1" + name = "lb-http-separate-frontend-and-backend-group1" ip_cidr_range = "10.126.0.0/20" network = google_compute_network.default.self_link - region = var.group1_region + region = "us-west1" private_ip_google_access = true } # Router and Cloud NAT are required for installing packages from repos (apache, php etc) resource "google_compute_router" "group1" { - name = "${var.network_prefix}-gw-group1" + name = "lb-http-separate-frontend-and-backend-gw-group1" network = google_compute_network.default.self_link - region = var.group1_region + region = "us-west1" } module "cloud-nat-group1" { @@ -39,23 +39,23 @@ module "cloud-nat-group1" { version = "~> 5.0" router = google_compute_router.group1.name project_id = var.project_id - region = var.group1_region - name = "${var.network_prefix}-cloud-nat-group1" + region = "us-west1" + name = "lb-http-separate-frontend-and-backend-cloud-nat-group1" } resource "google_compute_subnetwork" "group2" { - name = "${var.network_prefix}-group2" + name = "lb-http-separate-frontend-and-backend-group2" ip_cidr_range = "10.127.0.0/20" network = google_compute_network.default.self_link - region = var.group2_region + region = "us-east1" private_ip_google_access = true } # Router and Cloud NAT are required for installing packages from repos (apache, php etc) resource "google_compute_router" "group2" { - name = "${var.network_prefix}-gw-group2" + name = "lb-http-separate-frontend-and-backend-gw-group2" network = google_compute_network.default.self_link - region = var.group2_region + region = "us-east1" } module "cloud-nat-group2" { @@ -63,19 +63,19 @@ module "cloud-nat-group2" { version = "~> 5.0" router = google_compute_router.group2.name project_id = var.project_id - region = var.group2_region - name = "${var.network_prefix}-cloud-nat-group2" + region = "us-east1" + name = "lb-http-separate-frontend-and-backend-cloud-nat-group2" } module "lb-http-backend" { - source = "terraform-google-modules/lb-http/google//modules/lb-http-backend" + source = "terraform-google-modules/lb-http/google//modules/backend" version = "~> 12.0" project_id = var.project_id name = "backend-lb" target_tags = [ - "${var.network_prefix}-group1", + "lb-http-separate-frontend-and-backend-group1", module.cloud-nat-group1.router_name, - "${var.network_prefix}-group2", + "lb-http-separate-frontend-and-backend-group2", module.cloud-nat-group2.router_name ] firewall_networks = [google_compute_network.default.name] @@ -109,7 +109,7 @@ module "lb-http-backend" { } module "lb-http-frontend" { - source = "terraform-google-modules/lb-http/google//modules/lb-http-frontend" + source = "terraform-google-modules/lb-http/google//modules/frontend" version = "~> 12.0" project_id = var.project_id name = "frontend-lb" diff --git a/examples/lb-http-separate-frontend-and-backend/mig.tf b/examples/lb-http-separate-frontend-and-backend/mig.tf index 3e7147d8..defd064c 100644 --- a/examples/lb-http-separate-frontend-and-backend/mig.tf +++ b/examples/lb-http-separate-frontend-and-backend/mig.tf @@ -1,5 +1,5 @@ /** - * Copyright 2017 Google LLC + * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,12 +39,12 @@ module "mig1_template" { email = "" scopes = ["cloud-platform"] } - name_prefix = "${var.network_prefix}-group1" + name_prefix = "lb-http-separate-frontend-and-backend-group1" startup_script = data.template_file.group-startup-script.rendered source_image_family = "ubuntu-2004-lts" source_image_project = "ubuntu-os-cloud" tags = [ - "${var.network_prefix}-group1", + "lb-http-separate-frontend-and-backend-group1", module.cloud-nat-group1.router_name ] } @@ -53,9 +53,9 @@ module "mig1" { source = "terraform-google-modules/vm/google//modules/mig" version = "~> 12.0" instance_template = module.mig1_template.self_link - region = var.group1_region - hostname = "${var.network_prefix}-group1" - target_size = var.target_size + region = "us-west1" + hostname = "lb-http-separate-frontend-and-backend-group1" + target_size = 2 named_ports = [{ name = "http", port = 80 @@ -71,10 +71,10 @@ module "mig2_template" { email = "" scopes = ["cloud-platform"] } - name_prefix = "${var.network_prefix}-group2" + name_prefix = "lb-http-separate-frontend-and-backend-group2" startup_script = data.template_file.group-startup-script.rendered tags = [ - "${var.network_prefix}-group2", + "lb-http-separate-frontend-and-backend-group2", module.cloud-nat-group2.router_name ] } @@ -83,9 +83,9 @@ module "mig2" { source = "terraform-google-modules/vm/google//modules/mig" version = "~> 12.0" instance_template = module.mig2_template.self_link - region = var.group2_region - hostname = "${var.network_prefix}-group2" - target_size = var.target_size + region = "us-east1" + hostname = "lb-http-separate-frontend-and-backend-group2" + target_size = 2 named_ports = [{ name = "http", port = 80 diff --git a/examples/lb-http-separate-frontend-and-backend/outputs.tf b/examples/lb-http-separate-frontend-and-backend/outputs.tf index 15c88033..59c259ba 100644 --- a/examples/lb-http-separate-frontend-and-backend/outputs.tf +++ b/examples/lb-http-separate-frontend-and-backend/outputs.tf @@ -1,5 +1,5 @@ /** - * Copyright 2019 Google LLC + * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/examples/lb-http-separate-frontend-and-backend/variables.tf b/examples/lb-http-separate-frontend-and-backend/variables.tf index 9d06a57f..3d7bc3f7 100644 --- a/examples/lb-http-separate-frontend-and-backend/variables.tf +++ b/examples/lb-http-separate-frontend-and-backend/variables.tf @@ -1,5 +1,5 @@ /** - * Copyright 2019 Google LLC + * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,23 +17,3 @@ variable "project_id" { type = string } - -variable "target_size" { - type = number - default = 2 -} - -variable "group1_region" { - type = string - default = "us-west1" -} - -variable "group2_region" { - type = string - default = "us-east1" -} - -variable "network_prefix" { - type = string - default = "lb-http-separate-frontend-and-backend" -} diff --git a/examples/lb-http-separate-frontend-and-backend/versions.tf b/examples/lb-http-separate-frontend-and-backend/versions.tf index 6646a941..e3798ef8 100644 --- a/examples/lb-http-separate-frontend-and-backend/versions.tf +++ b/examples/lb-http-separate-frontend-and-backend/versions.tf @@ -1,5 +1,5 @@ /** - * Copyright 2020 Google LLC + * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/metadata.yaml b/metadata.yaml index f6035e1e..5736d573 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -31,12 +31,12 @@ spec: description: {} content: subBlueprints: + - name: backend + location: modules/backend - name: dynamic_backends location: modules/dynamic_backends - - name: lb-http-backend - location: modules/lb-http-backend - - name: lb-http-frontend - location: modules/lb-http-frontend + - name: frontend + location: modules/frontend - name: serverless_negs location: modules/serverless_negs examples: @@ -58,6 +58,8 @@ spec: location: examples/https-gke - name: https-redirect location: examples/https-redirect + - name: lb-http-separate-frontend-and-backend + location: examples/lb-http-separate-frontend-and-backend - name: mig-nat-http-lb location: examples/mig-nat-http-lb - name: multi-backend-multi-mig-bucket-https-lb diff --git a/modules/lb-http-backend/README.md b/modules/backend/README.md similarity index 97% rename from modules/lb-http-backend/README.md rename to modules/backend/README.md index 42f4d6c6..d7aa633a 100644 --- a/modules/lb-http-backend/README.md +++ b/modules/backend/README.md @@ -1,5 +1,5 @@ # HTTP Load balancer backend module -This module creates `google_compute_backend_service` resource and its dependencies. This module can be used with `modules/lb-http-frontend`. The separation of the modules makes it easier for creating backend and frontend resources independent of each other. The logical separation helps in improved maintainability. +This module creates `google_compute_backend_service` resource and its dependencies. This module can be used with `modules/frontend`. The separation of the modules makes it easier for creating backend and frontend resources independent of each other. The logical separation helps in improved maintainability. ## Inputs diff --git a/modules/lb-http-backend/main.tf b/modules/backend/main.tf similarity index 100% rename from modules/lb-http-backend/main.tf rename to modules/backend/main.tf diff --git a/modules/lb-http-backend/metadata.display.yaml b/modules/backend/metadata.display.yaml similarity index 97% rename from modules/lb-http-backend/metadata.display.yaml rename to modules/backend/metadata.display.yaml index 298177ab..6ad69d36 100644 --- a/modules/lb-http-backend/metadata.display.yaml +++ b/modules/backend/metadata.display.yaml @@ -15,7 +15,7 @@ apiVersion: blueprints.cloud.google.com/v1alpha1 kind: BlueprintMetadata metadata: - name: terraform-google-lb-http-lb-http-backend-display + name: terraform-google-lb-http-backend-display annotations: config.kubernetes.io/local-config: "true" spec: @@ -24,7 +24,7 @@ spec: source: repo: https://github.com/terraform-google-modules/terraform-google-lb-http.git sourceType: git - dir: /modules/lb-http-backend + dir: /modules/backend ui: input: variables: diff --git a/modules/lb-http-backend/metadata.yaml b/modules/backend/metadata.yaml similarity index 99% rename from modules/lb-http-backend/metadata.yaml rename to modules/backend/metadata.yaml index 5adc94c2..56a6300e 100644 --- a/modules/lb-http-backend/metadata.yaml +++ b/modules/backend/metadata.yaml @@ -15,7 +15,7 @@ apiVersion: blueprints.cloud.google.com/v1alpha1 kind: BlueprintMetadata metadata: - name: terraform-google-lb-http-lb-http-backend + name: terraform-google-lb-http-backend annotations: config.kubernetes.io/local-config: "true" spec: @@ -24,7 +24,7 @@ spec: source: repo: https://github.com/terraform-google-modules/terraform-google-lb-http.git sourceType: git - dir: /modules/lb-http-backend + dir: /modules/backend version: 12.0.0 actuationTool: flavor: Terraform diff --git a/modules/lb-http-backend/outputs.tf b/modules/backend/outputs.tf similarity index 100% rename from modules/lb-http-backend/outputs.tf rename to modules/backend/outputs.tf diff --git a/modules/lb-http-backend/variables.tf b/modules/backend/variables.tf similarity index 99% rename from modules/lb-http-backend/variables.tf rename to modules/backend/variables.tf index f0fe028c..a4fcf028 100644 --- a/modules/lb-http-backend/variables.tf +++ b/modules/backend/variables.tf @@ -1,5 +1,5 @@ /** - * Copyright 2022 Google LLC + * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/modules/lb-http-backend/versions.tf b/modules/backend/versions.tf similarity index 93% rename from modules/lb-http-backend/versions.tf rename to modules/backend/versions.tf index 7c0b86c1..b383dc89 100644 --- a/modules/lb-http-backend/versions.tf +++ b/modules/backend/versions.tf @@ -1,5 +1,5 @@ /** - * Copyright 2022 Google LLC + * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,11 +33,11 @@ terraform { } provider_meta "google" { - module_name = "blueprints/terraform/terraform-google-lb-http:lb-http-backend/v12.0.0" + module_name = "blueprints/terraform/terraform-google-lb-http:backend/v12.0.0" } provider_meta "google-beta" { - module_name = "blueprints/terraform/terraform-google-lb-http:lb-http-backend/v12.0.0" + module_name = "blueprints/terraform/terraform-google-lb-http:backend/v12.0.0" } } diff --git a/modules/lb-http-frontend/README.md b/modules/frontend/README.md similarity index 95% rename from modules/lb-http-frontend/README.md rename to modules/frontend/README.md index d95c281f..2b8c5545 100644 --- a/modules/lb-http-frontend/README.md +++ b/modules/frontend/README.md @@ -1,5 +1,5 @@ # HTTP Load balancer frontend module -This module creates `HTTP(S) forwarding rule` and its dependencies. This modules doesn't create `google_compute_backend_service` which can be created by using `modules/lb-http-frontend`. The separation of the modules makes it easier for creating backend and frontend resources independent of each other. The logical separation helps in improved maintainability. +This module creates `HTTP(S) forwarding rule` and its dependencies. This modules doesn't create `google_compute_backend_service` which can be created by using `modules/frontend`. The separation of the modules makes it easier for creating backend and frontend resources independent of each other. The logical separation helps in improved maintainability. ## Inputs diff --git a/modules/lb-http-frontend/main.tf b/modules/frontend/main.tf similarity index 99% rename from modules/lb-http-frontend/main.tf rename to modules/frontend/main.tf index 2e3742fe..f17d1966 100644 --- a/modules/lb-http-frontend/main.tf +++ b/modules/frontend/main.tf @@ -1,5 +1,5 @@ /** - * Copyright 2022 Google LLC + * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/modules/lb-http-frontend/metadata.display.yaml b/modules/frontend/metadata.display.yaml similarity index 92% rename from modules/lb-http-frontend/metadata.display.yaml rename to modules/frontend/metadata.display.yaml index ee186c56..d77dc7f1 100644 --- a/modules/lb-http-frontend/metadata.display.yaml +++ b/modules/frontend/metadata.display.yaml @@ -15,7 +15,7 @@ apiVersion: blueprints.cloud.google.com/v1alpha1 kind: BlueprintMetadata metadata: - name: terraform-google-lb-http-lb-http-frontend-display + name: terraform-google-lb-http-frontend-display annotations: config.kubernetes.io/local-config: "true" spec: @@ -24,7 +24,7 @@ spec: source: repo: https://github.com/terraform-google-modules/terraform-google-lb-http.git sourceType: git - dir: /modules/lb-http-frontend + dir: /modules/frontend ui: input: variables: @@ -49,9 +49,6 @@ spec: create_url_map: name: create_url_map title: Create Url Map - edge_security_policy: - name: edge_security_policy - title: Edge Security Policy enable_ipv6: name: enable_ipv6 title: Enable Ipv6 @@ -100,9 +97,6 @@ spec: random_certificate_suffix: name: random_certificate_suffix title: Random Certificate Suffix - security_policy: - name: security_policy - title: Security Policy server_tls_policy: name: server_tls_policy title: Server Tls Policy diff --git a/modules/lb-http-frontend/metadata.yaml b/modules/frontend/metadata.yaml similarity index 95% rename from modules/lb-http-frontend/metadata.yaml rename to modules/frontend/metadata.yaml index c419d15a..6b4b06fc 100644 --- a/modules/lb-http-frontend/metadata.yaml +++ b/modules/frontend/metadata.yaml @@ -15,7 +15,7 @@ apiVersion: blueprints.cloud.google.com/v1alpha1 kind: BlueprintMetadata metadata: - name: terraform-google-lb-http-lb-http-frontend + name: terraform-google-lb-http-frontend annotations: config.kubernetes.io/local-config: "true" spec: @@ -24,7 +24,7 @@ spec: source: repo: https://github.com/terraform-google-modules/terraform-google-lb-http.git sourceType: git - dir: /modules/lb-http-frontend + dir: /modules/frontend version: 12.0.0 actuationTool: flavor: Terraform @@ -109,7 +109,7 @@ spec: defaultValue: [] connections: source: - source: github.com/GoogleCloudPlatform/terraform-google-lb-http//modules/lb-http-backend + source: github.com/GoogleCloudPlatform/terraform-google-lb-http//modules/backend version: ">= 12.0" spec: outputExpr: backend_service_info @@ -151,12 +151,6 @@ spec: - name: quic description: Specifies the QUIC override policy for this resource. Set true to enable HTTP/3 and Google QUIC support, false to disable both. Defaults to null which enables support for HTTP/3 only. varType: bool - - name: edge_security_policy - description: The resource URL for the edge security policy to associate with the backend service - varType: string - - name: security_policy - description: The resource URL for the security policy to associate with the backend service - varType: string - name: https_redirect description: Set to `true` to enable https redirect on the lb. varType: bool diff --git a/modules/lb-http-frontend/outputs.tf b/modules/frontend/outputs.tf similarity index 98% rename from modules/lb-http-frontend/outputs.tf rename to modules/frontend/outputs.tf index d927a80f..df3dd025 100644 --- a/modules/lb-http-frontend/outputs.tf +++ b/modules/frontend/outputs.tf @@ -1,5 +1,5 @@ /** - * Copyright 2022 Google LLC + * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/modules/lb-http-frontend/variables.tf b/modules/frontend/variables.tf similarity index 99% rename from modules/lb-http-frontend/variables.tf rename to modules/frontend/variables.tf index 4026f1ff..48c71990 100644 --- a/modules/lb-http-frontend/variables.tf +++ b/modules/frontend/variables.tf @@ -1,5 +1,5 @@ /** - * Copyright 2022 Google LLC + * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/modules/lb-http-frontend/versions.tf b/modules/frontend/versions.tf similarity index 92% rename from modules/lb-http-frontend/versions.tf rename to modules/frontend/versions.tf index 0768ccd6..0eeced4e 100644 --- a/modules/lb-http-frontend/versions.tf +++ b/modules/frontend/versions.tf @@ -1,5 +1,5 @@ /** - * Copyright 2022 Google LLC + * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,11 +33,11 @@ terraform { } provider_meta "google" { - module_name = "blueprints/terraform/terraform-google-lb-http:lb-http-frontend/v12.0.0" + module_name = "blueprints/terraform/terraform-google-lb-http:frontend/v12.0.0" } provider_meta "google-beta" { - module_name = "blueprints/terraform/terraform-google-lb-http:lb-http-frontend/v12.0.0" + module_name = "blueprints/terraform/terraform-google-lb-http:frontend/v12.0.0" } }