Can't deploy azurerm_container_instance into a vritual network via azurerm_network_profile

Hello, I am trying to deploy a container instance into a virtual network. According to the Terraform documentation I have created a azurerm_network_profile referencing the subnet and linked it in the azurerm_container_group resource. Although the deployment was successful, the container instance was not placed in the target subnet.


I had a test by deploying the same configuration using Azure CLI and the desired configuration is like below:

The one deployed using Terraform did get a private IP from the target subnet, however it is not able to pull image from a private ACR due to a network error, while the one deploying using AzureCLI has no problem connecting to the ACR.
image
There is no problem with credentials and RBAC, as the two container instances share the same identity, and the same ACR.

Thanks,
Ning