created passing test, fixed logic

This commit is contained in:
Dave Gulli 2023-09-13 16:49:14 +10:00
parent 83221c16a5
commit 09e6e8f4d2
3 changed files with 29 additions and 6 deletions

View File

@ -355,7 +355,7 @@ module "vpc" {
name = "my-network"
data_folder = "config/subnets"
}
# tftest modules=1 resources=9 files=subnet-simple,subnet-simple-2,subnet-detailed,subnet-proxy,subnet-psc inventory=factory.yaml
# tftest modules=1 resources=10 files=subnet-simple,subnet-simple-2,subnet-detailed,subnet-proxy,subnet-proxy-global,subnet-psc inventory=factory.yaml
```
```yaml
@ -399,6 +399,13 @@ ip_cidr_range: 10.1.0.0/24
purpose: REGIONAL_MANAGED_PROXY
```
```yaml
# tftest-file id=subnet-proxy-global path=config/subnets/subnet-proxy-global.yaml
region: australia-southeast2
ip_cidr_range: 10.4.0.0/24
purpose: GLOBAL_MANAGED_PROXY
```
```yaml
# tftest-file id=subnet-psc path=config/subnets/subnet-psc.yaml
region: europe-west4

View File

@ -35,7 +35,7 @@ locals {
iam_members = try(v.iam_members, [])
purpose = try(v.purpose, null)
active = try(v.active, null)
global = try(v.purpose, null)
global = null
}
}
_factory_subnets_iam = [
@ -135,8 +135,13 @@ resource "google_compute_subnetwork" "proxy_only" {
? "Terraform-managed proxy-only subnet for Regional HTTPS, Internal HTTPS or Cross-Regional HTTPS Internal LB."
: each.value.description
)
purpose = each.value.global != false ? "GLOBAL_MANAGED_PROXY" : "REGIONAL_MANAGED_PROXY"
role = each.value.active != false ? "ACTIVE" : "BACKUP"
purpose = try(
each.value.purpose,
each.value.global != false
? "GLOBAL_MANAGED_PROXY"
: "REGIONAL_MANAGED_PROXY")
role = each.value.active != false ? "ACTIVE" : "BACKUP"
}
resource "google_compute_subnetwork" "psc" {

View File

@ -58,6 +58,17 @@ values:
region: europe-west4
role: ACTIVE
timeouts: null
module.vpc.google_compute_subnetwork.proxy_only["australia-southeast2/subnet-proxy-global"]:
description: Terraform-managed proxy-only subnet for Regional HTTPS, Internal HTTPS or Cross-Regional HTTPS Internal LB.
ip_cidr_range: 10.4.0.0/24
ipv6_access_type: null
log_config: []
name: subnet-proxy-global
project: my-project
purpose: GLOBAL_MANAGED_PROXY
region: australia-southeast2
role: ACTIVE
timeouts: null
module.vpc.google_compute_subnetwork.psc["europe-west4/subnet-psc"]:
description: Terraform-managed subnet for Private Service Connect (PSC NAT).
ip_cidr_range: 10.2.0.0/24
@ -126,9 +137,9 @@ values:
counts:
google_compute_network: 1
google_compute_route: 2
google_compute_subnetwork: 5
google_compute_subnetwork: 6
google_compute_subnetwork_iam_binding: 1
modules: 1
resources: 9
resources: 10
outputs: {}