Skip to content

Commit 0699a66

Browse files
fix: use_manual_address_prefixes input variable has been removed (#507)
BREAKING CHANGE Removed the input variable `use_manual_address_prefixes`. The value of this variable is now computed by the module based on the `address_prefixes` input variable. If `address_prefixes` variable is set, then the modules determine that manual address prefix are used. Note: in the event that `use_manual_address_prefix=false` (the default value) AND `address_prefixes` was specified, the VPC and everything deployed into it will be destroyed and it will be recreated when moving up to this version. To avoid this - BEFORE upgrading to this version of the module - set `use_manual_address_prefix` to true, and apply the change (`terraform apply`). You are now ready to upgrade to the new version without ending up in a VPC deletion.
1 parent a6aed91 commit 0699a66

File tree

14 files changed

+22
-64
lines changed

14 files changed

+22
-64
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ You need the following permissions to run this module.
7777
| Name | Version |
7878
|------|---------|
7979
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.0 |
80-
| <a name="requirement_ibm"></a> [ibm](#requirement\_ibm) | >= 1.49.0 |
80+
| <a name="requirement_ibm"></a> [ibm](#requirement\_ibm) | >= 1.52.0 |
8181

8282
## Modules
8383

@@ -127,7 +127,6 @@ You need the following permissions to run this module.
127127
| <a name="input_security_group_rules"></a> [security\_group\_rules](#input\_security\_group\_rules) | A list of security group rules to be added to the default vpc security group | <pre>list(<br> object({<br> name = string<br> direction = string<br> remote = string<br> tcp = optional(<br> object({<br> port_max = optional(number)<br> port_min = optional(number)<br> })<br> )<br> udp = optional(<br> object({<br> port_max = optional(number)<br> port_min = optional(number)<br> })<br> )<br> icmp = optional(<br> object({<br> type = optional(number)<br> code = optional(number)<br> })<br> )<br> })<br> )</pre> | <pre>[<br> {<br> "direction": "inbound",<br> "name": "default-sgr",<br> "remote": "10.0.0.0/8"<br> }<br>]</pre> | no |
128128
| <a name="input_subnets"></a> [subnets](#input\_subnets) | List of subnets for the vpc. For each item in each array, a subnet will be created. Items can be either CIDR blocks or total ipv4 addressess. Public gateways will be enabled only in zones where a gateway has been created | <pre>object({<br> zone-1 = list(object({<br> name = string<br> cidr = string<br> public_gateway = optional(bool)<br> acl_name = string<br> }))<br> zone-2 = list(object({<br> name = string<br> cidr = string<br> public_gateway = optional(bool)<br> acl_name = string<br> }))<br> zone-3 = list(object({<br> name = string<br> cidr = string<br> public_gateway = optional(bool)<br> acl_name = string<br> }))<br> })</pre> | <pre>{<br> "zone-1": [<br> {<br> "acl_name": "vpc-acl",<br> "cidr": "10.10.10.0/24",<br> "name": "subnet-a",<br> "public_gateway": true<br> }<br> ],<br> "zone-2": [<br> {<br> "acl_name": "vpc-acl",<br> "cidr": "10.20.10.0/24",<br> "name": "subnet-b",<br> "public_gateway": true<br> }<br> ],<br> "zone-3": [<br> {<br> "acl_name": "vpc-acl",<br> "cidr": "10.30.10.0/24",<br> "name": "subnet-c",<br> "public_gateway": false<br> }<br> ]<br>}</pre> | no |
129129
| <a name="input_tags"></a> [tags](#input\_tags) | List of Tags for the resource created | `list(string)` | `null` | no |
130-
| <a name="input_use_manual_address_prefixes"></a> [use\_manual\_address\_prefixes](#input\_use\_manual\_address\_prefixes) | OPTIONAL - Use manual address prefixes for VPC | `bool` | `false` | no |
131130
| <a name="input_use_public_gateways"></a> [use\_public\_gateways](#input\_use\_public\_gateways) | Create a public gateway in any of the three zones with `true`. | <pre>object({<br> zone-1 = optional(bool)<br> zone-2 = optional(bool)<br> zone-3 = optional(bool)<br> })</pre> | <pre>{<br> "zone-1": true,<br> "zone-2": false,<br> "zone-3": false<br>}</pre> | no |
132131

133132
## Outputs

examples/default/version.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
# Pin to the lowest provider version of the range defined in the main module's version.tf to ensure lowest version still works
55
ibm = {
66
source = "IBM-Cloud/ibm"
7-
version = "1.49.0"
7+
version = "1.52.0"
88
}
99
}
1010
}

examples/landing_zone/version.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
# Pin to the lowest provider version of the range defined in the main module's version.tf to ensure lowest version still works
55
ibm = {
66
source = "IBM-Cloud/ibm"
7-
version = "1.51.0"
7+
version = "1.52.0"
88
}
99
}
1010
}

landing-zone-submodule/management-vpc/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ No resources.
4444
| <a name="input_resource_group_id"></a> [resource\_group\_id](#input\_resource\_group\_id) | The resource group ID where the VPC to be created | `string` | n/a | yes |
4545
| <a name="input_subnets"></a> [subnets](#input\_subnets) | Object for subnets to be created in each zone, each zone can have any number of subnets | <pre>object({<br> zone-1 = list(object({<br> name = string<br> cidr = string<br> public_gateway = optional(bool)<br> acl_name = string<br> }))<br> zone-2 = list(object({<br> name = string<br> cidr = string<br> public_gateway = optional(bool)<br> acl_name = string<br> }))<br> zone-3 = list(object({<br> name = string<br> cidr = string<br> public_gateway = optional(bool)<br> acl_name = string<br> }))<br> })</pre> | <pre>{<br> "zone-1": [<br> {<br> "acl_name": "management-acl",<br> "cidr": "10.10.10.0/24",<br> "name": "vsi-zone-1",<br> "public_gateway": false<br> },<br> {<br> "acl_name": "management-acl",<br> "cidr": "10.10.20.0/24",<br> "name": "vpe-zone-1",<br> "public_gateway": false<br> },<br> {<br> "acl_name": "management-acl",<br> "cidr": "10.10.30.0/24",<br> "name": "vpn-zone-1",<br> "public_gateway": false<br> }<br> ],<br> "zone-2": [<br> {<br> "acl_name": "management-acl",<br> "cidr": "10.20.10.0/24",<br> "name": "vsi-zone-2",<br> "public_gateway": false<br> },<br> {<br> "acl_name": "management-acl",<br> "cidr": "10.20.20.0/24",<br> "name": "vpe-zone-2",<br> "public_gateway": false<br> }<br> ],<br> "zone-3": [<br> {<br> "acl_name": "management-acl",<br> "cidr": "10.30.10.0/24",<br> "name": "vsi-zone-3",<br> "public_gateway": false<br> },<br> {<br> "acl_name": "management-acl",<br> "cidr": "10.30.20.0/24",<br> "name": "vpe-zone-3",<br> "public_gateway": false<br> }<br> ]<br>}</pre> | no |
4646
| <a name="input_tags"></a> [tags](#input\_tags) | List of tags to apply to resources created by this module. | `list(string)` | `[]` | no |
47-
| <a name="input_use_manual_address_prefixes"></a> [use\_manual\_address\_prefixes](#input\_use\_manual\_address\_prefixes) | Optionally assign prefixes to VPC manually. By default this is false, and prefixes will be created along with subnets | `bool` | `true` | no |
4847
| <a name="input_use_public_gateways"></a> [use\_public\_gateways](#input\_use\_public\_gateways) | For each `zone` that is set to `true`, a public gateway will be created in that zone | <pre>object({<br> zone-1 = optional(bool)<br> zone-2 = optional(bool)<br> zone-3 = optional(bool)<br> })</pre> | <pre>{<br> "zone-1": false,<br> "zone-2": false,<br> "zone-3": false<br>}</pre> | no |
4948

5049
## Outputs

landing-zone-submodule/management-vpc/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ module "management_vpc" {
1111
prefix = var.prefix
1212
network_cidr = var.network_cidr
1313
classic_access = var.classic_access
14-
use_manual_address_prefixes = var.use_manual_address_prefixes
1514
default_network_acl_name = var.default_network_acl_name
1615
default_security_group_name = var.default_security_group_name
1716
security_group_rules = var.default_security_group_rules == null ? [] : var.default_security_group_rules

landing-zone-submodule/management-vpc/variables.tf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@ variable "classic_access" {
3838
default = null
3939
}
4040

41-
variable "use_manual_address_prefixes" {
42-
description = "Optionally assign prefixes to VPC manually. By default this is false, and prefixes will be created along with subnets"
43-
type = bool
44-
default = true
45-
}
46-
4741
variable "default_network_acl_name" {
4842
description = "Override default ACL name"
4943
type = string

landing-zone-submodule/workload-vpc/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ No resources.
4545
| <a name="input_resource_group_id"></a> [resource\_group\_id](#input\_resource\_group\_id) | The resource group ID where the VPC to be created | `string` | n/a | yes |
4646
| <a name="input_subnets"></a> [subnets](#input\_subnets) | Object for subnets to be created in each zone, each zone can have any number of subnets | <pre>object({<br> zone-1 = list(object({<br> name = string<br> cidr = string<br> public_gateway = optional(bool)<br> acl_name = string<br> }))<br> zone-2 = list(object({<br> name = string<br> cidr = string<br> public_gateway = optional(bool)<br> acl_name = string<br> }))<br> zone-3 = list(object({<br> name = string<br> cidr = string<br> public_gateway = optional(bool)<br> acl_name = string<br> }))<br> })</pre> | <pre>{<br> "zone-1": [<br> {<br> "acl_name": "workload-acl",<br> "cidr": "10.40.10.0/24",<br> "name": "vsi-zone-1",<br> "public_gateway": false<br> },<br> {<br> "acl_name": "workload-acl",<br> "cidr": "10.40.20.0/24",<br> "name": "vpe-zone-1",<br> "public_gateway": false<br> }<br> ],<br> "zone-2": [<br> {<br> "acl_name": "workload-acl",<br> "cidr": "10.50.10.0/24",<br> "name": "vsi-zone-2",<br> "public_gateway": false<br> },<br> {<br> "acl_name": "workload-acl",<br> "cidr": "10.50.20.0/24",<br> "name": "vpe-zone-2",<br> "public_gateway": false<br> }<br> ],<br> "zone-3": [<br> {<br> "acl_name": "workload-acl",<br> "cidr": "10.60.10.0/24",<br> "name": "vsi-zone-3",<br> "public_gateway": false<br> },<br> {<br> "acl_name": "workload-acl",<br> "cidr": "10.60.20.0/24",<br> "name": "vpe-zone-3",<br> "public_gateway": false<br> }<br> ]<br>}</pre> | no |
4747
| <a name="input_tags"></a> [tags](#input\_tags) | List of tags to apply to resources created by this module. | `list(string)` | `[]` | no |
48-
| <a name="input_use_manual_address_prefixes"></a> [use\_manual\_address\_prefixes](#input\_use\_manual\_address\_prefixes) | Optionally assign prefixes to VPC manually. By default this is false, and prefixes will be created along with subnets | `bool` | `null` | no |
4948
| <a name="input_use_public_gateways"></a> [use\_public\_gateways](#input\_use\_public\_gateways) | For each `zone` that is set to `true`, a public gateway will be created in that zone | <pre>object({<br> zone-1 = optional(bool)<br> zone-2 = optional(bool)<br> zone-3 = optional(bool)<br> })</pre> | <pre>{<br> "zone-1": false,<br> "zone-2": false,<br> "zone-3": false<br>}</pre> | no |
5049

5150
## Outputs

landing-zone-submodule/workload-vpc/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ module "workload_vpc" {
1111
prefix = var.prefix
1212
network_cidr = var.network_cidr
1313
classic_access = var.classic_access
14-
use_manual_address_prefixes = var.use_manual_address_prefixes
1514
default_network_acl_name = var.default_network_acl_name
1615
default_security_group_name = var.default_security_group_name
1716
security_group_rules = var.default_security_group_rules == null ? [] : var.default_security_group_rules

landing-zone-submodule/workload-vpc/variables.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ variable "classic_access" {
3737
default = null
3838
}
3939

40-
variable "use_manual_address_prefixes" {
41-
description = "Optionally assign prefixes to VPC manually. By default this is false, and prefixes will be created along with subnets"
42-
type = bool
43-
default = null
44-
}
4540

4641
variable "default_network_acl_name" {
4742
description = "Override default ACL name"

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ resource "ibm_is_vpc" "vpc" {
66
name = var.prefix != null ? "${var.prefix}-${var.name}-vpc" : "${var.name}-vpc"
77
resource_group = var.resource_group_id
88
classic_access = var.classic_access
9-
address_prefix_management = var.use_manual_address_prefixes == false ? null : "manual"
9+
address_prefix_management = length([for prefix in values(coalesce(var.address_prefixes, {})) : prefix if prefix != null]) != 0 ? "manual" : null
1010
default_network_acl_name = var.default_network_acl_name
1111
default_security_group_name = var.default_security_group_name
1212
default_routing_table_name = var.default_routing_table_name

0 commit comments

Comments
 (0)