Skip to content

Commit

Permalink
DBP-817-calculat Mariadb_cluster_lan_cidr
Browse files Browse the repository at this point in the history
  • Loading branch information
sahassou committed Jun 6, 2024
1 parent e461e19 commit 93a252b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 28 deletions.
16 changes: 7 additions & 9 deletions modules/ionos-basic-vm-mariadb/locals.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
locals {
basic_vm_lan_ip = ionoscloud_nic.basic_vm_nic.ips[0] # Assuming the NIC has at least one IP address
private_lan_cidr = "${cidrsubnet(ionoscloud_nic.basic_vm_nic.ips[0], 24, 0)}" # Assuming a /24 subnet
mariadb_cluster_lan_cidr = "${cidrsubnet(local.private_lan_cidr, 4, 1)}"
basic_vm_lan_ip = ionoscloud_nic.basic_vm_nic.ips[0]
subnet_mask = 24

basic_vm_lan_cidr = "${local.basic_vm_lan_ip}/${local.subnet_mask}"

private_lan_cidr = local.basic_vm_lan_cidr
mariadb_cluster_lan_cidr = cidrsubnet(local.private_lan_cidr, 4, 1)
mariadb_cluster_lan_ip = cidrhost(local.mariadb_cluster_lan_cidr, 9)
}

# let's assume that private LAN was created with a CIDR range of 10.0.0.0/24
# private_lan_cidr = 10.0.0.0/24
#basic_vm_lan_ip =10.0.0.9
#mariadb_cluster_lan_cidr=10.0.1.0
#mariadb_cluster_lan_ip = "10.0.1.10"
35 changes: 16 additions & 19 deletions modules/ionos-basic-vm-mariadb/output.tf
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
# output "dns_name" {
# description = "The DNS name pointing to your cluster."
# value = ionoscloud_mariadb_cluster.mariadb_cluster.dns_name
# }

output "private_lan_cidr" {
description = "The CIDR range of the private LAN created for the basic VM and MariaDB cluster"
value = local.private_lan_cidr
output "basic_vm_lan_ip" {
description = "The IP address assigned to the basic VM NIC"
value = ionoscloud_nic.basic_vm_nic.ips[0]
}

output "private_lan_id" {
description = "The ID of the private LAN created for the basic VM and MariaDB cluster"
value = ionoscloud_lan.private_lan.id
}
output "basic_vm_server_id" {
description = "The ID of the basic VM server"
value = module.basic-vm.basic_vm_server_id
output "mariadb_cluster_lan_ip" {
description = "The IP address for the MariaDB cluster within the calculated CIDR range"
value = local.mariadb_cluster_lan_ip
}
output "basic_vm_nic_id" {
description = "The ID of the NIC attached to the basic VM"
value = ionoscloud_nic.basic_vm_nic.id

output "private_lan_cidr" {
description = "represents the CIDR range of the private LAN created for the basic VM and MariaDB cluster"
value = local.private_lan_cidr
}

output "mariadb_cluster_lan_cidr" {
description = "The CIDR range of the LAN for the MariaDB cluster"
description = "Is calculating the CIDR range for the MariaDB cluster LAN by taking a subnet of the private_lan_cidr"
value = local.mariadb_cluster_lan_cidr
}

output "private_lan_id" {
description = "The ID of the private LAN for the privacyidea VM and MariaDB cluster"
value = data.ionoscloud_lan.private_lan.id
}

0 comments on commit 93a252b

Please sign in to comment.