81 lines
2.0 KiB
HCL
81 lines
2.0 KiB
HCL
resource "random_pet" "rg_name" {
|
|
prefix = var.resource_group_name_prefix
|
|
}
|
|
|
|
resource "azurerm_resource_group" "rg" {
|
|
location = var.resource_group_location
|
|
name = random_pet.rg_name.id
|
|
}
|
|
|
|
resource "random_string" "storage_account_name" {
|
|
length = 8
|
|
lower = true
|
|
numeric = false
|
|
special = false
|
|
upper = false
|
|
}
|
|
|
|
resource "azurerm_storage_account" "example" {
|
|
name = random_string.storage_account_name.result
|
|
resource_group_name = azurerm_resource_group.rg.name
|
|
location = azurerm_resource_group.rg.location
|
|
account_tier = "Standard"
|
|
account_replication_type = "LRS"
|
|
}
|
|
|
|
resource "random_string" "storage_share_name" {
|
|
length = 8
|
|
lower = true
|
|
numeric = false
|
|
special = false
|
|
upper = false
|
|
}
|
|
|
|
resource "azurerm_storage_share" "example" {
|
|
name = random_string.storage_share_name.result
|
|
storage_account_name = azurerm_storage_account.example.name
|
|
quota = 50
|
|
}
|
|
|
|
resource "random_string" "container_group_name" {
|
|
length = 8
|
|
lower = true
|
|
numeric = false
|
|
special = false
|
|
upper = false
|
|
}
|
|
|
|
resource "azurerm_container_group" "example" {
|
|
name = random_string.container_group_name.result
|
|
location = azurerm_resource_group.rg.location
|
|
resource_group_name = azurerm_resource_group.rg.name
|
|
ip_address_type = "Public"
|
|
dns_name_label = random_string.container_group_name.result
|
|
os_type = "Linux"
|
|
|
|
container {
|
|
name = "webserver"
|
|
image = "seanmckenna/aci-hellofiles"
|
|
cpu = "1"
|
|
memory = "1.5"
|
|
|
|
ports {
|
|
port = 80
|
|
protocol = "TCP"
|
|
}
|
|
|
|
volume {
|
|
name = "logs"
|
|
mount_path = "/aci/logs"
|
|
read_only = false
|
|
share_name = azurerm_storage_share.example.name
|
|
|
|
storage_account_name = azurerm_storage_account.example.name
|
|
storage_account_key = azurerm_storage_account.example.primary_access_key
|
|
}
|
|
}
|
|
|
|
tags = {
|
|
environment = "testing"
|
|
}
|
|
} |