Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates to make module more production ready #161

Open
wants to merge 44 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
b2b2bd9
Upgrade to azurerm provider version 4
zioproto Oct 31, 2024
2bfdbf9
Merge remote-tracking branch 'origin/feat/provider-v4' into dev
kewalaka Nov 27, 2024
6dc6ede
fix: node_taints not supported on default pool
kewalaka Nov 27, 2024
e97f8f4
Merge branch 'feat/vnet-integrated-api-server' into dev
kewalaka Nov 27, 2024
19d1da8
feat: add monitoring
kewalaka Dec 4, 2024
6dbf1b2
fix: alignment with recommended practice
kewalaka Dec 4, 2024
306e5a8
feat: add service cidr
kewalaka Dec 5, 2024
5f6b1b2
feat: monitoring updates
kewalaka Dec 7, 2024
dbb8f28
feat: allow uami to be created outside of module
kewalaka Dec 7, 2024
35bba76
fix: remove enforced naming convention on cluster
kewalaka Dec 7, 2024
6b9a69c
fix: user assigned idenity creation
kewalaka Dec 7, 2024
d2c7b4a
fix: simplify user assigned id
kewalaka Dec 7, 2024
66f8dcc
fix: regex and name length checks
kewalaka Dec 7, 2024
cca3469
fix: correct scope for permissions
kewalaka Dec 8, 2024
8c9f1ff
fix: add support for DNS service IP
kewalaka Dec 8, 2024
1f975df
fix: add retention to tables to avoid total retention is invalid error
kewalaka Dec 8, 2024
2b655a7
fix: retention to 8 days as required by API
kewalaka Dec 8, 2024
c9280b0
fix: remove retention setting
kewalaka Dec 8, 2024
6409f11
fix: api feature, log analytics retention & identity output
kewalaka Dec 8, 2024
2fb026f
feat: DNS for api server
kewalaka Dec 8, 2024
5ebec99
fix: remove unnecessary pre-condition
kewalaka Dec 8, 2024
95f999d
fix: rbac & naming for feature flags
kewalaka Dec 9, 2024
ab35c1a
fix: only make prometheus rule groups if a monitor workspace has been…
kewalaka Dec 9, 2024
d60e912
fix: invalid payload
kewalaka Dec 9, 2024
0072dc2
fix: try without law tables for now
kewalaka Dec 9, 2024
d53c1df
fix: move network contributor to vnet
kewalaka Dec 9, 2024
eed45b7
fix: try dcr without kind attribute
kewalaka Dec 10, 2024
1d7c2ae
fix: try without container logs v2
kewalaka Dec 10, 2024
4b84e13
fix: try with containerlogsv2
kewalaka Dec 10, 2024
79b1962
feat: add extra params for ingress profile
kewalaka Dec 11, 2024
bbbc2bf
feat: allow for different defender law ID
kewalaka Dec 11, 2024
eefea00
fix: ingress profile block
kewalaka Dec 11, 2024
5ed6daf
fix: updates for web app routing
kewalaka Dec 15, 2024
c0c03c2
fix: null and count issues
kewalaka Dec 15, 2024
bc89573
fix: better conditions
kewalaka Dec 15, 2024
1784f45
fix: add output values
kewalaka Dec 15, 2024
e529d04
fix: deal with count
kewalaka Dec 15, 2024
a11466d
fix: web app identity
kewalaka Dec 17, 2024
3448b8a
fix: outputs
kewalaka Dec 17, 2024
90bcc51
fix: make outputs like azurerm
kewalaka Dec 17, 2024
b4e856b
fix: try another way to do attributes
kewalaka Dec 17, 2024
34afd0a
fix: update to keyvault provider output
kewalaka Dec 17, 2024
4f3dc16
fix: alignment to other resources
kewalaka Dec 17, 2024
fe67662
Merge remote-tracking branch 'upstream/main' into feat/monitoring
kewalaka Jan 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
514 changes: 495 additions & 19 deletions README.md

Large diffs are not rendered by default.

