-
Notifications
You must be signed in to change notification settings - Fork 0
/
04-pfsense-appliance.tf
74 lines (62 loc) · 2.07 KB
/
04-pfsense-appliance.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
Copyright 2023 Schwarz IT KG <markus.brunsch@mail.schwarz>
Copyright 2024 STACKIT GmbH & Co. KG <markus.brunsch@stackit.cloud>
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
# Create root Volume
resource "openstack_blockstorage_volume_v3" "fw_root_volume" {
name = "pfsense-2.7.2-root"
description = "Root Volume"
size = 16
image_id = openstack_images_image_v2.pfsense_image.id
availability_zone = var.zone
volume_type = "storage_premium_perf4"
}
# Create virtual Server
resource "openstack_compute_instance_v2" "instance_fw" {
name = "pfSense" # Server name
flavor_name = var.flavor
availability_zone = var.zone
block_device {
uuid = openstack_blockstorage_volume_v3.fw_root_volume.id
source_type = "volume"
destination_type = "volume"
boot_index = 0
delete_on_termination = true
}
network {
port = openstack_networking_port_v2.wan_port_1.id
}
network {
port = openstack_networking_port_v2.vpc_port_1.id
}
}
# Network Ports
resource "openstack_networking_port_v2" "wan_port_1" {
name = "FW WAN Port"
network_id = openstack_networking_network_v2.wan_network.id
admin_state_up = "true"
port_security_enabled = "false"
fixed_ip {
subnet_id = openstack_networking_subnet_v2.wan_subnet_1.id
}
}
resource "openstack_networking_port_v2" "vpc_port_1" {
name = "FW VPC Port"
network_id = openstack_networking_network_v2.vpc_network.id
admin_state_up = "true"
port_security_enabled = "false"
fixed_ip {
subnet_id = openstack_networking_subnet_v2.vpc_subnet_1.id
}
}
# Add FloatingIP
resource "openstack_networking_floatingip_v2" "fip" {
pool = "floating-net"
}
resource "openstack_networking_floatingip_associate_v2" "fip" {
floating_ip = openstack_networking_floatingip_v2.fip.address
port_id = openstack_networking_port_v2.wan_port_1.id
}