Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Telemaco019 committed Aug 5, 2024
1 parent f052347 commit b1078dc
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ env:
TF_VAR_client_secret: ${{secrets.CLIENT_SECRET }}

jobs:
Check:
CI:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
Expand Down
13 changes: 6 additions & 7 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -293,26 +293,23 @@ module "aks" {
source = "Azure/aks/azurerm"
version = "9.1.0"


prefix = var.resource_prefix
cluster_name = local.aks_cluster_name
location = var.location
resource_group_name = data.azurerm_resource_group.main
resource_group_name = data.azurerm_resource_group.main.name

kubernetes_version = var.aks_kubernetes_version
orchestrator_version = var.aks_kubernetes_version
sku_tier = var.aks_sku_tier

vnet_subnet_id = data.azurerm_subnet.aks_nodes.id

vnet_subnet_id = data.azurerm_subnet.aks_nodes.id
net_profile_service_cidr = var.aks_net_profile_service_cidr
net_profile_dns_service_ip = var.aks_net_profile_dns_service_ip
api_server_authorized_ip_ranges = [
for _, ip in var.aks_api_server_allowed_ip_addresses : "${ip}/32"
]

azure_policy_enabled = true

rbac_aad_admin_group_object_ids = var.aks_cluster_admin_object_ids
rbac_aad_managed = true
role_based_access_control_enabled = true
Expand Down Expand Up @@ -352,10 +349,12 @@ module "aks" {
# https://learn.microsoft.com/en-us/azure/aks/configure-azure-cni
create_role_assignment_network_contributor = true

key_vault_secrets_provider_enabled = true
public_ssh_key = tls_private_key.aks.public_key_openssh
public_ssh_key = tls_private_key.aks.public_key_openssh

# Plugins
storage_profile_blob_driver_enabled = true
key_vault_secrets_provider_enabled = true
azure_policy_enabled = true

tags = var.tags
}
32 changes: 30 additions & 2 deletions tests/setup/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,37 @@ terraform {
}
}

variable "location" {
type = string
}


# ----------- Data Sources ----------- #
# TODO
data "azurerm_resource_group" "main" {
name = "rg-platform-inttest"
}

# ----------- Resources ----------- #
resource "azurerm_virtual_network" "main" {
name = "integration-test"

resource_group_name = data.azurerm_resource_group.main.name
address_space = ["10.0.0.0/16"]
location = var.location
}
resource "azurerm_subnet" "main" {
name = "aks-nodes"

virtual_network_name = azurerm_virtual_network.main.name
address_prefixes = ["10.0.1.0/24"]
resource_group_name = data.azurerm_resource_group.main.name
}


# ----------- Outputs ----------- #
# TODO
output "azurerm_virtual_network" {
value = azurerm_virtual_network.main
}
output "azurerm_subnet" {
value = azurerm_subnet.main
}
13 changes: 12 additions & 1 deletion tests/smoke_test.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ run "setup" {
module {
source = "./tests/setup"
}

variables {
location = "EastUS"
}
}

run "smoke_test_plan" {
Expand All @@ -22,8 +26,15 @@ run "smoke_test_plan" {
# ------ PostgreSQL Database ------ #
postgres_server_networking = { }


# ------ Key Vault ------ #
key_vault_public_network_access_enabled = true

# ------ AKS ------ #
aks_nodes_virtual_network_name = run.setup.azurerm_virtual_network.name
aks_nodes_subnet_name = run.setup.azurerm_subnet.name

aks_net_profile_service_cidr = "10.32.0.0/24"
aks_net_profile_dns_service_ip = "10.32.0.10"
aks_cluster_admin_object_ids = []
}
}
15 changes: 14 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ variable "aks_kubernetes_version" {
}
variable "aks_sku_tier" {
description = "The AKS tier. Possible values are: Free, Standard, Premium. It is recommended to use Standard or Premium for production workloads."
default = "Stanard"
default = "Standard"
type = string
}
variable "aks_api_server_allowed_ip_addresses" {
Expand Down Expand Up @@ -276,6 +276,19 @@ variable "aks_sys_pool" {
agents_min_count : optional(number, null)
agents_max_count : optional(number, null)
})
default = {
vm_size = "Standard_D4ds_v5"
name = "system"
disk_size_gb = 128
disk_type = "Ephemeral"
availability_zones = ["1", "2", "3"]
nodes_max_pods = 50
only_critical_addons_enabled = false
# Auto-scaling setttings
enable_auto_scaling = true
agents_min_count = 1
agents_max_count = 3
}
}


Expand Down

0 comments on commit b1078dc

Please sign in to comment.