17 changes: 8 additions & 9 deletions examples/default/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,14 @@ data "azurerm_client_config" "current" {}
# Leaving location as `null` will cause the module to use the resource group location
# with a data source.
module "test" {
source = "../../"
kubernetes_version = "1.30"
enable_telemetry = var.enable_telemetry # see variables.tf
name = module.naming.kubernetes_cluster.name_unique
resource_group_name = azurerm_resource_group.this.name
location = azurerm_resource_group.this.location
private_dns_zone_id = azurerm_private_dns_zone.mydomain.id
private_dns_zone_id_enabled = true
rbac_aad_tenant_id = data.azurerm_client_config.current.tenant_id
source = "../../"
kubernetes_version = "1.30"
enable_telemetry = var.enable_telemetry # see variables.tf
name = module.naming.kubernetes_cluster.name_unique
resource_group_name = azurerm_resource_group.this.name
location = azurerm_resource_group.this.location
private_dns_zone_id = azurerm_private_dns_zone.mydomain.id
rbac_aad_tenant_id = data.azurerm_client_config.current.tenant_id
network = {
name = module.avm_res_network_virtualnetwork.name
resource_group_name = azurerm_resource_group.this.name
Expand Down
17 changes: 8 additions & 9 deletions examples/default/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,14 @@ data "azurerm_client_config" "current" {}
# Leaving location as `null` will cause the module to use the resource group location
# with a data source.
module "test" {
source = "../../"
kubernetes_version = "1.30"
enable_telemetry = var.enable_telemetry # see variables.tf
name = module.naming.kubernetes_cluster.name_unique
resource_group_name = azurerm_resource_group.this.name
location = azurerm_resource_group.this.location
private_dns_zone_id = azurerm_private_dns_zone.mydomain.id
private_dns_zone_id_enabled = true
rbac_aad_tenant_id = data.azurerm_client_config.current.tenant_id
source = "../../"
kubernetes_version = "1.30"
enable_telemetry = var.enable_telemetry # see variables.tf
name = module.naming.kubernetes_cluster.name_unique
resource_group_name = azurerm_resource_group.this.name
location = azurerm_resource_group.this.location
private_dns_zone_id = azurerm_private_dns_zone.mydomain.id
rbac_aad_tenant_id = data.azurerm_client_config.current.tenant_id
network = {
name = module.avm_res_network_virtualnetwork.name
resource_group_name = azurerm_resource_group.this.name
Expand Down
10 changes: 1 addition & 9 deletions examples/with_availability_zone/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module "naming" {

resource "azurerm_user_assigned_identity" "this" {
location = azurerm_resource_group.this.location
name = "uami-${var.kubernetes_cluster_name}"
name = module.naming.user_assigned_identity.name_unique
resource_group_name = azurerm_resource_group.this.name
}

Expand Down Expand Up @@ -163,14 +163,6 @@ Type: `bool`

Default: `true`

### <a name="input_kubernetes_cluster_name"></a> [kubernetes\_cluster\_name](#input\_kubernetes\_cluster\_name)

Description: The name of the Kubernetes cluster.

Type: `string`

Default: `"myAks"`

## Outputs

No outputs.
Expand Down
4 changes: 2 additions & 2 deletions examples/with_availability_zone/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module "naming" {

resource "azurerm_user_assigned_identity" "this" {
location = azurerm_resource_group.this.location
name = "uami-${var.kubernetes_cluster_name}"
name = module.naming.user_assigned_identity.name_unique
resource_group_name = azurerm_resource_group.this.name
}

Expand Down Expand Up @@ -117,4 +117,4 @@ module "avm_res_network_virtualnetwork" {
address_prefixes = ["10.31.129.0/24"]
}
}
}
}
6 changes: 0 additions & 6 deletions examples/with_availability_zone/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,3 @@ For more information see <https://aka.ms/avm/telemetryinfo>.
If it is set to false, then no telemetry will be collected.
DESCRIPTION
}

variable "kubernetes_cluster_name" {
type = string
default = "myAks"
description = "The name of the Kubernetes cluster."
}
165 changes: 165 additions & 0 deletions examples/without_acr/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
<!-- BEGIN_TF_DOCS -->
# AKS cluster without Container Registry

This deploys the module without the Container Registry.

```hcl
terraform {
required_version = ">= 1.3.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 4, <5"
}
}
}

provider "azurerm" {
features {
resource_group {
prevent_deletion_if_contains_resources = false
}
}
}

# This ensures we have unique CAF compliant names for our resources.
module "naming" {
source = "Azure/naming/azurerm"
version = ">= 0.3.0"
}

# This is required for resource modules
resource "azurerm_resource_group" "this" {
location = "West US" # Hardcoded because we have to test in a region without availability zones
name = module.naming.resource_group.name_unique
}

resource "azurerm_user_assigned_identity" "this" {
location = azurerm_resource_group.this.location
name = module.naming.user_assigned_identity.name_unique
resource_group_name = azurerm_resource_group.this.name
}

data "azurerm_client_config" "current" {}

# This is the module call
# Do not specify location here due to the randomization above.
module "test" {
source = "../../"
kubernetes_version = "1.31"
enable_telemetry = var.enable_telemetry # see variables.tf
name = module.naming.kubernetes_cluster.name_unique
resource_group_name = azurerm_resource_group.this.name
network = {
node_subnet_id = module.avm_res_network_virtualnetwork.subnets["subnet"].resource_id
pod_cidr = "192.168.0.0/16"
}
managed_identities = {
user_assigned_resource_ids = [
azurerm_user_assigned_identity.this.id
]
}
rbac_aad_admin_group_object_ids = [data.azurerm_client_config.current.object_id]

location = "AustraliaEast" # Hardcoded because we have to test in a region without availability zones
node_pools = {
workload = {
name = "workload"
vm_size = "Standard_D2d_v5"
orchestrator_version = "1.31"
max_count = 110
min_count = 2
os_sku = "AzureLinux"
mode = "User"
}
}
}

module "avm_res_network_virtualnetwork" {
source = "Azure/avm-res-network-virtualnetwork/azurerm"
version = "0.5.0"

address_space = ["10.31.0.0/16"]
location = azurerm_resource_group.this.location
name = "myvnet"
resource_group_name = azurerm_resource_group.this.name
subnets = {
"subnet" = {
name = "nodecidr"
address_prefixes = ["10.31.0.0/17"]
}
"private_link_subnet" = {
name = "private_link_subnet"
address_prefixes = ["10.31.129.0/24"]
}
}
}
```

<!-- markdownlint-disable MD033 -->
## Requirements

The following requirements are needed by this module:

- <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) (>= 1.3.0)

- <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) (>= 4, <5)

