Repository navigation
fix(blueprints): apply il5/gke-hardened CIS node settings - #344
Merged
aghassemlouei merged 2 commits intoOct 27, 2026
Merged
Conversation
This was referenced Oct 23, 2026
The il5/gke-hardened blueprint passed node_config.metadata with block-project-ssh-keys, node_config.machine_type and node_config.confidential_nodes to the modules/gke-cluster-standard-se module, whose node_config type declares none of them, so Terraform discarded them without an error. google#341 already fixed the shielded nodes key in the same issue. Move the block-project-ssh-keys metadata and Confidential GKE Nodes onto the cluster-nodepool module, which already sets the machine type. The modules/gke-nodepool module gains an optional node_config confidential_nodes flag that renders the provider confidential_nodes block with the given value when set, because the module had no way to enable it. The default n2d-standard-2 machine type supports Confidential GKE Nodes; the node_machine_type description now states the requirement. The provider marks node pool metadata as ForceNew, so Terraform replaces the cluster-nodepool node pool of existing deployments. Fixes google#315.
digitalresistor
force-pushed
the
fix/il5-gke-hardened-cis-nodes
branch
from
October 23, 2026 16:50
a0246a7 to
f9ffceb
Compare
aghassemlouei
left a comment
Member
There was a problem hiding this comment.
Thank you for wiring confidential_nodes in modules/gke-nodepool and moving the CIS 4.3 and 4.11 node settings onto module.cluster-nodepool. While validating the plan output, we noticed two follow-up items on default_nodepool in blueprints/il5/gke-hardened/main.tf and local.node_metadata in modules/gke-nodepool/main.tf.
…gacy endpoints off The default_nodepool block set remove_pool = false and an undeclared remove_default_node_pool attribute that Terraform drops, so the cluster kept default-pool without Confidential GKE Nodes or block-project-ssh-keys. The gke-nodepool module also left metadata null when a caller set none, which dropped disable-legacy-endpoints. - Wire remove_pool to the remove_default_node_pool variable, which now defaults to true and no longer needs a tflint ignore. - Merge disable-legacy-endpoints into an empty map when the caller sets no metadata, as upstream Fabric v59.2.0 does. - Add tests for both and regenerate the blueprint README table.
aghassemlouei
approved these changes
Oct 27, 2026
aghassemlouei
left a comment
Member
There was a problem hiding this comment.
Thank you for addressing both review comments and adding the unit test coverage in tests/test_gke_node_hardening.py. LGTM!
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The
il5/gke-hardenedblueprint now applies the CIS node hardening it documents. Terraform silently dropped these settings, because the blueprint passed them to themodules/gke-cluster-standard-semodule under attribute names that the module variable types do not declare.block-project-ssh-keysmetadata key,machine_typeandconfidential_nodesinside the clusternode_configinput. The cluster modulenode_configtype has none of these attributes.This change makes the following fixes.
cluster-nodepoolmodule call sets theblock-project-ssh-keysmetadata key and enables Confidential GKE Nodes. It already sets the machine type.modules/gke-nodepoolmodule gains an optionalnode_config.confidential_nodesflag. The module had no input for Confidential GKE Nodes.trueorfalseflag renders the providerconfidential_nodesblock with that value. The flag defaults tonull, which omits the block, so other callers see no plan change.node_machine_typevariable description states that the machine type must support Confidential GKE Nodes. The defaultn2d-standard-2machine type already does, so the default stays unchanged.default_nodepoolinput now wiresremove_poolto theremove_default_node_poolvariable, which defaults totrue, so the cluster no longer keeps adefault-poolwithout the hardened node settings.default_nodepoolinput no longer passes the undeclaredremove_default_node_poolattribute, which Terraform dropped.node_metadatalocal in themodules/gke-nodepoolmodule now mergesdisable-legacy-endpoints = "true"into an empty map when a caller sets no metadata, as upstream Fabric v59.2.0 does.tests/test_gke_node_hardening.pytest file checks the default pool wiring and the metadata merge.tools/tfdoc.pyscript regenerates theREADME.mdTFDOC tables of both directories.The
blueprints/fedramp-high/gke-hardeneddirectory is a Git120000symlink to../il5/gke-hardened, so the fix covers both blueprints.The new flag is a local extension to the vendored
modules/gke-nodepoolmodule, whoseversions.tffile records Fabric release v38.0.0. Upstream Fabric v59.2.0 has no such input either, so the pending Fabric sync in #311 must keep this change, and the flag is a candidate to propose upstream.#341 already fixed the
enable_features.shielded_nodeskey that the issue also lists, so this branch covers the remaining node settings.Fixes #315
Type of Change
Deployment & Compliance Impact
Checklist
Code Quality & Reusability
modules/orfast/stages-aw/can be leveraged for this change.docs/naming-convention.md.Documentation
README.mdof the modified module or blueprint.Security
Testing
Breaking Changes
Existing deployments see a replacement of the
cluster-nodepoolnode pool, and they keep their currentdefault-pool.node_config.metadataas ForceNew, so adding theblock-project-ssh-keyskey destroys and recreates the node pool. Workloads on that pool restart.node_config.confidential_nodesin place, but the metadata change already forces the replacement.default-poolafter this change. Delete that pool withgcloud container node-pools delete default-poolonce the hardened pool runs the workloads.gke-nodepoolcallers that set no metadata now senddisable-legacy-endpoints = "true", the value that GKE sets on every node pool since version 1.12, so their plans should show no metadata change.Testing Performed
The mock plans need no credentials and use
mock_providerblocks forgoogleandgoogle-betawith placeholder inputs such asmy-project.terraform fmtreports no changes, andterraform init -backend=falseplusterraform validatepass in theblueprints/il5/gke-hardenedblueprint and themodules/gke-nodepoolmodule.terraform testfile withcommand = planasserts that the cluster hasenable_shielded_nodes = trueand that the node pool has then2d-standard-2machine type, an enabledconfidential_nodesblock and theblock-project-ssh-keys = "true"metadata key. The test reads the node pool through a temporary output in a scratch copy of themodules/gke-nodepoolmodule, because the module exposes no node pool attributes.mainafter fix(gke): enable shielded nodes by default and fix gke-hardened feature key #341.main. The shielded nodes assertion passes there since fix(gke): enable shielded nodes by default and fix gke-hardened feature key #341, and the plan shows a nullconfidential_nodesblock and null node pool metadata.node_config.metadatais ForceNew andconfidential_nodeshas an update path.tools/tfdoc.pyscript regenerates both README tables, and thetools/check_documentation.pyscript passes for both directories.tools/lint.shscript passes every check except Terraform lint, which needstflintand could not run locally..terraformdirectories.terraform validatepasses again for both directories, anduv run --locked pytestin the repository root passes 105 tests.tests/test_gke_node_hardening.pytest fails when its fix is reverted.