Skip to content

Commit

Permalink
Make Nextcloud Office use the simple_vm module
Browse files Browse the repository at this point in the history
  • Loading branch information
strugee committed Mar 13, 2024
1 parent 74ebe90 commit 0a81e06
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 57 deletions.
30 changes: 30 additions & 0 deletions moved.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,33 @@ moved {
from = openstack_compute_instance_v2.mailu
to = module.mailu-vm.openstack_compute_instance_v2.instance
}
moved {
from = openstack_networking_secgroup_v2.nc-office
to = module.nc-office-vm.openstack_networking_secgroup_v2.main-sg
}

moved {
from = openstack_networking_secgroup_rule_v2.nc-office-ipv4-egress
to = module.nc-office-vm.openstack_networking_secgroup_rule_v2.ipv4-egress
}

moved {
from = openstack_networking_secgroup_rule_v2.nc-office-ipv6-egress
to = module.nc-office-vm.openstack_networking_secgroup_rule_v2.ipv6-egress
}

moved {
from = openstack_networking_secgroup_rule_v2.nc-office-icmp4-ingress
to = module.nc-office-vm.openstack_networking_secgroup_rule_v2.icmp4-ingress
}

moved {
from = openstack_networking_secgroup_rule_v2.nc-office-tcp4-ingress
to = module.nc-office-vm.openstack_networking_secgroup_rule_v2.tcp4-ingress
}

moved {
from = openstack_compute_instance_v2.nc-office
to = module.nc-office-vm.openstack_compute_instance_v2.instance
}

64 changes: 7 additions & 57 deletions nextcloud-office.tf
Original file line number Diff line number Diff line change
@@ -1,58 +1,8 @@
resource "openstack_networking_secgroup_v2" "nc-office" {
name = "nc-office"
delete_default_rules = true
}

resource "openstack_networking_secgroup_rule_v2" "nc-office-ipv4-egress" {
direction = "egress"
ethertype = "IPv4"
remote_ip_prefix = "0.0.0.0/0"
security_group_id = openstack_networking_secgroup_v2.nc-office.id
}

resource "openstack_networking_secgroup_rule_v2" "nc-office-ipv6-egress" {
direction = "egress"
ethertype = "IPv6"
remote_ip_prefix = "::/0"
security_group_id = openstack_networking_secgroup_v2.nc-office.id
}

resource "openstack_networking_secgroup_rule_v2" "nc-office-icmp4-ingress" {
direction = "ingress"
ethertype = "IPv4"
protocol = "icmp"
remote_ip_prefix = "0.0.0.0/0"
security_group_id = openstack_networking_secgroup_v2.nc-office.id
}

resource "openstack_networking_secgroup_rule_v2" "nc-office-tcp4-ingress" {
for_each = toset(["22", "80", "443"])
direction = "ingress"
ethertype = "IPv4"
protocol = "tcp"
port_range_min = each.value
port_range_max = each.value
remote_ip_prefix = "0.0.0.0/0"
security_group_id = openstack_networking_secgroup_v2.nc-office.id
}

resource "openstack_compute_instance_v2" "nc-office" {
name = "nc-office"
flavor_name = "m1.small"
key_pair = "AJ OpenStack bootstrap" # TODO lol
security_groups = [
openstack_networking_secgroup_v2.nc-office.name
]

block_device {
source_type = "image"
destination_type = "volume"
uuid = "5e7b09b5-03f1-4f01-bc1b-41db2e1b09d1" # Ubuntu 22.04
volume_size = 15
delete_on_termination = true
}

network {
name = "general_servers2"
}
module "nc-office-vm" {
source = "./simple_vm"
name = "nc-office"
ports = [22, 80, 443]
instance_type = "m1.small"
network = "general_servers2"
disk_size = 15
}

0 comments on commit 0a81e06

Please sign in to comment.