Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions CHANGELOG-v6.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

**Merged pull requests:**

- Add support for `http_proxy_config` [\#434](https://github.com/Azure/terraform-azurerm-aks/pull/434) ([isantospardo](https://github.com/isantospardo))

## [Unreleased](https://github.com/Azure/terraform-azurerm-aks/tree/HEAD)

**Merged pull requests:**

- Output Kubernetes Cluster Network Profile [\#333](https://github.com/Azure/terraform-azurerm-aks/pull/333) ([joshua-giumelli-deltatre](https://github.com/joshua-giumelli-deltatre))

## [6.8.0](https://github.com/Azure/terraform-azurerm-aks/tree/6.8.0) (2023-04-04)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ No modules.
| [azurerm_role_assignment.acr](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment) | resource |
| [azurerm_role_assignment.network_contributor](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment) | resource |
| [azurerm_role_assignment.network_contributor_on_subnet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment) | resource |
| [null_resource.aks_cluster_recreate](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
| [null_resource.kubernetes_version_keeper](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
| [null_resource.pool_name_keeper](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
| [tls_private_key.ssh](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) | resource |
Expand Down
23 changes: 22 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ resource "azurerm_kubernetes_cluster" "main" {
} /*<box>*/ : replace(k, "avm_", var.tracing_tags_prefix) => v } : {}) /*</box>*/))
workload_identity_enabled = var.workload_identity_enabled

dynamic "http_proxy_config" {
for_each = var.http_proxy_config == null ? [] : ["http_proxy_config"]
content {
http_proxy = var.http_proxy_config.http_proxy
https_proxy = var.http_proxy_config.https_proxy
no_proxy = var.http_proxy_config.no_proxy
trusted_ca = var.http_proxy_config.trusted_ca
}
}

dynamic "default_node_pool" {
for_each = var.enable_auto_scaling == true ? [] : ["default_node_pool_manually_scaled"]

Expand Down Expand Up @@ -452,7 +462,12 @@ resource "azurerm_kubernetes_cluster" "main" {
}

lifecycle {
ignore_changes = [kubernetes_version]
ignore_changes = [
kubernetes_version,
http_proxy_config[0].no_proxy
]

replace_triggered_by = [null_resource.aks_cluster_recreate]

precondition {
condition = (var.client_id != "" && var.client_secret != "") || (var.identity_type != "")
Expand Down Expand Up @@ -506,6 +521,12 @@ resource "azurerm_kubernetes_cluster" "main" {
}
}

resource "null_resource" "aks_cluster_recreate" {
triggers = {
http_proxy_no_proxy = try(join(",", var.http_proxy_config.no_proxy), "")
}
}

resource "null_resource" "kubernetes_version_keeper" {
triggers = {
version = var.kubernetes_version
Expand Down
18 changes: 18 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,24 @@ variable "agents_min_count" {
description = "Minimum number of nodes in a pool"
}

variable "http_proxy_config" {
type = object({
http_proxy = optional(string)
https_proxy = optional(string)
no_proxy = optional(list(string))
trusted_ca = optional(string)
})
default = null
description = <<-EOT
optional(object({
http_proxy = (Optional) The proxy address to be used when communicating over HTTP. Changing this forces a new resource to be created.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Changing this forces a new resource to be created." is not true anymore.

References:
Azure/AKS#3524
MicrosoftDocs/azure-docs@0bb10c7

This will probably change soon upstream in the provider. Hold before merging.

https_proxy = (Optional) The proxy address to be used when communicating over HTTPS. Changing this forces a new resource to be created.
no_proxy = (Optional) The list of domains that will not use the proxy for communication. Note: If you specify the `default_node_pool.0.vnet_subnet_id`, be sure to include the Subnet CIDR in the `no_proxy` list. Note: You may wish to use Terraform's `ignore_changes` functionality to ignore the changes to this field.
Comment thread
isantospardo marked this conversation as resolved.
trusted_ca = (Optional) The base64 encoded alternative CA certificate content in PEM format.
}))
EOT
}

variable "agents_pool_kubelet_configs" {
type = list(object({
cpu_manager_policy = optional(string)
Expand Down