Problem
When using version v3.21.0 of the azurerm provider, you may encounter the following error when planning or applying a configuration that uses the azurerm_container_registry resource.
An argument named "virtual_network" is not expected here.
Cause
This error is caused by a breaking change introduced in version v3.21.0 of the azurerm provider. In this version, the virtual_network block was incorrectly removed from the azurerm_container_registry resource. This block was intended to be nested under the network_rule_set block.
This issue was reported by users and subsequently investigated by the provider development team.
Solution
The breaking change was reverted in version v3.21.1 of the azurerm provider.
To resolve this issue, upgrade the azurerm provider to version v3.21.1 or later in your Terraform configuration.
Additional Information
- For more details, refer to the
azurermprovider v3.21.1 release notes. - You can find the documentation for the
virtual_networkargument in theazurerm_container_registryresource.