disable googleapi routes creation when vpc is not created (#1489)

This commit is contained in:
Ludovico Magnocavallo 2023-07-03 09:10:12 +02:00 committed by GitHub
parent aeaf1f66fd
commit 86cc6eee4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 3 deletions

View File

@ -482,7 +482,7 @@ module "vpc" {
| [name](variables.tf#L83) | The name of the network being created. | <code>string</code> | ✓ | |
| [project_id](variables.tf#L99) | The ID of the project where this VPC will be created. | <code>string</code> | ✓ | |
| [auto_create_subnetworks](variables.tf#L17) | Set to true to create an auto mode subnet, defaults to custom mode. | <code>bool</code> | | <code>false</code> |
| [create_googleapis_routes](variables.tf#L23) | Toggle creation of googleapis private/restricted routes. Set to null to disable creation. | <code title="object&#40;&#123;&#10; private &#61; optional&#40;bool, true&#41;&#10; private-6 &#61; optional&#40;bool, false&#41;&#10; restricted &#61; optional&#40;bool, true&#41;&#10; restricted-6 &#61; optional&#40;bool, false&#41;&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>&#123;&#125;</code> |
| [create_googleapis_routes](variables.tf#L23) | Toggle creation of googleapis private/restricted routes. Disabled when vpc creation is turned off, or when set to null. | <code title="object&#40;&#123;&#10; private &#61; optional&#40;bool, true&#41;&#10; private-6 &#61; optional&#40;bool, false&#41;&#10; restricted &#61; optional&#40;bool, true&#41;&#10; restricted-6 &#61; optional&#40;bool, false&#41;&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>&#123;&#125;</code> |
| [data_folder](variables.tf#L34) | An optional folder containing the subnet configurations in YaML format. | <code>string</code> | | <code>null</code> |
| [delete_default_routes_on_create](variables.tf#L40) | Set to true to delete the default routes at creation time. | <code>bool</code> | | <code>false</code> |
| [description](variables.tf#L46) | An optional description of this resource (triggers recreation on change). | <code>string</code> | | <code>&#34;Terraform-managed.&#34;</code> |

View File

@ -31,7 +31,10 @@ locals {
priority = 1000
tags = null
}
if lookup(coalesce(var.create_googleapis_routes, {}), k, false)
if(
var.vpc_create &&
lookup(coalesce(var.create_googleapis_routes, {}), k, false)
)
}
_routes = merge(local._googleapis_routes, coalesce(var.routes, {}))
routes = {

View File

@ -21,7 +21,7 @@ variable "auto_create_subnetworks" {
}
variable "create_googleapis_routes" {
description = "Toggle creation of googleapis private/restricted routes. Set to null to disable creation."
description = "Toggle creation of googleapis private/restricted routes. Disabled when vpc creation is turned off, or when set to null."
type = object({
private = optional(bool, true)
private-6 = optional(bool, false)