99 lines
3.8 KiB
HCL
99 lines
3.8 KiB
HCL
# Forgejo (git service) of the S2I2S OpenStack project.
|
|
#
|
|
# The resources are in ../../modules/forgejo, which also carries the sizing
|
|
# (m1.xlarge: RAM 16 - VCPUs 8, 200 GB of SSD for the repositories) and the
|
|
# service ports. Only what belongs to this project is set here: the address on
|
|
# the main private network, taken from the address plan in ../variables, and the
|
|
# IDs that come from the other workspaces.
|
|
#
|
|
# Apply order: main_net_dns_router -> project-setup -> postgresql -> this one.
|
|
|
|
data "terraform_remote_state" "privnet_dns_router" {
|
|
backend = "local"
|
|
config = {
|
|
path = "../main_net_dns_router/terraform.tfstate"
|
|
}
|
|
}
|
|
|
|
data "terraform_remote_state" "project_setup" {
|
|
backend = "local"
|
|
config = {
|
|
path = "../project-setup/terraform.tfstate"
|
|
}
|
|
}
|
|
|
|
# Dedicated network and client security group of the database
|
|
data "terraform_remote_state" "postgresql" {
|
|
backend = "local"
|
|
config = {
|
|
path = "../postgresql/terraform.tfstate"
|
|
}
|
|
}
|
|
|
|
module "labs_common_variables" {
|
|
source = "../../modules/labs_common_variables"
|
|
}
|
|
|
|
module "project_variables" {
|
|
source = "../variables"
|
|
}
|
|
|
|
module "ssh_settings" {
|
|
source = "../../modules/ssh-key-ref"
|
|
}
|
|
|
|
locals {
|
|
# From the network/DNS state
|
|
dns_zone = data.terraform_remote_state.privnet_dns_router.outputs.dns_zone
|
|
dns_zone_id = data.terraform_remote_state.privnet_dns_router.outputs.dns_zone_id
|
|
main_private_network_id = data.terraform_remote_state.privnet_dns_router.outputs.main_private_network_id
|
|
main_private_subnet_id = data.terraform_remote_state.privnet_dns_router.outputs.main_subnet_network_id
|
|
|
|
# From the project setup state
|
|
default_security_group_id = data.terraform_remote_state.project_setup.outputs.default_security_group_id
|
|
main_haproxy_l7_ip = data.terraform_remote_state.project_setup.outputs.main_haproxy_l7_ip
|
|
main_loadbalancer_name = data.terraform_remote_state.project_setup.outputs.main_loadbalancer_hostname
|
|
|
|
# From the postgresql state
|
|
postgresql_network_id = data.terraform_remote_state.postgresql.outputs.postgresql_network_id
|
|
postgresql_subnet_id = data.terraform_remote_state.postgresql.outputs.postgresql_subnet_id
|
|
postgresql_client_security_group_id = data.terraform_remote_state.postgresql.outputs.postgresql_client_access_security_group_id
|
|
|
|
# From the common and project variables
|
|
availability_zone = module.labs_common_variables.availability_zones_names.availability_zone_no_gpu
|
|
ubuntu_2404 = module.labs_common_variables.ubuntu_2404
|
|
ubuntu2404_data_file = module.labs_common_variables.ubuntu2404_data_file
|
|
basic_services_ip = module.project_variables.basic_services_ip
|
|
}
|
|
|
|
module "forgejo" {
|
|
source = "../../modules/forgejo"
|
|
|
|
# Address plan of the project. The sizing comes from the module defaults
|
|
forgejo_main_ip = local.basic_services_ip.forgejo
|
|
|
|
main_private_network_id = local.main_private_network_id
|
|
main_private_subnet_id = local.main_private_subnet_id
|
|
default_security_group_id = local.default_security_group_id
|
|
haproxy_l7_ip = local.main_haproxy_l7_ip
|
|
|
|
postgresql_network_id = local.postgresql_network_id
|
|
postgresql_subnet_id = local.postgresql_subnet_id
|
|
postgresql_client_security_group_id = local.postgresql_client_security_group_id
|
|
|
|
availability_zone = local.availability_zone
|
|
image = {
|
|
uuid = local.ubuntu_2404.uuid
|
|
user_data_file = local.ubuntu2404_data_file
|
|
}
|
|
ssh_key_name = module.ssh_settings.ssh_key_name
|
|
|
|
# git.s2i2s.cloud.isti.cnr.it, a CNAME of the main load balancer. The other
|
|
# name of the service, gitea-s2i2s.isti.cnr.it, is in the isti.cnr.it zone and
|
|
# is moved by hand at the migration
|
|
dns_zone_id = local.dns_zone_id
|
|
dns_zone_name = local.dns_zone.name
|
|
forgejo_public_name = "git"
|
|
forgejo_cname_target = local.main_loadbalancer_name
|
|
}
|