From 89b9165f582ddefb61994a1ebac18e8791e9d21f Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Tue, 5 Dec 2023 12:12:07 +0100 Subject: [PATCH] Fixed gcat terraform plan --- openstack-tf/d4s-dev/gcat/main.tf | 30 +++++-- openstack-tf/d4s-dev/gcat/terraform.tfstate | 90 +++++++++++++++++---- 2 files changed, 97 insertions(+), 23 deletions(-) diff --git a/openstack-tf/d4s-dev/gcat/main.tf b/openstack-tf/d4s-dev/gcat/main.tf index ff15b8c0..bb980e3b 100644 --- a/openstack-tf/d4s-dev/gcat/main.tf +++ b/openstack-tf/d4s-dev/gcat/main.tf @@ -17,6 +17,22 @@ data "terraform_remote_state" "privnet_dns_router" { } } +# +# Uses common_variables as module +# +module "common_variables" { + source = "../../modules/common_variables" +} + + +# +# Creates the server group "uri-resolver" +# +resource "openstack_compute_servergroup_v2" "gcat_server_group" { + name = "gcat" + policies = [module.common_variables.policy_list.soft_anti_affinity] +} + module "smartgears_service_generic" { source = "../../modules/generic_smartgears_service" @@ -25,18 +41,20 @@ module "smartgears_service_generic" { gcat_1 = { name = "gcat-1", description = "This instance serves gcat service", - flavor = "m1.medium", + flavor = module.common_variables.flavor_list.m1_medium, networks = ["d4s-dev-cloud-main"], - security_groups = ["default", "http and https from the load balancers"] - block_device_uuid = "7ed6a2cd-2b07-482e-8ce4-f018dff16c89" #ubuntu_18_04.uuid of DEV + 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.gcat_server_group.id], + image_ref = module.common_variables.ubuntu_1804 }, gcat_2 = { name = "gcat-2", description = "This instance serves gcat service", - flavor = "m1.medium", + flavor = module.common_variables.flavor_list.m1_medium, networks = ["d4s-dev-cloud-main"], - security_groups = ["default", "http and https from the load balancers"] - block_device_uuid = "7ed6a2cd-2b07-482e-8ce4-f018dff16c89" #ubuntu_18_04.uuid of DEV + 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.gcat_server_group.id], + image_ref = module.common_variables.ubuntu_1804 } } } diff --git a/openstack-tf/d4s-dev/gcat/terraform.tfstate b/openstack-tf/d4s-dev/gcat/terraform.tfstate index bc60d6f0..89402e19 100644 --- a/openstack-tf/d4s-dev/gcat/terraform.tfstate +++ b/openstack-tf/d4s-dev/gcat/terraform.tfstate @@ -1,7 +1,7 @@ { "version": 4, "terraform_version": "1.6.4", - "serial": 3, + "serial": 9, "lineage": "8a740e95-13ce-029b-b372-f1b423772e3f", "outputs": {}, "resources": [ @@ -50,6 +50,34 @@ } ] }, + { + "mode": "managed", + "type": "openstack_compute_servergroup_v2", + "name": "gcat_server_group", + "provider": "provider[\"registry.terraform.io/terraform-provider-openstack/openstack\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "id": "f580e6ef-93ec-4926-b7fb-6db6fc7160a5", + "members": [], + "name": "gcat", + "policies": [ + "soft-anti-affinity" + ], + "region": "isti_area_pi_1", + "rules": [ + { + "max_server_per_host": 0 + } + ], + "value_specs": null + }, + "sensitive_attributes": [], + "private": "bnVsbA==" + } + ] + }, { "module": "module.smartgears_service_generic", "mode": "managed", @@ -61,7 +89,7 @@ "index_key": "gcat_1", "schema_version": 0, "attributes": { - "access_ip_v4": "10.1.31.228", + "access_ip_v4": "10.1.31.87", "access_ip_v6": "", "admin_pass": null, "all_metadata": {}, @@ -84,12 +112,12 @@ } ], "config_drive": null, - "created": "2023-12-04 16:02:03 +0000 UTC", + "created": "2023-12-05 11:09:51 +0000 UTC", "flavor_id": "4", "flavor_name": "m1.medium", "floating_ip": null, "force_delete": false, - "id": "b3b38ab3-3efa-4c38-a1f9-ffb616b6f6d9", + "id": "d92bed2c-cca3-4681-8a40-d01a639ff6f3", "image_id": "Attempt to boot from volume - no image supplied", "image_name": null, "key_pair": "pc-frosini_key", @@ -98,10 +126,10 @@ "network": [ { "access_network": false, - "fixed_ip_v4": "10.1.31.228", + "fixed_ip_v4": "10.1.31.87", "fixed_ip_v6": "", "floating_ip": "", - "mac": "fa:16:3e:bd:10:bd", + "mac": "fa:16:3e:a1:e7:ee", "name": "d4s-dev-cloud-main", "port": "", "uuid": "e0af5eba-f24a-4d0d-8184-bc654b980c4a" @@ -111,7 +139,18 @@ "personality": [], "power_state": "active", "region": "isti_area_pi_1", - "scheduler_hints": [], + "scheduler_hints": [ + { + "additional_properties": null, + "build_near_host_ip": "", + "different_cell": [], + "different_host": [], + "group": "f580e6ef-93ec-4926-b7fb-6db6fc7160a5", + "query": [], + "same_host": [], + "target_cell": "" + } + ], "security_groups": [ "default", "http and https from the load balancers" @@ -119,19 +158,22 @@ "stop_before_destroy": false, "tags": null, "timeouts": null, - "updated": "2023-12-04 16:05:31 +0000 UTC", + "updated": "2023-12-05 11:10:49 +0000 UTC", "user_data": "47d4769e61324c305c4b70ed6673de4fad84150d", "vendor_options": [], "volume": [] }, "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxODAwMDAwMDAwMDAwLCJkZWxldGUiOjE4MDAwMDAwMDAwMDAsInVwZGF0ZSI6MTgwMDAwMDAwMDAwMH19" + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxODAwMDAwMDAwMDAwLCJkZWxldGUiOjE4MDAwMDAwMDAwMDAsInVwZGF0ZSI6MTgwMDAwMDAwMDAwMH19", + "dependencies": [ + "openstack_compute_servergroup_v2.gcat_server_group" + ] }, { "index_key": "gcat_2", "schema_version": 0, "attributes": { - "access_ip_v4": "10.1.28.108", + "access_ip_v4": "10.1.29.12", "access_ip_v6": "", "admin_pass": null, "all_metadata": {}, @@ -154,12 +196,12 @@ } ], "config_drive": null, - "created": "2023-12-04 16:02:03 +0000 UTC", + "created": "2023-12-05 11:09:51 +0000 UTC", "flavor_id": "4", "flavor_name": "m1.medium", "floating_ip": null, "force_delete": false, - "id": "0aa5726b-f6cc-4127-8216-34cdbc679b5f", + "id": "3cdfe9a1-61c4-4c3e-8f8e-5af2fa2e6f3d", "image_id": "Attempt to boot from volume - no image supplied", "image_name": null, "key_pair": "pc-frosini_key", @@ -168,10 +210,10 @@ "network": [ { "access_network": false, - "fixed_ip_v4": "10.1.28.108", + "fixed_ip_v4": "10.1.29.12", "fixed_ip_v6": "", "floating_ip": "", - "mac": "fa:16:3e:33:94:ce", + "mac": "fa:16:3e:4e:14:19", "name": "d4s-dev-cloud-main", "port": "", "uuid": "e0af5eba-f24a-4d0d-8184-bc654b980c4a" @@ -181,7 +223,18 @@ "personality": [], "power_state": "active", "region": "isti_area_pi_1", - "scheduler_hints": [], + "scheduler_hints": [ + { + "additional_properties": null, + "build_near_host_ip": "", + "different_cell": [], + "different_host": [], + "group": "f580e6ef-93ec-4926-b7fb-6db6fc7160a5", + "query": [], + "same_host": [], + "target_cell": "" + } + ], "security_groups": [ "default", "http and https from the load balancers" @@ -189,13 +242,16 @@ "stop_before_destroy": false, "tags": null, "timeouts": null, - "updated": "2023-12-04 16:03:23 +0000 UTC", + "updated": "2023-12-05 11:10:25 +0000 UTC", "user_data": "47d4769e61324c305c4b70ed6673de4fad84150d", "vendor_options": [], "volume": [] }, "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxODAwMDAwMDAwMDAwLCJkZWxldGUiOjE4MDAwMDAwMDAwMDAsInVwZGF0ZSI6MTgwMDAwMDAwMDAwMH19" + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxODAwMDAwMDAwMDAwLCJkZWxldGUiOjE4MDAwMDAwMDAwMDAsInVwZGF0ZSI6MTgwMDAwMDAwMDAwMH19", + "dependencies": [ + "openstack_compute_servergroup_v2.gcat_server_group" + ] } ] }