resource "stackit_server" "blurring-host" { count = var.host_info.host_count project_id = var.project_id name = format("${var.host_info.name}-%02d", count.index + 1) boot_volume = { size = var.host_info.boot_image_size source_type = "image" source_id = var.host_info.image_id performance_class = var.host_info.performance_class delete_on_termination = true } machine_type = var.host_info.flavour_id availability_zone = var.host_info.availability_zone user_data = file("${path.module}/blurring_tf_vars/cloud.yml") } data "stackit_network" "network" { project_id = var.project_id network_id = var.host_info.network_id } # data "stackit_secretsmanager_instance" "server-deployment" { # project_id = var.project_id # instance_id = var.secrets_manager.id # } resource "stackit_security_group" "sec_group" { project_id = var.project_id name = "blurring-security-group" stateful = true } resource "stackit_security_group_rule" "ingress" { project_id = var.project_id security_group_id = stackit_security_group.sec_group.security_group_id direction = "ingress" ether_type = "IPv4" } resource "stackit_security_group_rule" "ssh_ingress" { for_each = toset(var.ssh_source_ips) project_id = var.project_id security_group_id = stackit_security_group.sec_group.security_group_id direction = "ingress" ether_type = "IPv4" port_range = { min = 22 max = 22 } ip_range = each.value protocol = { name = "tcp" } } resource "stackit_network_interface" "nic" { count = var.host_info.host_count project_id = var.project_id network_id = data.stackit_network.network.network_id security_group_ids = [stackit_security_group.sec_group.security_group_id] name = format("${var.host_info.name}-%02d-nic", count.index + 1) } resource "stackit_server_network_interface_attach" "nic-attachment" { count = var.host_info.host_count project_id = var.project_id server_id = stackit_server.blurring-host[count.index].server_id network_interface_id = stackit_network_interface.nic[count.index].network_interface_id depends_on = [stackit_server.blurring-host] } resource "stackit_public_ip" "public-ip" { count = var.host_info.host_count project_id = var.project_id network_interface_id = stackit_network_interface.nic[count.index].network_interface_id labels = { host = format("${lower(var.host_info.name)}-%02d-public-ip", count.index + 1) } depends_on = [stackit_security_group.sec_group] } resource "stackit_objectstorage_bucket" "blurringtool-bucket" { count = var.host_info.host_count project_id = var.project_id name = format("blurring-tool-%02d-bucket", count.index + 1) lifecycle { prevent_destroy = true } } resource "stackit_objectstorage_bucket" "blurringtool-output-bucket" { project_id = var.project_id name = "blurring-tool-output-bucket" } resource "stackit_objectstorage_credentials_group" "blurringtool-credentials-group" { project_id = var.project_id name = "blurringtool-credentials-group" } resource "stackit_objectstorage_credential" "blurringtool-credentials" { count = var.host_info.host_count project_id = var.project_id credentials_group_id = stackit_objectstorage_credentials_group.blurringtool-credentials-group.credentials_group_id } # resource "vault_kv_secret_v2" "blurring" { # count = var.host_info.host_count # mount = data.stackit_secretsmanager_instance.server-deployment.instance_id # name = var.secrets_manager.name # cas = 1 # delete_all_versions = true # data_json = jsonencode( # { # format("blurring-%02d-bucket_access-key", count.index) = stackit_objectstorage_credential.blurringtool-credentials[count.index].access_key, # format("blurring-%02d-bucket_secret-key", count.index) = stackit_objectstorage_credential.blurringtool-credentials[count.index].secret_access_key # } # ) # }