Skip to content

fix(blueprints): apply il5/gke-hardened CIS node settings - #344

Merged
aghassemlouei merged 2 commits into
google:mainfrom
digitalresistor:fix/il5-gke-hardened-cis-nodes
Oct 27, 2026
Merged

aghassemlouei merged 2 commits into
google:mainfrom
digitalresistor:fix/il5-gke-hardened-cis-nodes

Conversation

@digitalresistor

@digitalresistor digitalresistor commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Description

The il5/gke-hardened blueprint now applies the CIS node hardening it documents. Terraform silently dropped these settings, because the blueprint passed them to the modules/gke-cluster-standard-se module under attribute names that the module variable types do not declare.

  • The blueprint set the block-project-ssh-keys metadata key, machine_type and confidential_nodes inside the cluster node_config input. The cluster module node_config type has none of these attributes.

This change makes the following fixes.

  • The cluster-nodepool module call sets the block-project-ssh-keys metadata key and enables Confidential GKE Nodes. It already sets the machine type.
  • The modules/gke-nodepool module gains an optional node_config.confidential_nodes flag. The module had no input for Confidential GKE Nodes.
  • A true or false flag renders the provider confidential_nodes block with that value. The flag defaults to null, which omits the block, so other callers see no plan change.
  • The node_machine_type variable description states that the machine type must support Confidential GKE Nodes. The default n2d-standard-2 machine type already does, so the default stays unchanged.
  • The default_nodepool input now wires remove_pool to the remove_default_node_pool variable, which defaults to true, so the cluster no longer keeps a default-pool without the hardened node settings.
  • The default_nodepool input no longer passes the undeclared remove_default_node_pool attribute, which Terraform dropped.
  • The node_metadata local in the modules/gke-nodepool module now merges disable-legacy-endpoints = "true" into an empty map when a caller sets no metadata, as upstream Fabric v59.2.0 does.
  • The new tests/test_gke_node_hardening.py test file checks the default pool wiring and the metadata merge.
  • The tools/tfdoc.py script regenerates the README.md TFDOC tables of both directories.

The blueprints/fedramp-high/gke-hardened directory is a Git 120000 symlink to ../il5/gke-hardened, so the fix covers both blueprints.

The new flag is a local extension to the vendored modules/gke-nodepool module, whose versions.tf file 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_nodes key that the issue also lists, so this branch covers the remaining node settings.

Fixes #315

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Deployment & Compliance Impact

  • Applicable Regimes:
    • US Region Restricted (e.g., Access Policy constraint)
    • FedRAMP Moderate
    • FedRAMP High
    • DoD IL4
    • DoD IL5
    • General / All
  • NIST 800-53r5 Controls: CM-6 configuration settings, SI-7 software and firmware integrity through Shielded GKE Nodes secure boot and integrity monitoring, SC-39 process isolation through Confidential GKE Nodes memory encryption, AC-3 and AC-17 access enforcement for remote access through blocked project-wide SSH keys.

Checklist

Code Quality & Reusability

  • My code adheres to the Maximize Reusability principle. I have not redefined common elements and have reused existing base configurations and modules where possible.
  • I have checked that no existing module or configuration in modules/ or fast/stages-aw/ can be leveraged for this change.
  • My code follows the established naming conventions outlined in docs/naming-convention.md.

Documentation

  • I have updated the README.md of the modified module or blueprint.
  • I have added/updated documentation for inputs (variables) and outputs.

Security

  • My change adheres to GCP security best practices and the principle of least privilege.
  • I have ensured compliance with the targeted regime (FedRAMP Moderate, FedRAMP High, IL4, IL5, etc.).

Testing

  • I have tested my changes locally.
  • I have included details of my testing in this PR.

Breaking Changes

