Skip to content

container: suppress permadiff on private endpoint fields when IP endpoints are disabled#18386

Open
florianmutter wants to merge 2 commits into
GoogleCloudPlatform:mainfrom
florianmutter:fix-container-cluster-ip-endpoints-permadiff
Open

container: suppress permadiff on private endpoint fields when IP endpoints are disabled#18386
florianmutter wants to merge 2 commits into
GoogleCloudPlatform:mainfrom
florianmutter:fix-container-cluster-ip-endpoints-permadiff

Conversation

@florianmutter

Copy link
Copy Markdown
Contributor

When control_plane_endpoints_config.ip_endpoints_config.enabled is false (DNS-only access), the GKE API dictates private_cluster_config.enable_private_endpoint and private_cluster_config.master_global_access_config.enabled and ignores writes to them: the expander returns early without sending either field. The flattener still reads the API's fixed values back into state, so any configured value produced a permanent plan diff that never converged after apply.

This suppresses the diff on both fields when IP endpoints are disabled, and wires the existing private-cluster-config diff suppressor onto master_global_access_config.enabled. The suppression logic is extracted into a helper accepting an interface so it can be unit tested with tpgresource.ResourceDiffMock.

Fixes hashicorp/terraform-provider-google#27901.

container: fixed a permadiff on `enable_private_endpoint` and `master_global_access_config.enabled` in `google_container_cluster` when `control_plane_endpoints_config.ip_endpoints_config.enabled` is set to `false`

…oints are disabled

When control_plane_endpoints_config.ip_endpoints_config.enabled is false
(DNS-only access), the GKE API dictates enable_private_endpoint and
master_global_access_config.enabled and ignores writes to them:
expandControlPlaneEndpointsConfig returns early without sending either field.
flattenPrivateClusterConfig still reads the API's fixed values back into state,
so any configured value produced a permanent plan diff that never converged.

Suppress the diff on both fields when IP endpoints are disabled, and wire the
suppressor onto master_global_access_config.enabled. The suppression logic is
extracted into a helper accepting an interface so it can be unit tested with
tpgresource.ResourceDiffMock.
@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Jul 24, 2026
@florianmutter
florianmutter marked this pull request as ready for review July 24, 2026 09:33
@github-actions

Copy link
Copy Markdown

Googlers: For automatic test runs see go/terraform-auto-test-runs.

@slevenick, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look.

You can help make sure that review is quick by doing a self-review and by running impacted tests locally.

@github-actions
github-actions Bot requested a review from slevenick July 24, 2026 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-approval Pull requests that need reviewer's approval to run presubmit tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

google_container_cluster: perpetual drift on private_cluster_config fields when ip_endpoints_config.enabled = false

2 participants