Skip to content

Commit

Permalink
hotfix(CLOUDDEV-1003): fix-example-instanceV2
Browse files Browse the repository at this point in the history
  • Loading branch information
George Demin committed Oct 31, 2024
1 parent e862029 commit a7ff03f
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 14 deletions.
30 changes: 25 additions & 5 deletions docs/resources/instanceV2.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,19 @@ resource "edgecenter_subnet" "subnet" {
project_id = 1
}
data "edgecenter_image" "ubuntu" {
name = "ubuntu-20.04"
region_id = 1
project_id = 1
}
resource "edgecenter_volume" "first_volume" {
name = "boot volume"
type_name = "ssd_hiiops"
size = 5
image_id = "f4ce3d30-e29c-4cfd-811f-46f383b6081f"
region_id = 1
project_id = 1
image_id = data.edgecenter_image.ubuntu.id
}
resource "edgecenter_volume" "second_volume" {
Expand All @@ -57,6 +63,19 @@ resource "edgecenter_volume" "second_volume" {
project_id = 1
}
resource "edgecenter_securitygroup" "sg" {
name = "example_security_group"
region_id = 1
project_id = 1
security_group_rules {
direction = "egress"
ethertype = "IPv4"
protocol = "tcp"
port_range_min = 19990
port_range_max = 19990
}
}
resource "edgecenter_instanceV2" "instance" {
flavor_id = "g1-standard-2-4"
name = "test"
Expand All @@ -77,7 +96,7 @@ resource "edgecenter_instanceV2" "instance" {
subnet_id = edgecenter_subnet.subnet.id
}
metadata_map = {
metadata = {
some_key = "some_value"
stage = "dev"
}
Expand All @@ -92,10 +111,11 @@ resource "edgecenter_instanceV2" "instance" {
}
resource "edgecenter_instance_port_security" "port_security" {
port_id = [for iface in edgecenter_instanceV2.instance.interfaces : iface.port_id if iface.subnet_id == edgecenter_subnet.subnet1.id][0]
for_each = { for iface in edgecenter_instanceV2.instance.interfaces : iface.port_id => iface if iface.subnet_id == edgecenter_subnet.subnet.id }
port_id = each.key
instance_id = edgecenter_instanceV2.instance.id
region_id = var.region_id
project_id = var.project_id
region_id = 1
project_id = 1
port_security_disabled = false
security_groups {
overwrite_existing = true
Expand Down
35 changes: 26 additions & 9 deletions examples/resources/edgecenter_instanceV2/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,19 @@ resource "edgecenter_subnet" "subnet" {
project_id = 1
}

data "edgecenter_image" "ubuntu" {
name = "ubuntu-20.04"
region_id = 1
project_id = 1
}

resource "edgecenter_volume" "first_volume" {
name = "boot volume"
type_name = "ssd_hiiops"
size = 5
image_id = "f4ce3d30-e29c-4cfd-811f-46f383b6081f"
region_id = 1
project_id = 1
image_id = data.edgecenter_image.ubuntu.id
}

resource "edgecenter_volume" "second_volume" {
Expand All @@ -42,6 +48,19 @@ resource "edgecenter_volume" "second_volume" {
project_id = 1
}

resource "edgecenter_securitygroup" "sg" {
name = "example_security_group"
region_id = 1
project_id = 1
security_group_rules {
direction = "egress"
ethertype = "IPv4"
protocol = "tcp"
port_range_min = 19990
port_range_max = 19990
}
}

resource "edgecenter_instanceV2" "instance" {
flavor_id = "g1-standard-2-4"
name = "test"
Expand All @@ -62,7 +81,7 @@ resource "edgecenter_instanceV2" "instance" {
subnet_id = edgecenter_subnet.subnet.id
}

metadata_map = {
metadata = {
some_key = "some_value"
stage = "dev"
}
Expand All @@ -77,16 +96,14 @@ resource "edgecenter_instanceV2" "instance" {
}

resource "edgecenter_instance_port_security" "port_security" {
port_id = [for iface in edgecenter_instanceV2.instance.interfaces : iface.port_id if iface.subnet_id == edgecenter_subnet.subnet1.id][0]
for_each = { for iface in edgecenter_instanceV2.instance.interfaces : iface.port_id => iface if iface.subnet_id == edgecenter_subnet.subnet.id }
port_id = each.key
instance_id = edgecenter_instanceV2.instance.id
region_id = var.region_id
project_id = var.project_id
region_id = 1
project_id = 1
port_security_disabled = false
security_groups {
overwrite_existing = true
security_group_ids = [edgecenter_securitygroup.sg.id]
}
}



}

0 comments on commit a7ff03f

Please sign in to comment.