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

feat: additional load balancer config #536

Merged
merged 19 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
44812f0
feat: additional load balancer config
rajatagarwal-ibm Sep 19, 2023
6ceaad6
Merge branch 'main' into configurable-lb
rajatagarwal-ibm Sep 19, 2023
ce59df4
feat: additional load balancer config
rajatagarwal-ibm Sep 19, 2023
7119061
feat: additional load balancer config
rajatagarwal-ibm Sep 19, 2023
caf1024
Merge branch 'configurable-lb' of github.com:terraform-ibm-modules/te…
rajatagarwal-ibm Sep 19, 2023
de77958
feat: additional load balancer config
rajatagarwal-ibm Sep 19, 2023
213234e
feat: additional load balancer config
rajatagarwal-ibm Sep 20, 2023
eb7f165
Merge branch 'main' into configurable-lb
rajatagarwal-ibm Sep 20, 2023
92f5dfb
feat: additional load balancer config
rajatagarwal-ibm Sep 25, 2023
a2de13c
feat: additional load balancer config
rajatagarwal-ibm Sep 25, 2023
88a2dd1
Merge branch 'main' into configurable-lb
rajatagarwal-ibm Sep 25, 2023
bb505e1
feat: additional load balancer config
rajatagarwal-ibm Sep 25, 2023
a8fc2c1
Merge branch 'configurable-lb' of github.com:terraform-ibm-modules/te…
rajatagarwal-ibm Sep 25, 2023
645a242
feat: additional load balancer config
rajatagarwal-ibm Sep 25, 2023
aa77bb3
feat: additional load balancer config
rajatagarwal-ibm Sep 25, 2023
b818d04
feat: additional load balancer config
rajatagarwal-ibm Sep 25, 2023
4536a2e
feat: additional load balancer config
rajatagarwal-ibm Sep 26, 2023
95c2bbb
feat: additional load balancer config
rajatagarwal-ibm Sep 26, 2023
0b5fa55
Merge branch 'main' into configurable-lb
rajatagarwal-ibm Sep 27, 2023
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ No modules.
| <a name="input_existing_kms_instance_guid"></a> [existing\_kms\_instance\_guid](#input\_existing\_kms\_instance\_guid) | The GUID of the Hyper Protect Crypto Services instance in which the key specified in var.boot\_volume\_encryption\_key is coming from. | `string` | `null` | no |
| <a name="input_image_id"></a> [image\_id](#input\_image\_id) | Image ID used for VSI. Run 'ibmcloud is images' to find available images in a region | `string` | n/a | yes |
| <a name="input_kms_encryption_enabled"></a> [kms\_encryption\_enabled](#input\_kms\_encryption\_enabled) | Set this to true to control the encryption keys used to encrypt the data that for the block storage volumes for VPC. If set to false, the data is encrypted by using randomly generated keys. For more info on encrypting block storage volumes, see https://cloud.ibm.com/docs/vpc?topic=vpc-creating-instances-byok | `bool` | `false` | no |
| <a name="input_load_balancers"></a> [load\_balancers](#input\_load\_balancers) | Load balancers to add to VSI | <pre>list(<br> object({<br> name = string<br> type = string<br> listener_port = number<br> listener_protocol = string<br> connection_limit = number<br> algorithm = string<br> protocol = string<br> health_delay = number<br> health_retries = number<br> health_timeout = number<br> health_type = string<br> pool_member_port = string<br> security_group = optional(<br> object({<br> name = string<br> rules = list(<br> object({<br> name = string<br> direction = string<br> source = string<br> tcp = optional(<br> object({<br> port_max = number<br> port_min = number<br> })<br> )<br> udp = optional(<br> object({<br> port_max = number<br> port_min = number<br> })<br> )<br> icmp = optional(<br> object({<br> type = number<br> code = number<br> })<br> )<br> })<br> )<br> })<br> )<br> })<br> )</pre> | `[]` | no |
| <a name="input_load_balancers"></a> [load\_balancers](#input\_load\_balancers) | Load balancers to add to VSI | <pre>list(<br> object({<br> name = string<br> type = string<br> listener_port = number<br> listener_protocol = string<br> connection_limit = number<br> algorithm = string<br> protocol = string<br> health_delay = number<br> health_retries = number<br> health_timeout = number<br> health_type = string<br> pool_member_port = string<br> profile = optional(string)<br> dns = optional(<br> object({<br> instance_crn = string<br> zone_id = string<br> })<br> )<br> security_group = optional(<br> object({<br> name = string<br> rules = list(<br> object({<br> name = string<br> direction = string<br> source = string<br> tcp = optional(<br> object({<br> port_max = number<br> port_min = number<br> })<br> )<br> udp = optional(<br> object({<br> port_max = number<br> port_min = number<br> })<br> )<br> icmp = optional(<br> object({<br> type = number<br> code = number<br> })<br> )<br> })<br> )<br> })<br> )<br> })<br> )</pre> | `[]` | no |
| <a name="input_machine_type"></a> [machine\_type](#input\_machine\_type) | VSI machine type. Run 'ibmcloud is instance-profiles' to get a list of regional profiles | `string` | n/a | yes |
| <a name="input_prefix"></a> [prefix](#input\_prefix) | The IBM Cloud platform API key needed to deploy IAM enabled resources | `string` | n/a | yes |
| <a name="input_resource_group_id"></a> [resource\_group\_id](#input\_resource\_group\_id) | ID of resource group to create VSI and block storage volumes. If you wish to create the block storage volumes in a different resource group, you can optionally set that directly in the 'block\_storage\_volumes' variable. | `string` | n/a | yes |
Expand Down
1 change: 1 addition & 0 deletions load_balancer.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ resource "ibm_is_lb" "lb" {
name = "${var.prefix}-${each.value.name}-lb"
subnets = var.subnets[*].id
type = each.value.type
profile = each.value.profile
security_groups = each.value.security_group == null ? null : [ibm_is_security_group.security_group[each.value.security_group.name].id]
resource_group = var.resource_group_id
tags = var.tags
Expand Down
18 changes: 9 additions & 9 deletions module-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
},
"load_balancers": {
"name": "load_balancers",
"type": "list(\n object({\n name = string\n type = string\n listener_port = number\n listener_protocol = string\n connection_limit = number\n algorithm = string\n protocol = string\n health_delay = number\n health_retries = number\n health_timeout = number\n health_type = string\n pool_member_port = string\n security_group = optional(\n object({\n name = string\n rules = list(\n object({\n name = string\n direction = string\n source = string\n tcp = optional(\n object({\n port_max = number\n port_min = number\n })\n )\n udp = optional(\n object({\n port_max = number\n port_min = number\n })\n )\n icmp = optional(\n object({\n type = number\n code = number\n })\n )\n })\n )\n })\n )\n })\n )",
"type": "list(\n object({\n name = string\n type = string\n listener_port = number\n listener_protocol = string\n connection_limit = number\n algorithm = string\n protocol = string\n health_delay = number\n health_retries = number\n health_timeout = number\n health_type = string\n pool_member_port = string\n profile = optional(string)\n dns = optional(\n object({\n instance_crn = string\n zone_id = string\n })\n )\n security_group = optional(\n object({\n name = string\n rules = list(\n object({\n name = string\n direction = string\n source = string\n tcp = optional(\n object({\n port_max = number\n port_min = number\n })\n )\n udp = optional(\n object({\n port_max = number\n port_min = number\n })\n )\n icmp = optional(\n object({\n type = number\n code = number\n })\n )\n })\n )\n })\n )\n })\n )",
"description": "Load balancers to add to VSI",
"default": [],
"pos": {
Expand Down Expand Up @@ -186,7 +186,7 @@
"default": false,
"pos": {
"filename": "variables.tf",
"line": 392
"line": 409
}
},
"secondary_floating_ips": {
Expand All @@ -199,7 +199,7 @@
],
"pos": {
"filename": "variables.tf",
"line": 381
"line": 398
}
},
"secondary_security_groups": {
Expand All @@ -209,7 +209,7 @@
"default": [],
"pos": {
"filename": "variables.tf",
"line": 360
"line": 377
}
},
"secondary_subnets": {
Expand All @@ -219,7 +219,7 @@
"default": [],
"pos": {
"filename": "variables.tf",
"line": 341
"line": 358
}
},
"secondary_use_vsi_security_group": {
Expand All @@ -229,7 +229,7 @@
"default": false,
"pos": {
"filename": "variables.tf",
"line": 354
"line": 371
}
},
"security_group": {
Expand Down Expand Up @@ -527,7 +527,7 @@
},
"pos": {
"filename": "load_balancer.tf",
"line": 81
"line": 82
}
},
"ibm_is_lb_pool.pool": {
Expand All @@ -542,7 +542,7 @@
},
"pos": {
"filename": "load_balancer.tf",
"line": 30
"line": 31
}
},
"ibm_is_lb_pool_member.pool_members": {
Expand All @@ -554,7 +554,7 @@
},
"pos": {
"filename": "load_balancer.tf",
"line": 65
"line": 66
}
},
"ibm_is_security_group.security_group": {
Expand Down
2 changes: 1 addition & 1 deletion profiles/fscloud/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ No resources.
| <a name="input_enable_floating_ip"></a> [enable\_floating\_ip](#input\_enable\_floating\_ip) | Create a floating IP for each virtual server created | `bool` | `false` | no |
| <a name="input_existing_kms_instance_guid"></a> [existing\_kms\_instance\_guid](#input\_existing\_kms\_instance\_guid) | The GUID of the Hyper Protect Crypto Services or Key Protect instance in which the key specified in var.kms\_key\_crn and var.backup\_encryption\_key\_crn is coming from. Required only if var.skip\_iam\_authorization\_policy is set to false. | `string` | `null` | no |
| <a name="input_image_id"></a> [image\_id](#input\_image\_id) | Image ID used for VSI. Run 'ibmcloud is images' to find available images in a region | `string` | n/a | yes |
| <a name="input_load_balancers"></a> [load\_balancers](#input\_load\_balancers) | Load balancers to add to VSI | <pre>list(<br> object({<br> name = string<br> type = string<br> listener_port = number<br> listener_protocol = string<br> connection_limit = number<br> algorithm = string<br> protocol = string<br> health_delay = number<br> health_retries = number<br> health_timeout = number<br> health_type = string<br> pool_member_port = string<br> security_group = optional(<br> object({<br> name = string<br> rules = list(<br> object({<br> name = string<br> direction = string<br> source = string<br> tcp = optional(<br> object({<br> port_max = number<br> port_min = number<br> })<br> )<br> udp = optional(<br> object({<br> port_max = number<br> port_min = number<br> })<br> )<br> icmp = optional(<br> object({<br> type = number<br> code = number<br> })<br> )<br> })<br> )<br> })<br> )<br> })<br> )</pre> | `[]` | no |
| <a name="input_load_balancers"></a> [load\_balancers](#input\_load\_balancers) | Load balancers to add to VSI | <pre>list(<br> object({<br> name = string<br> type = string<br> listener_port = number<br> listener_protocol = string<br> connection_limit = number<br> algorithm = string<br> protocol = string<br> health_delay = number<br> health_retries = number<br> health_timeout = number<br> health_type = string<br> pool_member_port = string<br> profile = optional(string)<br> dns = optional(<br> object({<br> instance_crn = string<br> zone_id = string<br> })<br> )<br> security_group = optional(<br> object({<br> name = string<br> rules = list(<br> object({<br> name = string<br> direction = string<br> source = string<br> tcp = optional(<br> object({<br> port_max = number<br> port_min = number<br> })<br> )<br> udp = optional(<br> object({<br> port_max = number<br> port_min = number<br> })<br> )<br> icmp = optional(<br> object({<br> type = number<br> code = number<br> })<br> )<br> })<br> )<br> })<br> )<br> })<br> )</pre> | `[]` | no |
| <a name="input_machine_type"></a> [machine\_type](#input\_machine\_type) | VSI machine type. Run 'ibmcloud is instance-profiles' to get a list of regional profiles | `string` | n/a | yes |
| <a name="input_prefix"></a> [prefix](#input\_prefix) | The prefix that you would like to append to your resources | `string` | n/a | yes |
| <a name="input_resource_group_id"></a> [resource\_group\_id](#input\_resource\_group\_id) | ID of resource group to create VSI and block storage volumes. If you wish to create the block storage volumes in a different resource group, you can optionally set that directly in the 'block\_storage\_volumes' variable. | `string` | n/a | yes |
Expand Down
17 changes: 17 additions & 0 deletions profiles/fscloud/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,13 @@ variable "load_balancers" {
health_timeout = number
health_type = string
pool_member_port = string
profile = optional(string)
dns = optional(
object({
instance_crn = string
zone_id = string
})
)
security_group = optional(
object({
name = string
Expand Down Expand Up @@ -252,6 +259,16 @@ variable "load_balancers" {
)) == 0
}

validation {
error_message = "For Network Load Balancer this attribute is required and should be set to `network-fixed`. For Application Load Balancer it is not required."
condition = length(
flatten([
for load_balancer in var.load_balancers :
true if !contains(["network-fixed", null], load_balancer.profile)
])
) == 0
}
rajatagarwal-ibm marked this conversation as resolved.
Show resolved Hide resolved

validation {
error_message = "Load Balancer Pool algorithm can only be `round_robin`, `weighted_round_robin`, or `least_connections`."
condition = length(
Expand Down
17 changes: 17 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,13 @@ variable "load_balancers" {
health_timeout = number
health_type = string
pool_member_port = string
profile = optional(string)
dns = optional(
object({
instance_crn = string
zone_id = string
})
)
security_group = optional(
object({
name = string
Expand Down Expand Up @@ -285,6 +292,16 @@ variable "load_balancers" {
)) == 0
}

validation {
error_message = "For Network Load Balancer this attribute is required and should be set to `network-fixed`. For Application Load Balancer it is not required."
rajatagarwal-ibm marked this conversation as resolved.
Show resolved Hide resolved
condition = length(
flatten([
for load_balancer in var.load_balancers :
true if !contains(["network-fixed", null], load_balancer.profile)
])
) == 0
}

validation {
error_message = "Load Balancer Pool algorithm can only be `round_robin`, `weighted_round_robin`, or `least_connections`."
condition = length(
Expand Down