Merge pull request 'feature/25884' (#11) from feature/25884 into main

Reviewed-on: InfraScience/infrastructure-as-code#11
This commit is contained in:
Giancarlo Panichi 2023-12-11 11:41:08 +01:00
commit 5acc78ca99
4 changed files with 337 additions and 0 deletions

View File

@ -0,0 +1,24 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/terraform-provider-openstack/openstack" {
version = "1.53.0"
constraints = "~> 1.53.0"
hashes = [
"h1:YLGvYkSuagyP5orUTyKNK+JhzS17EFTUDpZ5R5/fFv4=",
"zh:09da7ca98ffd3de7b9ce36c4c13446212a6e763ba1162be71b50f95d453cb68e",
"zh:14041bcbb87312411d88612056ed185650bfd01284b8ea0761ce8105a331708e",
"zh:35bf4c788fdbc17c8e40ebc7b33c7de4b45a2fa2efaa657b10f0e3bd37c9627f",
"zh:46ede8ef4cfa12d654c538afc1e1ec34a1f3e8eb4e986ee23dceae398b7176a6",
"zh:59675734990dab1e8d87997853ea75e8104bba730b3f5a7146ac735540c9d6bf",
"zh:6de52428849806498670e827b54810be7510a2a79449602c1aede4235a0ec036",
"zh:78b2a20601272afceffac8f8ca78a6b647b84196c0dd8dc710fae297f6be15a4",
"zh:7c41ed3a4fac09677e676ecf9f9edd1e38eef449e656cb01a848d2c799c6de8f",
"zh:852800228f4118a4aa6cfaa4468b851247cbed6f037fd204f08de69eb1edc149",
"zh:86d618e7f9a07d978b8bc4b190be350a00de64ec535f9c8f5dfe133542a55483",
"zh:963a9e72b66d8bcf43de9b14a674ae3ca3719ce2f829217f7a65b66fc3773397",
"zh:a8e72ab67795071bda61f99a6de3d2d40122fb51971768fd75e1324abe874ced",
"zh:ce1890cf3af17d569af3bc7673cec0a8f78e6f5d701767593f3d29c551f44848",
"zh:e6f1b96eb684f527a47f71923f268c86a36d7894751b31ee9e726d7502a639cd",
]
}

View File

@ -0,0 +1,56 @@
# 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"
}
}
#
# Uses common_variables as module
#
module "common_variables" {
source = "../../modules/common_variables"
}
#
# Creates the server group "gcat"
#
resource "openstack_compute_servergroup_v2" "sdi_geo_server_group" {
name = "sdi-geo"
policies = [module.common_variables.policy_list.soft_anti_affinity]
}
module "instance_with_data_volume" {
source = "../../modules/instance_with_data_volume"
instances_with_data_volume_map = {
geonetwork_1 = {
name = "geonetwork-1",
description = "This instance serves geonetwork service",
flavor = module.common_variables.flavor_list.m1_medium,
networks = ["d4s-dev-cloud-main",module.common_variables.networks_list.shared_postgresql],
security_groups = [module.common_variables.security_group_list.default, module.common_variables.security_group_list.http_and_https_from_the_load_balancers],
server_groups_ids = [openstack_compute_servergroup_v2.sdi_geo_server_group.id],
image_ref = module.common_variables.ubuntu_1804
volume = {
name = "geonetwork_1_data_volume",
size = "30",
device = "/dev/vdb"
}
}
}
}

View File

@ -0,0 +1,3 @@
provider "openstack" {
cloud = "d4s-dev"
}

View File

