Added storagehub-4

This commit is contained in:
Giancarlo Panichi 2024-10-07 12:11:58 +02:00
parent 87887cca2e
commit 13f65d464a
2 changed files with 230 additions and 2 deletions

View File

@ -35,7 +35,10 @@ resource "openstack_blockstorage_volume_v3" "storagehub_3_dev_data_volume" {
size = "25" size = "25"
} }
resource "openstack_blockstorage_volume_v3" "storagehub_4_dev_data_volume" {
name = "storagehub_4_data_volume"
size = "25"
}
# Instances 3 # Instances 3
@ -76,13 +79,57 @@ resource "openstack_compute_instance_v2" "storagehub_3_dev" {
} }
# Instances 4
resource "openstack_compute_instance_v2" "storagehub_4_dev" {
name = "storagehub-4"
availability_zone_hints = module.common_variables.availability_zone_no_gpu_name
flavor_name = "m1.medium"
key_pair = module.ssh_settings.ssh_key_name
security_groups = [data.terraform_remote_state.privnet_dns_router.outputs.default_security_group_name, data.terraform_remote_state.privnet_dns_router.outputs.security_group_list.http_and_https_from_the_load_balancers]
block_device {
uuid = module.common_variables.ubuntu_2404.uuid
source_type = "image"
volume_size = 10
boot_index = 0
destination_type = "volume"
delete_on_termination = false
}
# Creates the networks according to input networks
dynamic "network" {
for_each = toset([data.terraform_remote_state.privnet_dns_router.outputs.main_private_network.name, module.common_variables.networks_list.shared_postgresql])
content {
name = network.value
}
}
# user_data script used
user_data = file("${module.common_variables.ubuntu_2404.user_data_file}")
# Do not replace the instance when the ssh key changes
lifecycle {
ignore_changes = [
# Ignore changes to tags, e.g. because a management agent
# updates these based on some ruleset managed elsewhere.
key_pair, user_data, network
]
}
}
# Attach
resource "openstack_compute_volume_attach_v2" "storagehub_3_dev_attach" { resource "openstack_compute_volume_attach_v2" "storagehub_3_dev_attach" {
instance_id = openstack_compute_instance_v2.storagehub_3_dev.id instance_id = openstack_compute_instance_v2.storagehub_3_dev.id
volume_id = openstack_blockstorage_volume_v3.storagehub_3_dev_data_volume.id volume_id = openstack_blockstorage_volume_v3.storagehub_3_dev_data_volume.id
device = "/dev/vdb" device = "/dev/vdb"
} }
resource "openstack_compute_volume_attach_v2" "storagehub_4_dev_attach" {
instance_id = openstack_compute_instance_v2.storagehub_4_dev.id
volume_id = openstack_blockstorage_volume_v3.storagehub_4_dev_data_volume.id
device = "/dev/vdb"
}
locals { locals {
cname_target = "main-lb.${data.terraform_remote_state.privnet_dns_router.outputs.dns_zone.zone_name}" cname_target = "main-lb.${data.terraform_remote_state.privnet_dns_router.outputs.dns_zone.zone_name}"
@ -102,6 +149,14 @@ module "dns_records_create" {
ttl = 8600 ttl = 8600
type = "CNAME" type = "CNAME"
records = [local.cname_target] records = [local.cname_target]
},
storagehub-4 = {
zone_id = data.terraform_remote_state.privnet_dns_router.outputs.dns_zone_id
name = join(".", ["storagehub-4", data.terraform_remote_state.privnet_dns_router.outputs.dns_zone.zone_name])
description = "StorageHub 4"
ttl = 8600
type = "CNAME"
records = [local.cname_target]
} }
} }
} }

View File

