mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
c4fd70684f
This reverts commit 253f833f6c
.
126 lines
3.5 KiB
HCL
126 lines
3.5 KiB
HCL
terraform {
|
|
required_providers {
|
|
azurerm = {
|
|
source = "hashicorp/azurerm"
|
|
version = "3.41.0"
|
|
}
|
|
random = {
|
|
source = "hashicorp/random"
|
|
version = "3.4.3"
|
|
}
|
|
tls = {
|
|
source = "hashicorp/tls"
|
|
version = "4.0.4"
|
|
}
|
|
}
|
|
}
|
|
|
|
provider "azurerm" {
|
|
use_oidc = true
|
|
features {}
|
|
}
|
|
|
|
provider "tls" {}
|
|
|
|
resource "random_string" "suffix" {
|
|
length = 6
|
|
special = false
|
|
}
|
|
|
|
resource "tls_private_key" "ssh_key" {
|
|
algorithm = "RSA"
|
|
rsa_bits = 2048
|
|
}
|
|
|
|
data "azurerm_resource_group" "main" {
|
|
name = "e2e-miniconstellation"
|
|
}
|
|
|
|
resource "azurerm_virtual_network" "main" {
|
|
name = "e2e-mini-${random_string.suffix.result}"
|
|
address_space = ["10.0.0.0/16"]
|
|
location = data.azurerm_resource_group.main.location
|
|
resource_group_name = data.azurerm_resource_group.main.name
|
|
}
|
|
|
|
resource "azurerm_subnet" "main" {
|
|
name = "e2e-mini-${random_string.suffix.result}"
|
|
resource_group_name = data.azurerm_resource_group.main.name
|
|
virtual_network_name = azurerm_virtual_network.main.name
|
|
address_prefixes = ["10.0.2.0/24"]
|
|
}
|
|
|
|
resource "azurerm_public_ip" "main" {
|
|
name = "e2e-mini-${random_string.suffix.result}"
|
|
location = data.azurerm_resource_group.main.location
|
|
resource_group_name = data.azurerm_resource_group.main.name
|
|
allocation_method = "Static"
|
|
sku = "Standard"
|
|
}
|
|
|
|
resource "azurerm_network_interface" "main" {
|
|
name = "e2e-mini-${random_string.suffix.result}"
|
|
resource_group_name = data.azurerm_resource_group.main.name
|
|
location = data.azurerm_resource_group.main.location
|
|
|
|
ip_configuration {
|
|
name = "main"
|
|
subnet_id = azurerm_subnet.main.id
|
|
private_ip_address_allocation = "Dynamic"
|
|
public_ip_address_id = azurerm_public_ip.main.id
|
|
}
|
|
}
|
|
|
|
resource "azurerm_network_security_group" "ssh" {
|
|
name = "e2e-mini-${random_string.suffix.result}"
|
|
resource_group_name = data.azurerm_resource_group.main.name
|
|
location = data.azurerm_resource_group.main.location
|
|
|
|
security_rule {
|
|
name = "ssh"
|
|
priority = 100
|
|
direction = "Inbound"
|
|
access = "Allow"
|
|
protocol = "Tcp"
|
|
source_port_range = "*"
|
|
destination_port_range = "22"
|
|
source_address_prefix = "*"
|
|
destination_address_prefix = "*"
|
|
}
|
|
}
|
|
|
|
resource "azurerm_subnet_network_security_group_association" "ssh" {
|
|
subnet_id = azurerm_subnet.main.id
|
|
network_security_group_id = azurerm_network_security_group.ssh.id
|
|
}
|
|
|
|
resource "azurerm_linux_virtual_machine" "main" {
|
|
name = "e2e-mini-${random_string.suffix.result}"
|
|
resource_group_name = data.azurerm_resource_group.main.name
|
|
location = data.azurerm_resource_group.main.location
|
|
# Dv3-series provides nested virtualization support
|
|
# https://learn.microsoft.com/en-us/azure/virtual-machines/dv3-dsv3-series#dv3-series
|
|
size = "Standard_D8_v3"
|
|
admin_username = "adminuser"
|
|
network_interface_ids = [
|
|
azurerm_network_interface.main.id,
|
|
]
|
|
|
|
admin_ssh_key {
|
|
username = "adminuser"
|
|
public_key = tls_private_key.ssh_key.public_key_openssh
|
|
}
|
|
|
|
source_image_reference {
|
|
publisher = "Canonical"
|
|
offer = "0001-com-ubuntu-server-jammy-daily"
|
|
sku = "22_04-daily-lts"
|
|
version = "latest"
|
|
}
|
|
|
|
os_disk {
|
|
storage_account_type = "Standard_LRS"
|
|
caching = "ReadWrite"
|
|
}
|
|
}
|