Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable googleapi routes creation when vpc is not created in net-vpc module #1489

Merged
merged 1 commit into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/net-vpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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> |
Expand Down
5 changes: 4 additions & 1 deletion modules/net-vpc/routes.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion modules/net-vpc/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down