Can't use depends_on in modules

Hello, i’m trying to use depends_on in modules but it keeps giving me this error.

image

my base main.tf:

my base shared resource group main.tf:
image

my shared resource group main.tf:
image

my base redis main.tf:
image

my redis main.tf
image

Without this “depends_on” i can execute “terraform init” with no problems.
Can someone help me with this pls!

What version of Terraform are you running?

sorry, the version is 0.13

Hi @GustavoBalbino,

This message is saying that you should only have provider "azurerm" blocks in your root module, not in either of your shared child modules. The shared modules will inherit the Azure provider configuration automatically from the root.

If you already have a suitable provider "azurerm" block in your root module then you could just delete the redundant configuration blocks from the modules. If you don’t already have a configuration at the root you should move one of the blocks you already have into the root module and delete the other one.

provider blocks in shared modules are a legacy mechanism that is still supported only for compatibility with Terraform v0.10 and earlier. There’s more detail on the interaction between provider configurations and modules in the documentation section Providers Within Modules.