@ -0,0 +1,254 @@
{
"version": 4,
"terraform_version": "1.6.4",
"serial": 5,
"lineage": "e3a2cae2-4c05-25e0-9e16-4616ea0bd8d4",
"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": "cbae638a-9d99-44aa-946c-0f5ffb7fc488",
"external_gateway_ip": "146.48.31.109",
"main_private_network_id": "e0af5eba-f24a-4d0d-8184-bc654b980c4a",
"main_subnet_network_id": "2aa977f2-80b4-447c-a6b0-dfa06bf68751"
},
"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": "sdi_geo_server_group",
"provider": "provider[\"registry.terraform.io/terraform-provider-openstack/openstack\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"id": "39b5a9fa-8c3b-40d9-8d8a-e595d47358f5",
"members": [],
"name": "sdi-geo",
"policies": [
"soft-anti-affinity"
],
"region": "isti_area_pi_1",
"rules": [
{
"max_server_per_host": 0
}
],
"value_specs": null
},
"sensitive_attributes": [],
"private": "bnVsbA=="
}
]
},
{
"module": "module.instance_with_data_volume",
"mode": "managed",
"type": "openstack_blockstorage_volume_v3",
"name": "instance_data_volume",
"provider": "provider[\"registry.terraform.io/terraform-provider-openstack/openstack\"]",
"instances": [
{
"index_key": "geonetwork_1",
"schema_version": 0,
"attributes": {
"attachment": [],
"availability_zone": "nova",
"consistency_group_id": null,
"description": "",
"enable_online_resize": null,
"id": "e89ec101-eab3-4291-a192-47aa2542cde7",
"image_id": null,
"metadata": {},
"multiattach": null,
"name": "geonetwork_1_data_volume",
"region": "isti_area_pi_1",
"scheduler_hints": [],
"size": 30,
"snapshot_id": "",
"source_replica": null,
"source_vol_id": "",
"timeouts": null,
"volume_type": "cephUnencrypted"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6NjAwMDAwMDAwMDAwfX0=",
"dependencies": [
"openstack_compute_servergroup_v2.sdi_geo_server_group"
]
}
]
},
{
"module": "module.instance_with_data_volume",
"mode": "managed",
"type": "openstack_compute_instance_v2",
"name": "instance_with_data_volume",
"provider": "provider[\"registry.terraform.io/terraform-provider-openstack/openstack\"]",
"instances": [
{
"index_key": "geonetwork_1",
"schema_version": 0,
"attributes": {
"access_ip_v4": "10.1.28.82",
"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": "7ed6a2cd-2b07-482e-8ce4-f018dff16c89",
"volume_size": 10,
"volume_type": ""
}
],
"config_drive": null,
"created": "2023-12-11 10:25:30 +0000 UTC",
"flavor_id": "4",
"flavor_name": "m1.medium",
"floating_ip": null,
"force_delete": false,
"id": "ce706ddc-cd05-45fc-bfff-b46839c91604",
"image_id": "Attempt to boot from volume - no image supplied",
"image_name": null,
"key_pair": "Giancarlo Panichi",
"metadata": null,
"name": "geonetwork-1",
"network": [
{
"access_network": false,
"fixed_ip_v4": "10.1.28.82",
"fixed_ip_v6": "",
"floating_ip": "",
"mac": "fa:16:3e:bf:64:1d",
"name": "d4s-dev-cloud-main",
"port": "",
"uuid": "e0af5eba-f24a-4d0d-8184-bc654b980c4a"
},
{
"access_network": false,
"fixed_ip_v4": "192.168.2.223",
"fixed_ip_v6": "",
"floating_ip": "",
"mac": "fa:16:3e:f5:c3:88",
"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": [
{
"additional_properties": null,
"build_near_host_ip": "",
"different_cell": [],
"different_host": [],
"group": "39b5a9fa-8c3b-40d9-8d8a-e595d47358f5",
"query": [],
"same_host": [],
"target_cell": ""
}
],
"security_groups": [
"default",
"http and https from the load balancers"
],
"stop_before_destroy": false,
"tags": null,
"timeouts": null,
"updated": "2023-12-11 10:26:05 +0000 UTC",
"user_data": "47d4769e61324c305c4b70ed6673de4fad84150d",
"vendor_options": [],
"volume": []
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxODAwMDAwMDAwMDAwLCJkZWxldGUiOjE4MDAwMDAwMDAwMDAsInVwZGF0ZSI6MTgwMDAwMDAwMDAwMH19",
"dependencies": [
"openstack_compute_servergroup_v2.sdi_geo_server_group"
]
}
]
},
{
"module": "module.instance_with_data_volume",
"mode": "managed",
"type": "openstack_compute_volume_attach_v2",
"name": "attach_volume",
"provider": "provider[\"registry.terraform.io/terraform-provider-openstack/openstack\"]",
"instances": [
{
"index_key": "geonetwork_1",
"schema_version": 0,
"attributes": {
"device": "/dev/vdb",
"id": "ce706ddc-cd05-45fc-bfff-b46839c91604/e89ec101-eab3-4291-a192-47aa2542cde7",
"instance_id": "ce706ddc-cd05-45fc-bfff-b46839c91604",
"multiattach": null,
"region": "isti_area_pi_1",
"timeouts": null,
"vendor_options": [],
"volume_id": "e89ec101-eab3-4291-a192-47aa2542cde7"
},
"sensitive_attributes": [],
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6NjAwMDAwMDAwMDAwfX0=",
"dependencies": [
"module.instance_with_data_volume.openstack_blockstorage_volume_v3.instance_data_volume",
"module.instance_with_data_volume.openstack_compute_instance_v2.instance_with_data_volume",
"openstack_compute_servergroup_v2.sdi_geo_server_group"
]
}
]
}
],
"check_results": null
}