Convert timescaledb and a bit of the resource registry module.
This commit is contained in:
parent
6809103372
commit
6dcc7c7a01
|
@ -43,7 +43,7 @@ module "instance_without_data_volume" {
|
||||||
description = "This instance serves resource-registry service",
|
description = "This instance serves resource-registry service",
|
||||||
flavor = module.common_variables.flavor_list.m1_large,
|
flavor = module.common_variables.flavor_list.m1_large,
|
||||||
networks = ["d4s-production-cloud-main", module.common_variables.networks_list.orientdb],
|
networks = ["d4s-production-cloud-main", module.common_variables.networks_list.orientdb],
|
||||||
security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers],
|
security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers, module.common_variables.security_group_list.debugging_from_jump_node],
|
||||||
server_groups_ids = [openstack_compute_servergroup_v2.resource_registry_server_group.id],
|
server_groups_ids = [openstack_compute_servergroup_v2.resource_registry_server_group.id],
|
||||||
image_ref = module.common_variables.ubuntu_1804
|
image_ref = module.common_variables.ubuntu_1804
|
||||||
},
|
},
|
||||||
|
@ -52,7 +52,7 @@ module "instance_without_data_volume" {
|
||||||
description = "This instance serves resource-registry service",
|
description = "This instance serves resource-registry service",
|
||||||
flavor = module.common_variables.flavor_list.m1_large,
|
flavor = module.common_variables.flavor_list.m1_large,
|
||||||
networks = ["d4s-production-cloud-main", module.common_variables.networks_list.orientdb],
|
networks = ["d4s-production-cloud-main", module.common_variables.networks_list.orientdb],
|
||||||
security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers],
|
security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers, module.common_variables.security_group_list.debugging_from_jump_node],
|
||||||
server_groups_ids = [openstack_compute_servergroup_v2.resource_registry_server_group.id],
|
server_groups_ids = [openstack_compute_servergroup_v2.resource_registry_server_group.id],
|
||||||
image_ref = module.common_variables.ubuntu_1804
|
image_ref = module.common_variables.ubuntu_1804
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,83 @@
|
||||||
|
{
|
||||||
|
"version": 4,
|
||||||
|
"terraform_version": "1.6.5",
|
||||||
|
"serial": 1,
|
||||||
|
"lineage": "aad7c58d-7ef3-d6b0-2ab5-1110c6146633",
|
||||||
|
"outputs": {},
|
||||||
|
"resources": [
|
||||||
|
{
|
||||||
|
"mode": "data",
|
||||||
|
"type": "terraform_remote_state",
|
||||||
|
"name": "privnet_dns_router",
|
||||||
|
"provider": "provider[\"terraform.io/builtin/terraform\"]",
|
||||||
|
"instances": [
|
||||||
|
{
|
||||||
|
"schema_version": 0,
|
||||||
|
"attributes": {
|
||||||
|
"backend": "local",
|
||||||
|
"config": {
|
||||||
|
"value": {
|
||||||
|
"path": "../project-setup/terraform.tfstate"
|
||||||
|
},
|
||||||
|
"type": [
|
||||||
|
"object",
|
||||||
|
{
|
||||||
|
"path": "string"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"defaults": null,
|
||||||
|
"outputs": {
|
||||||
|
"value": {
|
||||||
|
"dns_zone_id": "74135b34-1a9c-4c01-8cf0-22450a5660c4",
|
||||||
|
"external_gateway_ip": "146.48.31.57",
|
||||||
|
"main_private_network_id": "020df98d-ae72-452a-b376-3b6dc289acac",
|
||||||
|
"main_subnet_network_id": "5d7b83ad-e058-4a3a-bfd8-d20ba6d42e1a"
|
||||||
|
},
|
||||||
|
"type": [
|
||||||
|
"object",
|
||||||
|
{
|
||||||
|
"dns_zone_id": "string",
|
||||||
|
"external_gateway_ip": "string",
|
||||||
|
"main_private_network_id": "string",
|
||||||
|
"main_subnet_network_id": "string"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"workspace": null
|
||||||
|
},
|
||||||
|
"sensitive_attributes": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mode": "managed",
|
||||||
|
"type": "openstack_compute_servergroup_v2",
|
||||||
|
"name": "resource_registry_server_group",
|
||||||
|
"provider": "provider[\"registry.terraform.io/terraform-provider-openstack/openstack\"]",
|
||||||
|
"instances": [
|
||||||
|
{
|
||||||
|
"schema_version": 0,
|
||||||
|
"attributes": {
|
||||||
|
"id": "2a9b818b-c765-4a2a-9788-b910a2e82220",
|
||||||
|
"members": [],
|
||||||
|
"name": "resource-registry",
|
||||||
|
"policies": [
|
||||||
|
"anti-affinity"
|
||||||
|
],
|
||||||
|
"region": "isti_area_pi_1",
|
||||||
|
"rules": [
|
||||||
|
{
|
||||||
|
"max_server_per_host": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"value_specs": null
|
||||||
|
},
|
||||||
|
"sensitive_attributes": [],
|
||||||
|
"private": "bnVsbA=="
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"check_results": null
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
# Define required providers
|
||||||
|
terraform {
|
||||||
|
required_version = ">= 0.14.0"
|
||||||
|
required_providers {
|
||||||
|
openstack = {
|
||||||
|
source = "terraform-provider-openstack/openstack"
|
||||||
|
version = "~> 1.53.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data "terraform_remote_state" "privnet_dns_router" {
|
||||||
|
backend = "local"
|
||||||
|
|
||||||
|
config = {
|
||||||
|
path = "../project-setup/terraform.tfstate"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module "timescaledb" {
|
||||||
|
source = "../../modules/timescaledb"
|
||||||
|
|
||||||
|
timescaledb_nodes_count = 2
|
||||||
|
timescaledb_node_flavor = "m1.large"
|
||||||
|
timescaledb_ip = ["192.168.11.5", "192.168.11.6"]
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
provider "openstack" {
|
||||||
|
cloud = "d4s-production"
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
# Define required providers
|
||||||
|
terraform {
|
||||||
|
required_version = ">= 0.14.0"
|
||||||
|
required_providers {
|
||||||
|
openstack = {
|
||||||
|
source = "terraform-provider-openstack/openstack"
|
||||||
|
version = "~> 1.53.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data "terraform_remote_state" "privnet_dns_router" {
|
||||||
|
backend = "local"
|
||||||
|
|
||||||
|
config = {
|
||||||
|
path = "../project-setup/terraform.tfstate"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# SSH settings
|
||||||
|
module "ssh_settings" {
|
||||||
|
source = "../../modules/ssh-key-ref"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Global variables (constants, really)
|
||||||
|
module "common_variables" {
|
||||||
|
source = "../../modules/common_variables"
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#
|
||||||
# TimeScaleDB shared server
|
# TimeScaleDB shared server
|
||||||
# Network
|
# Network
|
||||||
resource "openstack_networking_network_v2" "timescaledb_net" {
|
resource "openstack_networking_network_v2" "timescaledb_net" {
|
||||||
|
@ -5,11 +6,11 @@ resource "openstack_networking_network_v2" "timescaledb_net" {
|
||||||
admin_state_up = "true"
|
admin_state_up = "true"
|
||||||
external = "false"
|
external = "false"
|
||||||
description = var.timescaledb_net.network_description
|
description = var.timescaledb_net.network_description
|
||||||
dns_domain = var.dns_zone.zone_name
|
dns_domain = data.terraform_remote_state.privnet_dns_router.outputs.dns_zone.zone_name
|
||||||
mtu = var.mtu_size
|
mtu = module.common_variables.mtu_size
|
||||||
port_security_enabled = true
|
port_security_enabled = true
|
||||||
shared = false
|
shared = false
|
||||||
region = var.main_region
|
region = module.common_variables.main_region
|
||||||
}
|
}
|
||||||
|
|
||||||
# Subnet
|
# Subnet
|
||||||
|
@ -18,7 +19,7 @@ resource "openstack_networking_subnet_v2" "timescaledb_subnet" {
|
||||||
description = "subnet used to connect to the shared TimeScaleDB service"
|
description = "subnet used to connect to the shared TimeScaleDB service"
|
||||||
network_id = openstack_networking_network_v2.timescaledb_net.id
|
network_id = openstack_networking_network_v2.timescaledb_net.id
|
||||||
cidr = var.timescaledb_net.network_cidr
|
cidr = var.timescaledb_net.network_cidr
|
||||||
dns_nameservers = var.resolvers_ip
|
dns_nameservers = module.common_variables.resolvers_ip
|
||||||
ip_version = 4
|
ip_version = 4
|
||||||
enable_dhcp = true
|
enable_dhcp = true
|
||||||
no_gateway = true
|
no_gateway = true
|
||||||
|
@ -55,15 +56,16 @@ resource "openstack_compute_servergroup_v2" "timescaledb_cluster" {
|
||||||
resource "openstack_compute_instance_v2" "timescaledb_server" {
|
resource "openstack_compute_instance_v2" "timescaledb_server" {
|
||||||
count = var.timescaledb_nodes_count
|
count = var.timescaledb_nodes_count
|
||||||
name = var.timescaledb_server_data.node_name
|
name = var.timescaledb_server_data.node_name
|
||||||
availability_zone_hints = var.availability_zones_names.availability_zone_no_gpu
|
availability_zone_hints = module.common_variables.availability_zones_names.availability_zone_no_gpu
|
||||||
|
image_name = module.common_variables.ubuntu_2204.name
|
||||||
flavor_name = var.timescaledb_node_flavor
|
flavor_name = var.timescaledb_node_flavor
|
||||||
key_pair = var.ssh_key_file.name
|
key_pair = module.ssh_settings.ssh_key_name
|
||||||
security_groups = [var.default_security_group_name, openstack_networking_secgroup_v2.timescaledb_access.name]
|
security_groups = [data.terraform_remote_state.privnet_dns_router.outputs.default_security_group_name, openstack_networking_secgroup_v2.timescaledb_access.name]
|
||||||
scheduler_hints {
|
scheduler_hints {
|
||||||
group = openstack_compute_servergroup_v2.timescaledb_cluster.id
|
group = openstack_compute_servergroup_v2.timescaledb_cluster.id
|
||||||
}
|
}
|
||||||
block_device {
|
block_device {
|
||||||
uuid = var.ubuntu_2204.uuid
|
uuid = module.common_variables.ubuntu_2204.uuid
|
||||||
source_type = "image"
|
source_type = "image"
|
||||||
volume_size = 10
|
volume_size = 10
|
||||||
boot_index = 0
|
boot_index = 0
|
||||||
|
@ -80,14 +82,14 @@ resource "openstack_compute_instance_v2" "timescaledb_server" {
|
||||||
}
|
}
|
||||||
|
|
||||||
network {
|
network {
|
||||||
name = var.main_private_network.name
|
uuid = data.terraform_remote_state.privnet_dns_router.outputs.main_private_network.name
|
||||||
}
|
}
|
||||||
network {
|
network {
|
||||||
name = var.timescaledb_net.network_name
|
name = var.timescaledb_net.network_name
|
||||||
fixed_ip_v4 = var.timescaledb_ip.* [count.index]
|
fixed_ip_v4 = var.timescaledb_ip.* [count.index]
|
||||||
}
|
}
|
||||||
|
|
||||||
user_data = file("${var.ubuntu2204_data_file}")
|
user_data = file("${module.common_variables.ubuntu_2204.user_data_file}")
|
||||||
depends_on = [openstack_networking_subnet_v2.timescaledb_subnet]
|
depends_on = [openstack_networking_subnet_v2.timescaledb_subnet]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue