Skip to content

Commit

Permalink
Add node_resource_group_id output to Kubernetes Cluster module (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
frasdav authored Jan 7, 2024
1 parent cc4bb4e commit c88eaf4
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 14 deletions.
3 changes: 3 additions & 0 deletions modules/kubernetes-cluster/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# Changelog

## 1.1
* Added `node_resource_group_id` output.
11 changes: 6 additions & 5 deletions modules/kubernetes-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ This module creates a [Kubernetes Cluster](https://registry.terraform.io/provide
module "kubernetes_cluster" {
source = "https://github.com/gofrontier-com/azurerm-terraform-modules/releases/download/kubernetes-cluster/[VERSION]/module.tar.gz//src"
environment = "dev"
identifier = "mortgages"
environment = "dev"
identifier = "creditcards"
location = "uksouth"
resource_group_name = module.resource_group.name
zone = "cus"
kubernetes_version = "1.28.1"
location = "uksouth"
log_analytics_workspace_id = data.azurerm_log_analytics_workspace.main.id
resource_group_name = module.resource_group.name
subnet_id = data.azurerm_subnet.k8s.id
zone = "shd"
tags = {
WorkloadType = "CustomerBankingLZ/container-platform"
Expand Down
2 changes: 1 addition & 1 deletion modules/kubernetes-cluster/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0
1.1
15 changes: 12 additions & 3 deletions modules/kubernetes-cluster/src/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,24 @@ resource "azurerm_kubernetes_cluster" "main" {
vnet_subnet_id = var.subnet_id
zones = var.zones

upgrade_settings {
max_surge = "10%"
}

tags = merge(var.tags, local.tags)
}

api_server_access_profile {
authorized_ip_ranges = var.authorized_ip_ranges
dynamic "api_server_access_profile" {
for_each = length(var.authorized_ip_ranges) > 0 ? [{}] : []

content {
authorized_ip_ranges = var.authorized_ip_ranges
}
}

identity {
type = "SystemAssigned"
type = "SystemAssigned"
identity_ids = []
}

key_vault_secrets_provider {
Expand Down
4 changes: 4 additions & 0 deletions modules/kubernetes-cluster/src/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ output "kube_config" {
output "node_resource_group" {
value = azurerm_kubernetes_cluster.main.node_resource_group
}

output "node_resource_group_id" {
value = "${split(var.resource_group_name, azurerm_kubernetes_cluster.main.id)[0]}${azurerm_kubernetes_cluster.main.node_resource_group}"
}
11 changes: 6 additions & 5 deletions modules/kubernetes-cluster/test/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ provider "azurerm" {
module "kubernetes_cluster" {
source = "../src"

environment = "foo"
identifier = "bar"
environment = "foo"
identifier = "bar"
location = "uksouth"
resource_group_name = "qux"
zone = "corge"

kubernetes_version = "1.2.3"
location = "uksouth"
log_analytics_workspace_id = "baz"
resource_group_name = "qux"
subnet_id = "quux"
zone = "corge"

tags = {
Foo = "Bar"
Expand Down

0 comments on commit c88eaf4

Please sign in to comment.