CiscoDevNet / terraform-provider-fmc

Terraform Provider for FMC
https://registry.terraform.io/providers/CiscoDevNet/fmc/latest/docs
Mozilla Public License 2.0
16 stars 30 forks source link

Forced to create Provider.tf in all directories #28

Closed pillasatishkumar closed 1 year ago

pillasatishkumar commented 1 year ago

I am using the modules concept with attached directory structure. I am having tf file that I would generate per change request that would only have modules required but the actual modules(code to create) is in different structure. This is to organize my actual code untouched unless required. But I am forced to define provider.tf in all the directories, the top level dir, the execute directory which is where I want to execute from and then also I am having to put provider.tf in the actual modules code.

if I give provider.tf only in execute dir, it transfer the provider name fro CiscoDevNet/fmc to terraform/fmc and says terraform/fmc is not found. Obvisouly it's not carrying the name ciscodevnet/fmc all through the modules.

I am attaching the folder structure and the error this as well. Any guidance to avoid giving specifying provider at multiple places, as this is against best practices in Terraform.

image

Thank you Satish Pilla

yvmo commented 1 year ago

Hi, I hope this could help. "Provider configurations can be defined only in a root Terraform module." https://developer.hashicorp.com/terraform/language/modules/develop/providers In your case, if I understand (cause the tfstate is there), in the folder ./execute/module/ If you need to use multi provider you could refer to this: https://developer.hashicorp.com/terraform/language/providers/configuration#alias-multiple-provider-configurations