Skip to content

Commit 52964a1

Browse files
authored
feat: (IAC-886) Enable FIPS support (#288)
* feat: (IAC-886) Enable FIPS support * feat: (IAC-924) Update provider Kubernetes version
1 parent f9e9465 commit 52964a1

File tree

15 files changed

+84
-41
lines changed

15 files changed

+84
-41
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ARG TERRAFORM_VERSION=1.0.0
2-
ARG AZURECLI_VERSION=2.24.2
2+
ARG AZURECLI_VERSION=2.45.0
33

44
FROM hashicorp/terraform:$TERRAFORM_VERSION as terraform
55
FROM mcr.microsoft.com/azure-cli:$AZURECLI_VERSION

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Access to an **Azure Subscription** and an [**Identity**](./docs/user/TerraformA
6060
- [Terraform](https://www.terraform.io/downloads.html) - v1.0.0
6161
- [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl) - v1.24
6262
- [jq](https://stedolan.github.io/jq/) - v1.6
63-
- [Azure CLI](https://docs.microsoft.com/en-us/cli/azure) - (optional - useful as an alternative to the Azure Portal) - v2.24.2
63+
- [Azure CLI](https://docs.microsoft.com/en-us/cli/azure) - (optional - useful as an alternative to the Azure Portal) - v2.45.0
6464

6565
#### Docker Requirements:
6666
- [Docker](https://docs.docker.com/get-docker/)

container-structure-test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ commandTests:
2929
- -c
3030
- |
3131
az version -o tsv
32-
expectedOutput: ["2.24.2\t2.24.2\t1.0.6"]
32+
expectedOutput: ["2.45.0\t2.45.0\t1.0.8"]
3333

3434
metadataTest:
3535
workdir: "/viya4-iac-azure"

iam.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
data "azurerm_user_assigned_identity" "uai" {
5-
count = var.aks_identity == "uai" ? ( var.aks_uai_name == null ? 0 : 1 ) : 0
5+
count = var.aks_identity == "uai" ? (var.aks_uai_name == null ? 0 : 1) : 0
66
name = var.aks_uai_name
77
resource_group_name = local.network_rg.name
88
}
99

1010
resource "azurerm_user_assigned_identity" "uai" {
11-
count = var.aks_identity == "uai" ? ( var.aks_uai_name == null ? 1 : 0 ) : 0
11+
count = var.aks_identity == "uai" ? (var.aks_uai_name == null ? 1 : 0) : 0
1212
name = "${var.prefix}-aks-identity"
1313
resource_group_name = local.aks_rg.name
1414
location = var.location

locals.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ locals {
2323
kubeconfig_path = var.iac_tooling == "docker" ? "/workspace/${local.kubeconfig_filename}" : local.kubeconfig_filename
2424

2525
# PostgreSQL
26-
default_postgres_configuration = [{name: "max_prepared_transactions", value: 1024}]
27-
postgres_servers = var.postgres_servers == null ? {} : { for k, v in var.postgres_servers : k => merge(var.postgres_server_defaults, v, ) }
28-
postgres_firewall_rules = [for addr in local.postgres_public_access_cidrs : { "name" : replace(replace(addr, "/", "_"), ".", "_"), "start_ip" : cidrhost(addr, 0), "end_ip" : cidrhost(addr, abs(pow(2, 32 - split("/", addr)[1]) - 1)) }]
26+
default_postgres_configuration = [{ name : "max_prepared_transactions", value : 1024 }]
27+
postgres_servers = var.postgres_servers == null ? {} : { for k, v in var.postgres_servers : k => merge(var.postgres_server_defaults, v, ) }
28+
postgres_firewall_rules = [for addr in local.postgres_public_access_cidrs : { "name" : replace(replace(addr, "/", "_"), ".", "_"), "start_ip" : cidrhost(addr, 0), "end_ip" : cidrhost(addr, abs(pow(2, 32 - split("/", addr)[1]) - 1)) }]
2929

3030
postgres_outputs = length(module.flex_postgresql) != 0 ? { for k, v in module.flex_postgresql :
3131
k => {

main.tf

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ module "aks" {
135135
aks_cluster_dns_prefix = "${var.prefix}-aks"
136136
aks_cluster_sku_tier = var.aks_cluster_sku_tier
137137
aks_cluster_location = var.location
138+
fips_enabled = var.fips_enabled
138139
aks_cluster_node_auto_scaling = var.default_nodepool_min_nodes == var.default_nodepool_max_nodes ? false : true
139140
aks_cluster_node_count = var.default_nodepool_min_nodes
140141
aks_cluster_min_nodes = var.default_nodepool_min_nodes == var.default_nodepool_max_nodes ? null : var.default_nodepool_min_nodes
@@ -189,6 +190,7 @@ module "node_pools" {
189190
aks_cluster_id = module.aks.cluster_id
190191
vnet_subnet_id = module.vnet.subnets["aks"].id
191192
machine_type = each.value.machine_type
193+
fips_enabled = var.fips_enabled
192194
os_disk_size = each.value.os_disk_size
193195
# TODO: enable with azurerm v2.37.0
194196
# os_disk_type = each.value.os_disk_type
@@ -223,9 +225,9 @@ module "flex_postgresql" {
223225
server_version = each.value.server_version
224226
firewall_rule_prefix = "${var.prefix}-${each.key}-postgres-firewall-"
225227
firewall_rules = local.postgres_firewall_rules
226-
postgresql_configurations = each.value.ssl_enforcement_enabled ? concat(each.value.postgresql_configurations, local.default_postgres_configuration) : concat(
227-
each.value.postgresql_configurations, [{name: "require_secure_transport", value: "OFF"}], local.default_postgres_configuration)
228-
tags = var.tags
228+
postgresql_configurations = each.value.ssl_enforcement_enabled ? concat(each.value.postgresql_configurations, local.default_postgres_configuration) : concat(
229+
each.value.postgresql_configurations, [{ name : "require_secure_transport", value : "OFF" }], local.default_postgres_configuration)
230+
tags = var.tags
229231
}
230232

231233
module "netapp" {

modules/aks_node_pool/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ resource "azurerm_kubernetes_cluster_node_pool" "autoscale_node_pool" {
99
kubernetes_cluster_id = var.aks_cluster_id
1010
vnet_subnet_id = var.vnet_subnet_id
1111
zones = var.zones
12+
fips_enabled = var.fips_enabled
1213
proximity_placement_group_id = var.proximity_placement_group_id == "" ? null : var.proximity_placement_group_id
1314
vm_size = var.machine_type
1415
os_disk_size_gb = var.os_disk_size
@@ -38,6 +39,7 @@ resource "azurerm_kubernetes_cluster_node_pool" "static_node_pool" {
3839
kubernetes_cluster_id = var.aks_cluster_id
3940
vnet_subnet_id = var.vnet_subnet_id
4041
zones = var.zones
42+
fips_enabled = var.fips_enabled
4143
proximity_placement_group_id = var.proximity_placement_group_id == "" ? null : var.proximity_placement_group_id
4244
vm_size = var.machine_type
4345
os_disk_size_gb = var.os_disk_size

modules/aks_node_pool/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ variable "zones" {
1717
default = []
1818
}
1919

20+
variable "fips_enabled" {
21+
description = "Should the nodes in this Node Pool have Federal Information Processing Standard enabled? Changing this forces a new resource to be created."
22+
type = bool
23+
default = false
24+
}
25+
2026
variable "vnet_subnet_id" {
2127
description = "The ID of the Subnet where this Node Pool should exist. Changing this forces a new resource to be created."
2228
type = string

modules/azure_aks/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ resource "azurerm_kubernetes_cluster" "aks" {
5555
enable_node_public_ip = false
5656
node_labels = {}
5757
node_taints = []
58+
fips_enabled = var.fips_enabled
5859
max_pods = var.aks_cluster_max_pods
5960
os_disk_size_gb = var.aks_cluster_os_disk_size
6061
max_count = var.aks_cluster_max_nodes

modules/azure_aks/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ variable "aks_cluster_sku_tier" {
3838
}
3939
}
4040

41+
variable "fips_enabled" {
42+
description = "Should the nodes in this Node Pool have Federal Information Processing Standard enabled? Changing this forces a new resource to be created."
43+
type = bool
44+
default = false
45+
}
46+
4147
variable "aks_private_cluster" {
4248
description = "Enables cluster API endpoint to use Private IP address"
4349
type = bool

0 commit comments

Comments
 (0)