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

fix: address prefix auto generated when subnets passed #679

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ locals {
##############################################################################

resource "ibm_is_vpc" "vpc" {
count = var.create_vpc == true ? 1 : 0
name = var.prefix != null ? "${var.prefix}-${var.name}-vpc" : "${var.name}-vpc"
resource_group = var.resource_group_id
classic_access = var.classic_access
address_prefix_management = length([for prefix in values(coalesce(var.address_prefixes, {})) : prefix if prefix != null]) != 0 ? "manual" : null
count = var.create_vpc == true ? 1 : 0
name = var.prefix != null ? "${var.prefix}-${var.name}-vpc" : "${var.name}-vpc"
resource_group = var.resource_group_id
classic_access = var.classic_access
# address prefix is set to auto only if no address prefixes NOR any subnet is passed as input
address_prefix_management = (length([for prefix in values(coalesce(var.address_prefixes, {})) : prefix if prefix != null]) != 0) || (length([for subnet in values(coalesce(var.subnets, {})) : subnet if subnet != null]) != 0) ? "manual" : null
default_network_acl_name = var.default_network_acl_name
default_security_group_name = var.default_security_group_name
default_routing_table_name = var.default_routing_table_name
Expand Down