Skip to content

Instantly share code, notes, and snippets.

@Sam7
Created August 20, 2022 02:54
Show Gist options
  • Save Sam7/7256688e8c6c5881b23bd535e04d1bfb to your computer and use it in GitHub Desktop.
Save Sam7/7256688e8c6c5881b23bd535e04d1bfb to your computer and use it in GitHub Desktop.
provider "azurerm" {
features {}
}
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "3.19.0"
}
}
}
resource "azurerm_resource_group" "minecraft" {
name = "MinecraftContainer"
location = "Australia East"
}
resource "azurerm_storage_account" "minecraft" {
name = "minecraftvolumes"
resource_group_name = azurerm_resource_group.minecraft.name
location = azurerm_resource_group.minecraft.location
account_tier = "Standard"
account_replication_type = "GRS"
}
resource "azurerm_storage_share" "minecraft" {
name = "minecraft"
storage_account_name = azurerm_storage_account.minecraft.name
quota = 100
}
resource "azurerm_container_group" "minecraft" {
name = "minecraft"
location = azurerm_resource_group.minecraft.location
resource_group_name = azurerm_resource_group.minecraft.name
ip_address_type = "Public"
dns_name_label = "minecraft-geyser"
os_type = "Linux"
restart_policy = "Never"
container {
name = "legendary-minecraft-geyser-floodgate"
image = "05jchambers/legendary-minecraft-geyser-floodgate:latest"
cpu = "1.0"
memory = "1.5"
# Main minecraft port
ports {
port = 25565
protocol = "TCP"
}
ports {
port = 19132
protocol = "UDP"
}
ports {
port = 19133
protocol = "TCP"
}
volume {
name = "minecraft"
mount_path = "/minecraft"
storage_account_name = azurerm_storage_account.minecraft.name
storage_account_key = azurerm_storage_account.minecraft.primary_access_key
share_name = azurerm_storage_share.minecraft.name
}
environment_variables = {
JAVA_MEMORY="1G",
}
}
}
output "fqdn" {
value = azurerm_container_group.minecraft.fqdn
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment