Proper module for the main network and dns zone.

This commit is contained in:
Andrea Dell'Amico 2023-12-11 18:15:58 +01:00
parent b00237ae03
commit db59cf45a1
Signed by: andrea.dellamico
GPG Key ID: 147ABE6CEB9E20FF
3 changed files with 68 additions and 5 deletions

View File

@ -13,10 +13,10 @@ resource "openstack_networking_network_v2" "main-private-network" {
external = "false"
description = var.main_private_network.description
dns_domain = var.dns_zone.zone_name
mtu = var.mtu_size
mtu = module.common_variables.mtu_size
port_security_enabled = true
shared = false
region = var.main_region
region = module.common_variables.main_region
tenant_id = var.os_project_data.id
}
@ -26,7 +26,7 @@ resource "openstack_networking_subnet_v2" "main-private-subnet" {
network_id = openstack_networking_network_v2.main-private-network.id
cidr = var.main_private_subnet.cidr
gateway_ip = var.main_private_subnet.gateway_ip
dns_nameservers = var.resolvers_ip
dns_nameservers = module.common_variables.resolvers_ip
ip_version = 4
enable_dhcp = true
tenant_id = var.os_project_data.id
@ -39,7 +39,7 @@ resource "openstack_networking_subnet_v2" "main-private-subnet" {
resource "openstack_networking_router_v2" "external-router" {
name = var.external_router.name
description = var.external_router.description
external_network_id = var.external_network.id
external_network_id = module.common_variables.external_network.id
tenant_id = var.os_project_data.id
enable_snat = true
vendor_options {
@ -67,4 +67,3 @@ resource "openstack_dns_recordset_v2" "acme_challenge_recordset" {
type = "CNAME"
records = ["_acme-challenge.d4science.net."]
}

View File

@ -0,0 +1,19 @@
output "os_project_data" {
value = var.os_project_data
}
output "dns_zone" {
value = var.dns_zone
}
output "main_private_network" {
value = var.main_private_network
}
output "main_private_subnet" {
value = var.main_private_subnet
}
output "external_router" {
value = var.external_router
}

View File

@ -0,0 +1,45 @@
variable "os_project_data" {
type = map(string)
default = {
id = ""
}
}
variable "dns_zone" {
type = map(string)
default = {
zone_name = ""
email = "postmaster@isti.cnr.it"
description = ""
ttl = 8600
id = ""
}
}
variable "main_private_network" {
type = map(string)
default = {
name = ""
description = ""
}
}
variable "main_private_subnet" {
type = map(string)
default = {
name = ""
description = ""
cidr = ""
gateway_ip = ""
allocation_start = ""
allocation_end = ""
}
}
variable "external_router" {
type = map(string)
default = {
name = ""
description = ""
}
}