generated from terraform-ibm-modules/terraform-ibm-module-template
-
Notifications
You must be signed in to change notification settings - Fork 11
feat: replace ALB with NLB #1131
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
Merged
Merged
Changes from 14 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
a9798fe
feat: BREAKING CHANGE replace alb with nlb
ludwig-mueller fefbbea
chore: remove fileshare-alb module
ludwig-mueller ee6382b
refactor: move fileshare nlb from module into one file and make it sh…
ludwig-mueller eba1813
Merge branch 'main' into nfs_nlb
ludwig-mueller 20e52e1
Merge branch 'main' into nfs_nlb
ludwig-mueller 78140bc
fix: network services only depends on mount target
ludwig-mueller 1a5e1f3
feat: remove wait for testing
ludwig-mueller 4f44495
refactor: cleanup commented components left from last refactor
ludwig-mueller 7ffae19
feat: replace sleep wait with implicit dependencies to optimize deplo…
ludwig-mueller ccbd279
fix: null check for nfs and nlb variables
ludwig-mueller 792a7a8
Merge branch 'main' into nfs_nlb
ludwig-mueller 16c3eaa
docs: update architecture diagrams
ludwig-mueller 692c8c0
chore: remove alb related scc rules
ludwig-mueller 9bf058a
docs: update readmes
ludwig-mueller 08d929c
BREAKING CHANGE
ludwig-mueller 13c21e1
chore: cleanup
ludwig-mueller 954ef92
docs: lastupdated, version number
ludwig-mueller e241adc
chore: validate in us-south
ludwig-mueller b4eab07
refactor: local naming
ludwig-mueller 0d0cb3e
refactor: split main.tf into separate files for each functional unit
ludwig-mueller 98d0b39
feat: expose a way to create ocp-rg and use it for tgw, vpc, and powe…
ludwig-mueller 1eec6b9
Merge branch 'temp' into nfs_nlb
ludwig-mueller a7bc9eb
BREAKING CHANGE
ludwig-mueller File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| ##################################################### | ||
| # File share for NFS and Network Load Balancer | ||
| ##################################################### | ||
|
|
||
| locals { | ||
| vpc_zone = "${lookup(local.ibm_powervs_zone_cloud_region_map, var.powervs_zone, null)}-1" | ||
| resource_group_id = module.landing_zone.resource_group_data["${var.prefix}-${local.second_rg_name}"] | ||
| file_share_name = "${var.prefix}-file-share-nfs" | ||
| file_share_size = var.nfs_server_config.size | ||
| file_share_iops = var.nfs_server_config.iops | ||
| file_share_mount_target_name = "${var.prefix}-nfs" | ||
| file_share_subnet_id = [for subnet in module.landing_zone.subnet_data : subnet.id if subnet.name == "${var.prefix}-edge-vsi-edge-zone-1"][0] | ||
| file_share_security_group_ids = [for security_group in module.landing_zone.vpc_data[0].vpc_data.security_group : security_group.group_id if security_group.group_name == "network-services-sg"] | ||
| nlb_name = "${var.prefix}-file-share-nlb" | ||
| nlb_subnet_ids = [for subnet in module.landing_zone.subnet_data : subnet.id if subnet.name == "${var.prefix}-edge-vsi-edge-zone-1"] | ||
| nlb_security_group_ids = [for security_group in module.landing_zone.vpc_data[0].vpc_data.security_group : security_group.group_id if security_group.group_name == "network-services-sg"] | ||
| routing_table_name = "${var.prefix}-routing" | ||
ludwig-mueller marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| resource "ibm_is_share" "file_share_nfs" { | ||
| provider = ibm.ibm-is | ||
| count = var.configure_nfs_server ? 1 : 0 | ||
|
|
||
| name = local.file_share_name | ||
| size = local.file_share_size | ||
| profile = "dp2" | ||
| access_control_mode = "security_group" | ||
| iops = local.file_share_iops | ||
| zone = local.vpc_zone | ||
| resource_group = local.resource_group_id | ||
| } | ||
|
|
||
| resource "ibm_is_share_mount_target" "mount_target_nfs" { | ||
| provider = ibm.ibm-is | ||
| count = var.configure_nfs_server ? 1 : 0 | ||
|
|
||
| name = local.file_share_mount_target_name | ||
| share = ibm_is_share.file_share_nfs[0].id | ||
| virtual_network_interface { | ||
| name = local.file_share_mount_target_name | ||
| resource_group = local.resource_group_id | ||
| subnet = local.file_share_subnet_id | ||
| security_groups = local.file_share_security_group_ids | ||
| } | ||
| } | ||
|
|
||
| resource "ibm_is_lb" "file_share_nlb" { | ||
| provider = ibm.ibm-is | ||
| count = var.configure_nfs_server ? 1 : 0 | ||
|
|
||
| name = local.nlb_name | ||
| resource_group = local.resource_group_id | ||
| type = "private" | ||
| subnets = local.nlb_subnet_ids | ||
| profile = "network-fixed" | ||
| security_groups = local.nlb_security_group_ids | ||
| route_mode = true | ||
| } | ||
|
|
||
| resource "ibm_is_lb_pool" "nfs_backend_pool" { | ||
| provider = ibm.ibm-is | ||
| count = var.configure_nfs_server ? 1 : 0 | ||
|
|
||
| name = "nfs-backend-pool" | ||
| lb = ibm_is_lb.file_share_nlb[0].id | ||
| algorithm = "round_robin" | ||
| protocol = "tcp" | ||
| health_type = "tcp" | ||
| health_delay = 5 | ||
| health_retries = 2 | ||
| health_timeout = 2 | ||
| health_monitor_port = 2049 | ||
| failsafe_policy { | ||
| action = "bypass" | ||
| } | ||
| } | ||
|
|
||
| resource "ibm_is_lb_listener" "nfs_front_end_listener" { | ||
| provider = ibm.ibm-is | ||
| count = var.configure_nfs_server ? 1 : 0 | ||
|
|
||
| lb = ibm_is_lb.file_share_nlb[0].id | ||
| default_pool = ibm_is_lb_pool.nfs_backend_pool[0].id | ||
| protocol = "tcp" | ||
| } | ||
|
|
||
| resource "ibm_is_vpc_routing_table_route" "nfs_route" { | ||
| provider = ibm.ibm-is | ||
| count = var.configure_nfs_server ? 1 : 0 | ||
|
|
||
| name = "nfs-route" | ||
| vpc = ibm_is_share_mount_target.mount_target_nfs[0].vpc | ||
| routing_table = ibm_is_vpc_routing_table.routing_table[0].routing_table | ||
| zone = local.vpc_zone | ||
| destination = "${split(":", ibm_is_share_mount_target.mount_target_nfs[0].mount_path)[0]}/32" | ||
| action = "deliver" | ||
| advertise = false | ||
| next_hop = ibm_is_lb.file_share_nlb[0].private_ips[0] | ||
| } | ||
|
|
||
| locals { | ||
| nfs_host_or_ip_path = var.configure_nfs_server ? ibm_is_share_mount_target.mount_target_nfs[0].mount_path : "" | ||
| file_share_nlb = var.configure_nfs_server ? { | ||
| name = ibm_is_lb.file_share_nlb[0].name | ||
| id = ibm_is_lb.file_share_nlb[0].id | ||
| private_ips = [for private_ip in ibm_is_lb.file_share_nlb[0].private_ip : private_ip.address] | ||
| } : { | ||
| name = "" | ||
| id = "" | ||
| private_ips = [] | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| output "playbook_output" { | ||
| description = "Output from execute_playbooks. Only available after apply. Can be used to create an implicit dependency on the playbook execution." | ||
| value = var.ansible_vault_password == null ? terraform_data.execute_playbooks[0].output : terraform_data.execute_playbooks_with_vault[0].output | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.