2024-04-12 08:01:51 +00:00
|
|
|
# Define required providers
|
|
|
|
terraform {
|
|
|
|
required_version = ">= 0.14.0"
|
|
|
|
required_providers {
|
|
|
|
openstack = {
|
|
|
|
source = "terraform-provider-openstack/openstack"
|
|
|
|
version = "~> 1.53.0"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Configure the OpenStack Provider
|
|
|
|
provider "openstack" {
|
|
|
|
cloud = "sto4-rut"
|
|
|
|
}
|
2024-04-23 11:45:22 +00:00
|
|
|
resource "openstack_networking_secgroup_v2" "https" {
|
2024-04-30 09:43:25 +00:00
|
|
|
name = "https"
|
2024-04-17 06:04:52 +00:00
|
|
|
description = "Traffic to allow between microk8s hosts"
|
|
|
|
}
|
2024-04-23 11:45:22 +00:00
|
|
|
resource "openstack_networking_secgroup_rule_v2" "https_rule1" {
|
2024-04-17 06:04:52 +00:00
|
|
|
direction = "ingress"
|
|
|
|
ethertype = "IPv4"
|
|
|
|
protocol = "tcp"
|
2024-04-23 11:45:22 +00:00
|
|
|
port_range_min = 443
|
|
|
|
port_range_max = 443
|
2024-04-17 13:15:59 +00:00
|
|
|
remote_ip_prefix = "0.0.0.0/0"
|
2024-04-23 11:45:22 +00:00
|
|
|
security_group_id = openstack_networking_secgroup_v2.https.id
|
2024-04-17 06:04:52 +00:00
|
|
|
}
|
2024-04-23 11:45:22 +00:00
|
|
|
resource "openstack_networking_secgroup_rule_v2" "https_rule2" {
|
2024-04-17 06:04:52 +00:00
|
|
|
direction = "ingress"
|
|
|
|
ethertype = "IPv6"
|
|
|
|
protocol = "tcp"
|
2024-04-23 11:45:22 +00:00
|
|
|
port_range_min = 443
|
|
|
|
port_range_max = 443
|
2024-04-17 13:15:59 +00:00
|
|
|
remote_ip_prefix = "::/0"
|
2024-04-23 11:45:22 +00:00
|
|
|
security_group_id = openstack_networking_secgroup_v2.https.id
|
2024-04-17 06:04:52 +00:00
|
|
|
}
|
2024-04-23 11:45:22 +00:00
|
|
|
resource "openstack_networking_secgroup_rule_v2" "https_rule3" {
|
2024-04-17 12:29:27 +00:00
|
|
|
direction = "ingress"
|
|
|
|
ethertype = "IPv4"
|
2024-04-17 13:15:59 +00:00
|
|
|
protocol = "tcp"
|
2024-04-23 11:45:22 +00:00
|
|
|
port_range_min = 80
|
|
|
|
port_range_max = 80
|
|
|
|
remote_ip_prefix = "0.0.0.0/0"
|
|
|
|
security_group_id = openstack_networking_secgroup_v2.https.id
|
2024-04-17 12:29:27 +00:00
|
|
|
}
|
2024-04-23 11:45:22 +00:00
|
|
|
resource "openstack_networking_secgroup_rule_v2" "https_rule4" {
|
2024-04-17 12:29:27 +00:00
|
|
|
direction = "ingress"
|
|
|
|
ethertype = "IPv6"
|
2024-04-17 13:15:59 +00:00
|
|
|
protocol = "tcp"
|
2024-04-23 11:45:22 +00:00
|
|
|
port_range_min = 80
|
|
|
|
port_range_max = 80
|
|
|
|
remote_ip_prefix = "::/0"
|
|
|
|
security_group_id = openstack_networking_secgroup_v2.https.id
|
2024-04-17 12:29:27 +00:00
|
|
|
}
|
2024-04-23 11:45:22 +00:00
|
|
|
resource "openstack_compute_instance_v2" "monitor-node" {
|
|
|
|
name = "monitor-1.${var.dns_suffix}"
|
|
|
|
flavor_name = "${var.monitor_instance_type}"
|
2024-04-16 08:12:45 +00:00
|
|
|
key_pair = "mifr-yubi"
|
2024-04-23 11:45:22 +00:00
|
|
|
security_groups = ["https", "Allow SSH from SUNET jumphosts",]
|
2024-04-17 08:56:22 +00:00
|
|
|
|
2024-04-16 08:12:45 +00:00
|
|
|
|
|
|
|
block_device {
|
2024-04-23 11:45:22 +00:00
|
|
|
uuid = "5d24aca9-11be-4de1-9770-4a097d68f361" #debian 12
|
2024-04-16 08:12:45 +00:00
|
|
|
source_type = "image"
|
2024-04-23 11:45:22 +00:00
|
|
|
volume_size = 200
|
2024-04-16 08:12:45 +00:00
|
|
|
boot_index = 0
|
|
|
|
destination_type = "volume"
|
2024-04-23 11:45:22 +00:00
|
|
|
delete_on_termination = false
|
2024-04-17 08:56:22 +00:00
|
|
|
}
|
2024-04-16 08:12:45 +00:00
|
|
|
network {
|
|
|
|
name = "public"
|
|
|
|
}
|
2024-04-23 11:45:22 +00:00
|
|
|
scheduler_hints {
|
|
|
|
#We want this server on another host than the controllers. We don't want to loose a controller and the monitoring at the same time.
|
|
|
|
group = openstack_compute_servergroup_v2.controllers.id
|
2024-04-12 08:01:51 +00:00
|
|
|
}
|
2024-04-30 09:43:25 +00:00
|
|
|
}
|
|
|
|
resource "openstack_compute_instance_v2" "satosa-node" {
|
|
|
|
name = "internal-sto4-test-satosa-1.${var.dns_suffix}"
|
|
|
|
flavor_name = "${var.monitor_instance_type}"
|
|
|
|
key_pair = "mifr-yubi"
|
|
|
|
security_groups = ["https", "Allow SSH from SUNET jumphosts",]
|
|
|
|
|
|
|
|
|
|
|
|
block_device {
|
|
|
|
uuid = "5d24aca9-11be-4de1-9770-4a097d68f361" #debian 12
|
|
|
|
source_type = "image"
|
|
|
|
volume_size = 20
|
|
|
|
boot_index = 0
|
|
|
|
destination_type = "volume"
|
|
|
|
delete_on_termination = false
|
|
|
|
}
|
|
|
|
network {
|
|
|
|
name = "public"
|
|
|
|
}
|
|
|
|
scheduler_hints {
|
|
|
|
#We want this server on another host than the controllers. We don't want to loose a controller and the monitoring at the same time.
|
|
|
|
group = openstack_compute_servergroup_v2.controllers.id
|
|
|
|
}
|
|
|
|
}
|