60 lines
No EOL
1.7 KiB
HCL
60 lines
No EOL
1.7 KiB
HCL
provider "stackit" {
|
|
region = var.stackit_region
|
|
service_account_key_path = var.stackit_service_account_key_path
|
|
}
|
|
|
|
resource "stackit_key_pair" "example_keypair" {
|
|
name = "example-keypair"
|
|
public_key = chomp(file("~/.ssh/id_rsa.pub"))
|
|
}
|
|
|
|
resource "stackit_volume" "example_volume" {
|
|
project_id = var.stackit_project_id
|
|
size = 72
|
|
source = {
|
|
type = "image"
|
|
// ubuntu 24.04
|
|
id = "a2c127b2-b1b5-4aee-986f-41cd11b41279"
|
|
}
|
|
performance_class = "storage_premium_perf12"
|
|
name = "example-volume"
|
|
availability_zone = "eu01-m"
|
|
}
|
|
|
|
resource "stackit_network_interface" "example_nic" {
|
|
project_id = var.stackit_project_id
|
|
network_id = stackit_network.example_network.network_id
|
|
security = false
|
|
}
|
|
|
|
resource "stackit_server" "example_server" {
|
|
project_id = var.stackit_project_id
|
|
name = "example-server"
|
|
boot_volume = {
|
|
source_type = "volume"
|
|
source_id = stackit_volume.example_volume.volume_id
|
|
}
|
|
availability_zone = "eu01-m"
|
|
// change on the machine type does not affect the underlying volume
|
|
machine_type = "g1.4"
|
|
keypair_name = stackit_key_pair.example_keypair.name
|
|
network_interfaces = [
|
|
stackit_network_interface.example_nic.network_interface_id
|
|
]
|
|
}
|
|
|
|
resource "stackit_network" "example_network" {
|
|
project_id = var.stackit_project_id
|
|
name = "example-network"
|
|
ipv4_prefix_length = 24
|
|
ipv4_nameservers = ["1.1.1.1", "8.8.8.8"]
|
|
}
|
|
|
|
resource "stackit_public_ip" "example_public_ip" {
|
|
project_id = var.stackit_project_id
|
|
network_interface_id = stackit_network_interface.example_nic.network_interface_id
|
|
}
|
|
|
|
output "public_ip" {
|
|
value = stackit_public_ip.example_public_ip.ip
|
|
} |