## Resources

The following resources are used by this module:

- [azurerm_resource_group.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) (resource)
- [azurerm_user_assigned_identity.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/user_assigned_identity) (resource)
- [azurerm_client_config.current](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/client_config) (data source)

<!-- markdownlint-disable MD013 -->
## Required Inputs

No required inputs.

## Optional Inputs

The following input variables are optional (have default values):

### <a name="input_enable_telemetry"></a> [enable\_telemetry](#input\_enable\_telemetry)

Description: This variable controls whether or not telemetry is enabled for the module.
For more information see <https://aka.ms/avm/telemetryinfo>.
If it is set to false, then no telemetry will be collected.

Type: `bool`

Default: `true`

## Outputs

No outputs.

## Modules

The following Modules are called:

### <a name="module_avm_res_network_virtualnetwork"></a> [avm\_res\_network\_virtualnetwork](#module\_avm\_res\_network\_virtualnetwork)

Source: Azure/avm-res-network-virtualnetwork/azurerm

Version: 0.5.0

### <a name="module_naming"></a> [naming](#module\_naming)

Source: Azure/naming/azurerm

Version: >= 0.3.0

### <a name="module_test"></a> [test](#module\_test)

Source: ../../

Version:

<!-- markdownlint-disable-next-line MD041 -->
## Data Collection

