When AzureRM 4.0 arrived, a published private-endpoint module stopped working for consumers who had moved to the new provider. Nothing in the module had changed. The provider underneath had.
That's the trap with shared modules. A provider major version changes arguments and behaviour, and every consumer of your module inherits that change whether or not you release anything.
Three habits prevent it:
- Pin the provider range in the module, so consumers get a clear error instead of a confusing failure:
hcl
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 3.0, < 4.0"
}
}
}
- Test the module against the new major before consumers upgrade, ideally with
terraform testin the module's own pipeline. - Release support for the new provider as a new module major, with upgrade notes, and keep the old major available until consumers move.
The rule of thumb: if the provider's major version changes, so does yours.