feat: add check block to warn about blob CSI driver subnet drift (fixes #424)#743
Merged
lonegunmanb merged 1 commit intomainfrom Mar 20, 2026
Merged
Conversation
#424) When storage_profile_blob_driver_enabled is true, the AKS Blob CSI driver may automatically add a Microsoft.Storage service endpoint to the subnet out-of-band, causing Terraform state drift. This adds a check block that warns users to proactively declare the service endpoint on their subnet. The check block uses a conditional data.azurerm_subnet lookup and only triggers when storage_profile_enabled, storage_profile_blob_driver_enabled are both true and vnet_subnet is provided. It produces a warning (not an error), so it is non-breaking. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 task
Member
Author
|
LGTM! Clean, non-breaking addition that proactively warns about known Azure Blob CSI driver behavior causing Terraform state drift. Implementation is solid: properly gated count condition, reuses existing vars/locals, check block only warns, good error message with actionable fix and issue reference. All CI checks passed including E2E tests. Ready for maintainer merge. |
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.
Summary
When
storage_profile_blob_driver_enabledistrue, the AKS Blob CSI driver may automatically add aMicrosoft.Storageservice endpoint to the subnet out-of-band when a blob NFS PersistentVolumeClaim is created. This causes Terraform state drift — subsequentterraform plandetects the out-of-band change and attempts to remove the service endpoint.This PR adds a Terraform
checkblock that warns users (without blocking operations) when their subnet does not haveMicrosoft.Storagedeclared inservice_endpoints, so they can proactively add it to prevent drift.Changes
data.azurerm_subnet.blob_driver_check— conditional data source that only queries the subnet whenstorage_profile_enabled,storage_profile_blob_driver_enabledare bothtrueandvnet_subnetis provided.check "blob_driver_subnet_service_endpoint"— produces a warning if the subnet lacks theMicrosoft.Storageservice endpoint.Impact
checkblock only produces warnings, never errors.storage_profile_enabled,storage_profile_blob_driver_enabled, andvnet_subnetvariables.checkblocks are supported since Terraform 1.5; the module already requires>= 1.9.data.azurerm_subnetlookup only runs when conditions are met.Verification
terraform validate: PassedFixes #424