Factories refactor (#1843)
* factories refactor doc * Adds file schema and filesystem organization * Update 20231106-factories.md * move factories out of blueprints and create new factories README * align factory in billing-account module * align factory in dataplex-datascan module * align factory in billing-account module * align factory in net-firewall-policy module * align factory in dns-response-policy module * align factory in net-vpc-firewall module * align factory in net-vpc module * align factory variable names in FAST * remove decentralized firewall blueprint * bump terraform version * bump module versions * update top-level READMEs * move project factory to modules * fix variable names and tests * tfdoc * remove changelog link * add project factory to top-level README * fix cludrun eventarc diff * fix README * fix cludrun eventarc diff --------- Co-authored-by: Simone Ruffilli <sruffilli@google.com>
This commit is contained in:
committed by
GitHub
parent
8e86f0e108
commit
6941313c7d
48
modules/__experimental_deprecated/net-neg/README.md
Normal file
48
modules/__experimental_deprecated/net-neg/README.md
Normal file
@@ -0,0 +1,48 @@
|
||||
# Network Endpoint Group Module
|
||||
|
||||
This modules allows creating zonal network endpoint groups.
|
||||
|
||||
Note: this module will integrated into a general-purpose load balancing module in the future.
|
||||
|
||||
## Example
|
||||
```hcl
|
||||
module "neg" {
|
||||
source = "./fabric/modules/__experimental/net-neg/"
|
||||
project_id = "myproject"
|
||||
name = "myneg"
|
||||
network = var.vpc.self_link
|
||||
subnetwork = var.subnet.self_link
|
||||
zone = "europe-west1-b"
|
||||
endpoints = [
|
||||
for instance in module.vm.instances :
|
||||
{
|
||||
instance = instance.name
|
||||
port = 80
|
||||
ip_address = instance.network_interface[0].network_ip
|
||||
}
|
||||
]
|
||||
}
|
||||
# tftest skip
|
||||
```
|
||||
<!-- BEGIN TFDOC -->
|
||||
|
||||
## Variables
|
||||
|
||||
| name | description | type | required | default |
|
||||
|---|---|:---:|:---:|:---:|
|
||||
| [endpoints](variables.tf#L17) | List of (instance, port, address) of the NEG. | <code title="list(object({ instance = string port = number ip_address = string }))">list(object({…}))</code> | ✓ | |
|
||||
| [name](variables.tf#L26) | NEG name. | <code>string</code> | ✓ | |
|
||||
| [network](variables.tf#L31) | Name or self link of the VPC used for the NEG. Use the self link for Shared VPC. | <code>string</code> | ✓ | |
|
||||
| [project_id](variables.tf#L36) | NEG project id. | <code>string</code> | ✓ | |
|
||||
| [subnetwork](variables.tf#L41) | VPC subnetwork name or self link. | <code>string</code> | ✓ | |
|
||||
| [zone](variables.tf#L46) | NEG zone. | <code>string</code> | ✓ | |
|
||||
|
||||
## Outputs
|
||||
|
||||
| name | description | sensitive |
|
||||
|---|---|:---:|
|
||||
| [id](outputs.tf#L17) | Network endpoint group ID. | |
|
||||
| [self_lnk](outputs.tf#L22) | Network endpoint group self link. | |
|
||||
| [size](outputs.tf#L27) | Size of the network endpoint group. | |
|
||||
|
||||
<!-- END TFDOC -->
|
||||
33
modules/__experimental_deprecated/net-neg/main.tf
Normal file
33
modules/__experimental_deprecated/net-neg/main.tf
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Copyright 2022 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.
|
||||
*/
|
||||
|
||||
resource "google_compute_network_endpoint_group" "group" {
|
||||
project = var.project_id
|
||||
name = var.name
|
||||
network = var.network
|
||||
subnetwork = var.subnetwork
|
||||
zone = var.zone
|
||||
}
|
||||
|
||||
resource "google_compute_network_endpoint" "endpoint" {
|
||||
for_each = { for endpoint in var.endpoints : endpoint.instance => endpoint }
|
||||
project = var.project_id
|
||||
network_endpoint_group = google_compute_network_endpoint_group.group.name
|
||||
instance = each.value.instance
|
||||
port = each.value.port
|
||||
ip_address = each.value.ip_address
|
||||
zone = var.zone
|
||||
}
|
||||
30
modules/__experimental_deprecated/net-neg/outputs.tf
Normal file
30
modules/__experimental_deprecated/net-neg/outputs.tf
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Copyright 2022 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.
|
||||
*/
|
||||
|
||||
output "id" {
|
||||
description = "Network endpoint group ID."
|
||||
value = google_compute_network_endpoint_group.group.name
|
||||
}
|
||||
|
||||
output "self_lnk" {
|
||||
description = "Network endpoint group self link."
|
||||
value = google_compute_network_endpoint_group.group.self_link
|
||||
}
|
||||
|
||||
output "size" {
|
||||
description = "Size of the network endpoint group."
|
||||
value = google_compute_network_endpoint_group.group.size
|
||||
}
|
||||
49
modules/__experimental_deprecated/net-neg/variables.tf
Normal file
49
modules/__experimental_deprecated/net-neg/variables.tf
Normal file
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* Copyright 2022 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.
|
||||
*/
|
||||
|
||||
variable "endpoints" {
|
||||
description = "List of (instance, port, address) of the NEG."
|
||||
type = list(object({
|
||||
instance = string
|
||||
port = number
|
||||
ip_address = string
|
||||
}))
|
||||
}
|
||||
|
||||
variable "name" {
|
||||
description = "NEG name."
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "network" {
|
||||
description = "Name or self link of the VPC used for the NEG. Use the self link for Shared VPC."
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "project_id" {
|
||||
description = "NEG project id."
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "subnetwork" {
|
||||
description = "VPC subnetwork name or self link."
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "zone" {
|
||||
description = "NEG zone."
|
||||
type = string
|
||||
}
|
||||
27
modules/__experimental_deprecated/net-neg/versions.tf
Normal file
27
modules/__experimental_deprecated/net-neg/versions.tf
Normal file
@@ -0,0 +1,27 @@
|
||||
# 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.
|
||||
# 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.
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.7.4"
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
version = ">= 5.12.0, < 6.0.0" # tftest
|
||||
}
|
||||
google-beta = {
|
||||
source = "hashicorp/google-beta"
|
||||
version = ">= 5.12.0, < 6.0.0" # tftest
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user