Existing deployments see a replacement of the cluster-nodepool node pool, and they keep their current default-pool.

  • The provider marks node pool node_config.metadata as ForceNew, so adding the block-project-ssh-keys key destroys and recreates the node pool. Workloads on that pool restart.
  • Provider 6.50.0 updates node_config.confidential_nodes in place, but the metadata change already forces the replacement.
  • The provider removes the default node pool only when it creates a cluster, so an existing cluster keeps its default-pool after this change. Delete that pool with gcloud container node-pools delete default-pool once the hardened pool runs the workloads.
  • Other gke-nodepool callers that set no metadata now send disable-legacy-endpoints = "true", the value that GKE sets on every node pool since version 1.12, so their plans should show no metadata change.
blueprints/il5/gke-hardened and blueprints/fedramp-high/gke-hardened: the
node pool now enables Confidential GKE Nodes and blocks project-wide SSH
keys. Terraform replaces
the existing node pool because node metadata changes force replacement.
Plan during a maintenance window, and check that node_machine_type supports
Confidential GKE Nodes, such as the N2D, C2D or C3D series. An existing
cluster keeps its default-pool, so delete it with
`gcloud container node-pools delete default-pool` after the migration.

Testing Performed

The mock plans need no credentials and use mock_provider blocks for google and google-beta with placeholder inputs such as my-project.

  • terraform fmt reports no changes, and terraform init -backend=false plus terraform validate pass in the blueprints/il5/gke-hardened blueprint and the modules/gke-nodepool module.
  • A temporary terraform test file with command = plan asserts that the cluster has enable_shielded_nodes = true and that the node pool has the n2d-standard-2 machine type, an enabled confidential_nodes block and the block-project-ssh-keys = "true" metadata key. The test reads the node pool through a temporary output in a scratch copy of the modules/gke-nodepool module, because the module exposes no node pool attributes.
  • The test passes on this branch, rebased onto main after fix(gke): enable shielded nodes by default and fix gke-hardened feature key #341.
  • The same test fails on 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 null confidential_nodes block and null node pool metadata.
  • Mock providers never mark replacements, so the replacement impact comes from the provider 6.50.0 schema source, where node_config.metadata is ForceNew and confidential_nodes has an update path.
  • The tools/tfdoc.py script regenerates both README tables, and the tools/check_documentation.py script passes for both directories.
  • The tools/lint.sh script passes every check except Terraform lint, which needs tflint and could not run locally.
  • The commit leaves out the temporary test files, scratch copies and .terraform directories.
  • After the review, terraform validate passes again for both directories, and uv run --locked pytest in the repository root passes 105 tests.
  • Each half of the new tests/test_gke_node_hardening.py test fails when its fix is reverted.

@github-actions github-actions Bot added Scope - Module Related to reusable Terraform modules in the modules directory Framework - IL5 DoD Impact Level 5 (IL5) compliance regime and controls Scope - Blueprint Related to solution blueprints in the blueprints directory labels Oct 22, 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
digitalresistor force-pushed the fix/il5-gke-hardened-cis-nodes branch from a0246a7 to f9ffceb Compare October 23, 2026 16:50

@aghassemlouei aghassemlouei left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Comment thread blueprints/il5/gke-hardened/main.tf Resolved
Comment thread modules/gke-nodepool/main.tf Resolved
@aghassemlouei aghassemlouei added Bug Something isn't working Level of Effort - Medium Moderate task requiring thought and testing; typically takes a couple of days to a week Priority - Medium Standard features and non-blocking bugs; important for the current milestone but not urgent Security Something is insecure or can be secured labels Oct 26, 2026
…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 aghassemlouei left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for addressing both review comments and adding the unit test coverage in tests/test_gke_node_hardening.py. LGTM!

@aghassemlouei
aghassemlouei merged commit 46e268e into google:main Oct 27, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working Framework - IL5 DoD Impact Level 5 (IL5) compliance regime and controls Level of Effort - Medium Moderate task requiring thought and testing; typically takes a couple of days to a week Priority - Medium Standard features and non-blocking bugs; important for the current milestone but not urgent Scope - Blueprint Related to solution blueprints in the blueprints directory Scope - Module Related to reusable Terraform modules in the modules directory Security Something is insecure or can be secured

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] il5/gke-hardened: shielded nodes, confidential nodes and the CIS SSH key setting never apply

2 participants