From 890eec214c0acc960e01ed49d8330b7e576f22f7 Mon Sep 17 00:00:00 2001 From: Vanaraj C Date: Wed, 9 Feb 2022 11:10:48 +0530 Subject: [PATCH] Network create issue fixed --- examples/instance/main.tf | 14 +- examples/instance/terraform.tfstate.backup | 271 ++++++++++++++++++--- network/network_utils.go | 2 +- terraform-provider-stackbill | Bin 19694390 -> 19694390 bytes 4 files changed, 242 insertions(+), 45 deletions(-) diff --git a/examples/instance/main.tf b/examples/instance/main.tf index c9f816b..6dc4d0b 100644 --- a/examples/instance/main.tf +++ b/examples/instance/main.tf @@ -20,13 +20,13 @@ variable "coffee_name" { # zone_uuid = "74b12720-73ce-49b6-857f-48cdac6dcd3f" # } -# resource "stackbill_network" "my-server" { -# description = "terraform test" -# name = "terraform volume teo" -# network_offering_uuid = "19c28a5d-0237-450d-b47a-dbddc67aa0df" -# virtual_machine_uuid = "4d9150e6-64b5-451a-8851-0a4ea5142242" -# zone_uuid = "74b12720-73ce-49b6-857f-48cdac6dcd3f" -# } +resource "stackbill_network" "my-server" { + description = "terraform test" + name = "terraform volume teo" + network_offering_uuid = "19c28a5d-0237-450d-b47a-dbddc67aa0df" + virtual_machine_uuid = "4d9150e6-64b5-451a-8851-0a4ea5142242" + zone_uuid = "74b12720-73ce-49b6-857f-48cdac6dcd3f" +} # resource "stackbill_network_attach" "my-server" { # network_uuid = "80934451-21e7-4bb3-be39-30a8d14db2ac" # virutal_machine_uuid = "4d9150e6-64b5-451a-8851-0a4ea5142242" diff --git a/examples/instance/terraform.tfstate.backup b/examples/instance/terraform.tfstate.backup index 4ef9ef9..c281e10 100644 --- a/examples/instance/terraform.tfstate.backup +++ b/examples/instance/terraform.tfstate.backup @@ -1,53 +1,250 @@ { "version": 4, "terraform_version": "1.1.2", - "serial": 12, - "lineage": "d9c29c08-714c-63de-e94e-dae5a10a4f7f", - "outputs": {}, - "resources": [ - { - "mode": "managed", - "type": "stackbill_instance", - "name": "my-server", - "provider": "provider[\"stackbill.com/assistanz/stackbill\"]", - "instances": [ + "serial": 1, + "lineage": "5d5f0756-7a3e-5ba9-0bd5-7962d49c7bf9", + "outputs": { + "stackbill_security_group_list": { + "value": [ { - "schema_version": 0, - "attributes": { - "compute_offering_uuid": "2f7b1b02-078f-42fb-aece-aa21bfa89e1a", - "cpu_core": "3", - "disk_size": null, - "hypervisor_name": "string", - "id": "d7d17107-7ec9-4224-becc-dc7e09f8d9c9", - "memory": null, - "name": "AzTestingVmFour", - "network_uuid": "0c7cc302-abe5-4687-8351-26aba55b3d0d", - "security_group_name": null, - "ssh_key_name": null, - "storage_offering_uuid": null, - "template_uuid": "e39172b4-715b-44ac-ada2-7f97f733eecc", - "zone_uuid": "74b12720-73ce-49b6-857f-48cdac6dcd3f" - }, - "sensitive_attributes": [], - "private": "bnVsbA==" + "description": "Test Security Group", + "is_active": true, + "name": "Test Security Group", + "security_group_egress_rule": [ + { + "cidr_list": "", + "end_port": "3434", + "icmp_code": "", + "icmp_type": "", + "id": 13, + "is_active": true, + "protocol": "tcp", + "security_group_uuid": "a860fad9-d1d2-4394-883d-07d8a209a78b", + "start_port": "2323" + } + ], + "security_group_firewall_rule": [], + "security_group_port_forwarding": [], + "status": "ENABLED", + "uuid": "a860fad9-d1d2-4394-883d-07d8a209a78b" + }, + { + "description": "", + "is_active": true, + "name": "Mat-Public", + "security_group_egress_rule": [ + { + "cidr_list": "", + "end_port": "80", + "icmp_code": "", + "icmp_type": "", + "id": 53, + "is_active": true, + "protocol": "tcp", + "security_group_uuid": "c0bb95be-25e5-4ec1-b0e6-79b5fbfb527f", + "start_port": "80" + }, + { + "cidr_list": "", + "end_port": "99", + "icmp_code": "", + "icmp_type": "", + "id": 74, + "is_active": true, + "protocol": "tcp", + "security_group_uuid": "c0bb95be-25e5-4ec1-b0e6-79b5fbfb527f", + "start_port": "99" + } + ], + "security_group_firewall_rule": [ + { + "cidr_list": "0.0.0.0/0", + "end_port": "80", + "icmp_code": "", + "icmp_type": "", + "id": 36, + "is_active": true, + "protocol": "tcp", + "security_group_uuid": "c0bb95be-25e5-4ec1-b0e6-79b5fbfb527f", + "start_port": "80" + } + ], + "security_group_port_forwarding": [ + { + "id": 32, + "is_active": true, + "private_end_port": "80", + "private_start_port": "80", + "protocol_type": "tcp", + "public_end_port": "80", + "public_start_port": "80", + "security_group_uuuid": "c0bb95be-25e5-4ec1-b0e6-79b5fbfb527f" + } + ], + "status": "ENABLED", + "uuid": "c0bb95be-25e5-4ec1-b0e6-79b5fbfb527f" } + ], + "type": [ + "list", + [ + "object", + { + "description": "string", + "is_active": "bool", + "name": "string", + "security_group_egress_rule": [ + "list", + [ + "object", + { + "cidr_list": "string", + "end_port": "string", + "icmp_code": "string", + "icmp_type": "string", + "id": "number", + "is_active": "bool", + "protocol": "string", + "security_group_uuid": "string", + "start_port": "string" + } + ] + ], + "security_group_firewall_rule": [ + "list", + [ + "object", + { + "cidr_list": "string", + "end_port": "string", + "icmp_code": "string", + "icmp_type": "string", + "id": "number", + "is_active": "bool", + "protocol": "string", + "security_group_uuid": "string", + "start_port": "string" + } + ] + ], + "security_group_port_forwarding": [ + "list", + [ + "object", + { + "id": "number", + "is_active": "bool", + "private_end_port": "string", + "private_start_port": "string", + "protocol_type": "string", + "public_end_port": "string", + "public_start_port": "string", + "security_group_uuuid": "string" + } + ] + ], + "status": "string", + "uuid": "string" + } + ] ] - }, + } + }, + "resources": [ { - "mode": "managed", - "type": "stackbill_instance_actions", - "name": "actions", + "mode": "data", + "type": "stackbill_security_group_list", + "name": "all", "provider": "provider[\"stackbill.com/assistanz/stackbill\"]", "instances": [ { "schema_version": 0, "attributes": { - "action": "Stop", - "id": "d7d17107-7ec9-4224-becc-dc7e09f8d9c9", - "uuid": "d7d17107-7ec9-4224-becc-dc7e09f8d9c9" + "id": "1644384821", + "length": 2, + "securitygroups": [ + { + "description": "Test Security Group", + "is_active": true, + "name": "Test Security Group", + "security_group_egress_rule": [ + { + "cidr_list": "", + "end_port": "3434", + "icmp_code": "", + "icmp_type": "", + "id": 13, + "is_active": true, + "protocol": "tcp", + "security_group_uuid": "a860fad9-d1d2-4394-883d-07d8a209a78b", + "start_port": "2323" + } + ], + "security_group_firewall_rule": [], + "security_group_port_forwarding": [], + "status": "ENABLED", + "uuid": "a860fad9-d1d2-4394-883d-07d8a209a78b" + }, + { + "description": "", + "is_active": true, + "name": "Mat-Public", + "security_group_egress_rule": [ + { + "cidr_list": "", + "end_port": "80", + "icmp_code": "", + "icmp_type": "", + "id": 53, + "is_active": true, + "protocol": "tcp", + "security_group_uuid": "c0bb95be-25e5-4ec1-b0e6-79b5fbfb527f", + "start_port": "80" + }, + { + "cidr_list": "", + "end_port": "99", + "icmp_code": "", + "icmp_type": "", + "id": 74, + "is_active": true, + "protocol": "tcp", + "security_group_uuid": "c0bb95be-25e5-4ec1-b0e6-79b5fbfb527f", + "start_port": "99" + } + ], + "security_group_firewall_rule": [ + { + "cidr_list": "0.0.0.0/0", + "end_port": "80", + "icmp_code": "", + "icmp_type": "", + "id": 36, + "is_active": true, + "protocol": "tcp", + "security_group_uuid": "c0bb95be-25e5-4ec1-b0e6-79b5fbfb527f", + "start_port": "80" + } + ], + "security_group_port_forwarding": [ + { + "id": 32, + "is_active": true, + "private_end_port": "80", + "private_start_port": "80", + "protocol_type": "tcp", + "public_end_port": "80", + "public_start_port": "80", + "security_group_uuuid": "c0bb95be-25e5-4ec1-b0e6-79b5fbfb527f" + } + ], + "status": "ENABLED", + "uuid": "c0bb95be-25e5-4ec1-b0e6-79b5fbfb527f" + } + ], + "uuid": null }, - "sensitive_attributes": [], - "private": "bnVsbA==" + "sensitive_attributes": [] } ] } diff --git a/network/network_utils.go b/network/network_utils.go index 225632c..09b54b9 100644 --- a/network/network_utils.go +++ b/network/network_utils.go @@ -38,7 +38,7 @@ func (nt *networkUtils) GetCreateNetworkRequest(d *schema.ResourceData) map[stri func (nt *networkUtils) GetCreateNetworkOptionalRequest(d *schema.ResourceData) map[string]interface{} { request := make(map[string]interface{}) request["isPublic"] = d.Get("is_public").(bool) - request["networkOfferingUuid"] = d.Get("security_group_id").(string) + request["securityGroupId"] = d.Get("security_group_id").(string) return request } diff --git a/terraform-provider-stackbill b/terraform-provider-stackbill index f483c3b3b0046e1a7f40e170542f42acb06f655e..b629eea4aef51035afc0b32dc1ee8e1d79b17775 100755 GIT binary patch delta 1319 zcmWm5S3nH_7(ihS?Yixv(%wasn@yCIgeYWI6j>>XY*7eB_8u9TS13C>d+!ylz4u<{ zfB4SZDa$R@FN3O3VHqD69O0jqoDx(&Avz*5AT%-~)4!-#;cJ;ZC}wbCx-vB>J1a3F zEIc80NXWn(wIWZg(10eippEL#fiCo*4+9v&2*xmhyrwXNIV@laD_Fw@wy1%cu!B7u zPz#Q5f-_v;3OBgJ1D^1LH+L37hQ4fI#LVYL^j0R|kMre#CXo_ZNjur?( zOSD30xmpoc>7i3q5?HN5k*89Ip*6zM1`&uvTSTE9qR}25&=E1{gwBXX9J-(@x*;Cj z(E~lv3%$_?2}nc|`l26_k%ImhfK&{`APmM33`H7-AsrbQjuFU27Di$evN0NCFc#x5 z9uqJTlaPbSn1Wp7VJfC!I`T0CGcgMVD8y{cK@sL+9_C{K7Ge<=V+odG8J1%OR$>)a zV-1S27VEGc8&HCc*o4j4g00vF6}F=kJFpYGP=<2s#vbg&KJ3Q<97F{U;V_QiD30Mc zPM{JeaSEq#24`^&=WziSaS4}k1y^wm*Kq?kaSOL`2X}D~_fdrhc!)<(<1wD#DW2gu zUf?BO;WggiE#BchKHwuh;WNJAE56}7e&8p5;Wz%^FaG7Llo|z)XiBss+LG!L9f__) zPogg|kQhpgB*qdGi9%v3F_V}}EF_i^D~YwlMq(?eA*m^`lh{ifB()@t5+{kX#6{vN bag(@9JS3hHFNwFrN8+ndp;G#3{8 ze(&2W$tyN0fqIrgnI2m&EG;@QJtHn8GBrJ>LwsORa$%9ePpOKDPRI<+PDx6LN{r45 z$c_pL&&ky&@-+%AXhR3O(1ShL3qSZH05wqyfe1ov1fvc@ph8`Qq8{p_0UDwa8lwrCq8XZ_ z1;R=-itutT{mP2qDrHvrYE?K|q7_=B4cej|A`pr8=zxxhLNq!d2C;}kXLLb463`Xh z&>cO{6TQ$IiRgpA=!YaEBL)320I5jBK%`?324e^^FciZu9GS>MHbx)^BQXl2F$QBX z4&yNaxtNGa$U{CRV+y9C0MjrXGcXggFdK7Fh`E@D`B;F3ScJt`f~8o79UcX*Ev_=r#Vj4$|#Z}^TM_=#WmjX(H{e+6ol)=WsWB{~vaiJnAXVjwY; z7)gvJCK6MLnWU;jAu*R&NGv5*5~ajiVk5DY*h%aq4iZO6HHnj?y2M%HB5{?tN!%qK a5>JVjq=v*>;v?~u_-U1?RsLFe5&r?6@=%HZ