@ -1,7 +1,7 @@
{ {
"version": 4, "version": 4,
"terraform_version": "1.6.4", "terraform_version": "1.6.4",
"serial": 15, "serial": 20,
"lineage": "7ae19997-17fe-7f03-9bcb-e326176791ba", "lineage": "7ae19997-17fe-7f03-9bcb-e326176791ba",
"outputs": {}, "outputs": {},
"resources": [ "resources": [
@ -432,6 +432,39 @@
} }
] ]
}, },
{
"mode": "managed",
"type": "openstack_blockstorage_volume_v3",
"name": "storagehub_4_dev_data_volume",
"provider": "provider[\"registry.terraform.io/terraform-provider-openstack/openstack\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"attachment": [],
"availability_zone": "nova",
"backup_id": "",
"consistency_group_id": null,
"description": "",
"enable_online_resize": null,
"id": "ffd82b63-0c07-4f0b-88fb-a6f3bdfd8d6b",
"image_id": null,
"metadata": {},
"name": "storagehub_4_data_volume",
"region": "isti_area_pi_1",
"scheduler_hints": [],
"size": 25,
"snapshot_id": "",
"source_replica": null,
"source_vol_id": "",
"timeouts": null,
"volume_type": "cephUnencrypted"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6NjAwMDAwMDAwMDAwfX0="
}
]
},
{ {
"mode": "managed", "mode": "managed",
"type": "openstack_compute_instance_v2", "type": "openstack_compute_instance_v2",
@ -518,6 +551,92 @@
} }
] ]
}, },
{
"mode": "managed",
"type": "openstack_compute_instance_v2",
"name": "storagehub_4_dev",
"provider": "provider[\"registry.terraform.io/terraform-provider-openstack/openstack\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"access_ip_v4": "10.1.29.195",
"access_ip_v6": "",
"admin_pass": null,
"all_metadata": {},
"all_tags": [],
"availability_zone": "cnr-isti-nova-a",
"availability_zone_hints": "cnr-isti-nova-a",
"block_device": [
{
"boot_index": 0,
"delete_on_termination": false,
"destination_type": "volume",
"device_type": "",
"disk_bus": "",
"guest_format": "",
"multiattach": false,
"source_type": "image",
"uuid": "fc3f705d-3cf5-4866-8ef6-ff6e2cdd4075",
"volume_size": 10,
"volume_type": ""
}
],
"config_drive": null,
"created": "2024-10-07 10:05:52 +0000 UTC",
"flavor_id": "4",
"flavor_name": "m1.medium",
"force_delete": false,
"id": "52622dd4-4f62-4405-b4cd-ab4b43bab9ea",
"image_id": "Attempt to boot from volume - no image supplied",
"image_name": null,
"key_pair": "Giancarlo Panichi",
"metadata": null,
"name": "storagehub-4",
"network": [
{
"access_network": false,
"fixed_ip_v4": "10.1.29.195",
"fixed_ip_v6": "",
"mac": "fa:16:3e:2f:58:d8",
"name": "d4s-dev-cloud-main",
"port": "",
"uuid": "e0af5eba-f24a-4d0d-8184-bc654b980c4a"
},
{
"access_network": false,
"fixed_ip_v4": "192.168.2.221",
"fixed_ip_v6": "",
"mac": "fa:16:3e:29:f9:b8",
"name": "postgresql-srv-net",
"port": "",
"uuid": "00422a4a-4b8b-4c85-acf9-ef733df842b9"
}
],
"network_mode": null,
"personality": [],
"power_state": "active",
"region": "isti_area_pi_1",
"scheduler_hints": [],
"security_groups": [
"default",
"traffic_from_the_main_load_balancers"
],
"stop_before_destroy": false,
"tags": null,
"timeouts": null,
"updated": "2024-10-07 10:06:46 +0000 UTC",
"user_data": "bb83b25fd1219aa1b850ece9be8d7b0f31714608",
"vendor_options": []
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxODAwMDAwMDAwMDAwLCJkZWxldGUiOjE4MDAwMDAwMDAwMDAsInVwZGF0ZSI6MTgwMDAwMDAwMDAwMH19",
"dependencies": [
"data.terraform_remote_state.privnet_dns_router"
]
}
]
},
{ {
"mode": "managed", "mode": "managed",
"type": "openstack_compute_volume_attach_v2", "type": "openstack_compute_volume_attach_v2",
@ -547,6 +666,35 @@
} }
] ]
}, },
{
"mode": "managed",
"type": "openstack_compute_volume_attach_v2",
"name": "storagehub_4_dev_attach",
"provider": "provider[\"registry.terraform.io/terraform-provider-openstack/openstack\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"device": "/dev/vdb",
"id": "52622dd4-4f62-4405-b4cd-ab4b43bab9ea/ffd82b63-0c07-4f0b-88fb-a6f3bdfd8d6b",
"instance_id": "52622dd4-4f62-4405-b4cd-ab4b43bab9ea",
"multiattach": null,
"region": "isti_area_pi_1",
"tag": null,
"timeouts": null,
"vendor_options": [],
"volume_id": "ffd82b63-0c07-4f0b-88fb-a6f3bdfd8d6b"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6NjAwMDAwMDAwMDAwfX0=",
"dependencies": [
"data.terraform_remote_state.privnet_dns_router",
"openstack_blockstorage_volume_v3.storagehub_4_dev_data_volume",
"openstack_compute_instance_v2.storagehub_4_dev"
]
}
]
},
{ {
"module": "module.dns_records_create", "module": "module.dns_records_create",
"mode": "managed", "mode": "managed",
@ -578,6 +726,31 @@
"dependencies": [ "dependencies": [
"data.terraform_remote_state.privnet_dns_router" "data.terraform_remote_state.privnet_dns_router"
] ]
},
{
"index_key": "storagehub-4",
"schema_version": 0,
"attributes": {
"description": "StorageHub 4",
"disable_status_check": false,
"id": "cbae638a-9d99-44aa-946c-0f5ffb7fc488/7c13f300-98b2-42a2-a261-bcc616d85cbe",
"name": "storagehub-4.cloud-dev.d4science.org.",
"project_id": "e8f8ca72f30648a8b389b4e745ac83a9",
"records": [
"main-lb.cloud-dev.d4science.org."
],
"region": "isti_area_pi_1",
"timeouts": null,
"ttl": 8600,
"type": "CNAME",
"value_specs": null,
"zone_id": "cbae638a-9d99-44aa-946c-0f5ffb7fc488"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6NjAwMDAwMDAwMDAwLCJ1cGRhdGUiOjYwMDAwMDAwMDAwMH19",
"dependencies": [
"data.terraform_remote_state.privnet_dns_router"
]
} }
] ]
} }