-
Notifications
You must be signed in to change notification settings - Fork 513
Expand file tree
/
Copy pathmain.tf
More file actions
63 lines (54 loc) · 1.76 KB
/
main.tf
File metadata and controls
63 lines (54 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
resource "random_id" "prefix" {
byte_length = 8
}
resource "azurerm_resource_group" "main" {
count = var.create_resource_group ? 1 : 0
location = var.location
name = coalesce(var.resource_group_name, "${random_id.prefix.hex}-rg")
}
locals {
resource_group = {
name = var.create_resource_group ? azurerm_resource_group.main[0].name : var.resource_group_name
location = var.location
}
}
resource "azurerm_virtual_network" "test" {
address_space = ["10.52.0.0/16"]
location = local.resource_group.location
name = "${random_id.prefix.hex}-vn"
resource_group_name = local.resource_group.name
}
resource "azurerm_subnet" "test" {
address_prefixes = ["10.52.0.0/24"]
name = "${random_id.prefix.hex}-sn"
resource_group_name = local.resource_group.name
virtual_network_name = azurerm_virtual_network.test.name
}
resource "random_string" "acr_suffix" {
length = 8
numeric = true
special = false
upper = false
}
resource "azurerm_container_registry" "example" {
location = local.resource_group.location
name = "aksacrtest${random_string.acr_suffix.result}"
resource_group_name = local.resource_group.name
sku = "Premium"
}
module "aks" {
source = "../.."
prefix = "prefix-${random_id.prefix.hex}"
resource_group_name = local.resource_group.name
kubernetes_version = "1.30" # don't specify the patch version!
automatic_channel_upgrade = "patch"
attached_acr_id_map = {
example = azurerm_container_registry.example.id
}
network_plugin = "azure"
network_policy = "azure"
os_disk_size_gb = 60
sku_tier = "Standard"
rbac_aad = false
vnet_subnet_id = azurerm_subnet.test.id
}