The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at <https://go.microsoft.com/fwlink/?LinkID=824704>. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
<!-- END_TF_DOCS -->
4 changes: 4 additions & 0 deletions examples/without_acr/_footer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<!-- markdownlint-disable-next-line MD041 -->
## Data Collection

The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at <https://go.microsoft.com/fwlink/?LinkID=824704>. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
3 changes: 3 additions & 0 deletions examples/without_acr/_header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# AKS cluster without Container Registry

This deploys the module without the Container Registry.
90 changes: 90 additions & 0 deletions examples/without_acr/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
terraform {
required_version = ">= 1.3.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 4, <5"
}
}
}

provider "azurerm" {
features {
resource_group {
prevent_deletion_if_contains_resources = false
}
}
}

# This ensures we have unique CAF compliant names for our resources.
module "naming" {
source = "Azure/naming/azurerm"
version = ">= 0.3.0"
}

# This is required for resource modules
resource "azurerm_resource_group" "this" {
location = "West US" # Hardcoded because we have to test in a region without availability zones
name = module.naming.resource_group.name_unique
}

resource "azurerm_user_assigned_identity" "this" {
location = azurerm_resource_group.this.location
name = module.naming.user_assigned_identity.name_unique
resource_group_name = azurerm_resource_group.this.name
}

data "azurerm_client_config" "current" {}

# This is the module call
# Do not specify location here due to the randomization above.
module "test" {
source = "../../"
kubernetes_version = "1.31"
enable_telemetry = var.enable_telemetry # see variables.tf
name = module.naming.kubernetes_cluster.name_unique
resource_group_name = azurerm_resource_group.this.name
network = {
node_subnet_id = module.avm_res_network_virtualnetwork.subnets["subnet"].resource_id
pod_cidr = "192.168.0.0/16"
}
managed_identities = {
user_assigned_resource_ids = [
azurerm_user_assigned_identity.this.id
]
}
rbac_aad_admin_group_object_ids = [data.azurerm_client_config.current.object_id]

location = "AustraliaEast" # Hardcoded because we have to test in a region without availability zones
node_pools = {
workload = {
name = "workload"
vm_size = "Standard_D2d_v5"
orchestrator_version = "1.31"
max_count = 110
min_count = 2
os_sku = "AzureLinux"
mode = "User"
}
}
}

module "avm_res_network_virtualnetwork" {
source = "Azure/avm-res-network-virtualnetwork/azurerm"
version = "0.5.0"

address_space = ["10.31.0.0/16"]
location = azurerm_resource_group.this.location
name = "myvnet"
resource_group_name = azurerm_resource_group.this.name
subnets = {
"subnet" = {
name = "nodecidr"
address_prefixes = ["10.31.0.0/17"]
}
"private_link_subnet" = {
name = "private_link_subnet"
address_prefixes = ["10.31.129.0/24"]
}
}
}
9 changes: 9 additions & 0 deletions examples/without_acr/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
variable "enable_telemetry" {
type = bool
default = true
description = <<DESCRIPTION
This variable controls whether or not telemetry is enabled for the module.
For more information see <https://aka.ms/avm/telemetryinfo>.
If it is set to false, then no telemetry will be collected.
DESCRIPTION
}
4 changes: 2 additions & 2 deletions examples/without_availability_zone/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ resource "azurerm_resource_group" "this" {

resource "azurerm_user_assigned_identity" "this" {
location = azurerm_resource_group.this.location
name = "uami-${var.kubernetes_cluster_name}"
name = "uami-${var.name}"
resource_group_name = azurerm_resource_group.this.name
}

Expand Down Expand Up @@ -161,7 +161,7 @@ Type: `bool`

Default: `true`

### <a name="input_kubernetes_cluster_name"></a> [kubernetes\_cluster\_name](#input\_kubernetes\_cluster\_name)
### <a name="input_name"></a> [name](#input\_name)

Description: The name of the Kubernetes cluster.

Expand Down
Loading