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

add user node pool & availability zones #9

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ README-generated.md
avm.tflint.hcl
avm.tflint_example.hcl
*tfplan*
.DS_Store*
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MIT License
MIT License

Copyright (c) Microsoft Corporation.

Expand Down
53 changes: 52 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ The following providers are used by this module:
The following resources are used by this module:

- [azurerm_kubernetes_cluster.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/kubernetes_cluster) (resource)
- [azurerm_kubernetes_cluster_node_pool.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/kubernetes_cluster_node_pool) (resource)
- [azurerm_management_lock.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/management_lock) (resource)
- [azurerm_private_endpoint.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/private_endpoint) (resource)
- [azurerm_private_endpoint_application_security_group_association.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/private_endpoint_application_security_group_association) (resource)
Expand Down Expand Up @@ -168,6 +169,42 @@ object({

Default: `{}`

### <a name="input_node_pools"></a> [node\_pools](#input\_node\_pools)

Description: The node pools to create on the Kubernetes Cluster.

Type:

```hcl
list(object({
vm_size = string
enable_auto_scaling = bool
max_count = number
min_count = number
node_count = optional(number, null)
os_sku = string
mode = optional(string)
os_disk_size_gb = optional(number, null)
tags = optional(map(string), {})
zones = optional(string)
}))
```

Default:

```json
[
{
"enable_auto_scaling": true,
"max_count": 110,
"min_count": 2,
"mode": "User",
"os_sku": "Ubuntu",
"vm_size": "Standard_D4d_v5"
}
]
```

### <a name="input_private_endpoints"></a> [private\_endpoints](#input\_private\_endpoints)

Description: A map of private endpoints to create on this resource. The map key is deliberately arbitrary to avoid issues where map keys maybe unknown at plan time.
Expand Down Expand Up @@ -261,6 +298,14 @@ Type: `map(any)`

Default: `{}`

### <a name="input_zones"></a> [zones](#input\_zones)

Description: The zones to use for the Kubernetes Cluster. This is used for testing purposes and is automatically set when using the `azurerm_regions` module via local.zones.

Type: `list(string)`

Default: `null`

## Outputs

The following outputs are exported:
Expand All @@ -275,7 +320,13 @@ Description: This is the full output for the resource.

## Modules

No modules.
The following Modules are called:
nellyk marked this conversation as resolved.
Show resolved Hide resolved

### <a name="module_regions"></a> [regions](#module\_regions)

Source: Azure/regions/azurerm

Version: >= 0.3.0

<!-- markdownlint-disable-next-line MD041 -->
## Data Collection
Expand Down
3 changes: 2 additions & 1 deletion examples/default/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module "naming" {

# This is required for resource modules
resource "azurerm_resource_group" "this" {
location = module.regions.regions[random_integer.region_index.result].name
location = "East US"
name = module.naming.resource_group.name_unique
}

Expand All @@ -67,6 +67,7 @@ module "test" {
name = module.naming.kubernetes_cluster.name_unique
resource_group_name = azurerm_resource_group.this.name
identity_ids = [azurerm_user_assigned_identity.this.id]
zones = ["1", "2", "3"]
}
```

Expand Down
3 changes: 2 additions & 1 deletion examples/default/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module "naming" {

# This is required for resource modules
resource "azurerm_resource_group" "this" {
location = module.regions.regions[random_integer.region_index.result].name
location = "East US"
name = module.naming.resource_group.name_unique
}

Expand All @@ -61,4 +61,5 @@ module "test" {
name = module.naming.kubernetes_cluster.name_unique
resource_group_name = azurerm_resource_group.this.name
identity_ids = [azurerm_user_assigned_identity.this.id]
zones = ["1", "2", "3"]
}
128 changes: 128 additions & 0 deletions examples/with_availability_zone/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
<!-- BEGIN_TF_DOCS -->
# AKS cluster with region having availability zone

This deploys the module with a region that has availability zones.

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

provider "azurerm" {
features {}
}

# 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 = "East US"
name = module.naming.resource_group.name_unique
}

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

# This is the module call
# Do not specify location here due to the randomization above.
# Leaving location as `null` will cause the module to use the resource group location
# with a data source.
module "test" {
source = "../../"
# source = "Azure/avm-<res/ptn>-<name>/azurerm"
# ...
enable_telemetry = var.enable_telemetry # see variables.tf
name = module.naming.kubernetes_cluster.name_unique
resource_group_name = azurerm_resource_group.this.name
identity_ids = [azurerm_user_assigned_identity.this.id]
zones = ["1", "2", "3"]
}
```

<!-- 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) (>= 3.7.0, < 4.0.0)

## Providers

The following providers are used by this module:

- <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) (>= 3.7.0, < 4.0.0)

## 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)

<!-- 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`

### <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.

## Modules

The following Modules are called:

### <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/with_availability_zone/_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/with_availability_zone/_header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# AKS cluster with region having availability zone

This deploys the module with a region that has availability zones.
46 changes: 46 additions & 0 deletions examples/with_availability_zone/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
terraform {
required_version = ">= 1.3.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 3.7.0, < 4.0.0"
}
}
}

provider "azurerm" {
features {}
}

# 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 = "East US"
name = module.naming.resource_group.name_unique
}

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

# This is the module call
# Do not specify location here due to the randomization above.
# Leaving location as `null` will cause the module to use the resource group location
# with a data source.
module "test" {
source = "../../"
# source = "Azure/avm-<res/ptn>-<name>/azurerm"
# ...
enable_telemetry = var.enable_telemetry # see variables.tf
name = module.naming.kubernetes_cluster.name_unique
resource_group_name = azurerm_resource_group.this.name
identity_ids = [azurerm_user_assigned_identity.this.id]
zones = ["1", "2", "3"]
}
15 changes: 15 additions & 0 deletions examples/with_availability_zone/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
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
}

variable "kubernetes_cluster_name" {
type = string
default = "myAks"
description = "The name of the Kubernetes cluster."
}
Loading
Loading