infobloxopen / terraform-provider-infoblox

Infoblox NIOS Terraform Provider
https://github.com/infobloxopen/terraform-provider-infoblox
Mozilla Public License 2.0
73 stars 81 forks source link

"required_providers" block of Infoblox must be on the basic module level #358

Closed wilber82 closed 5 months ago

wilber82 commented 5 months ago

If I remove "required_providers" from the basic module level for the infobox code, the provider's path is incorrect. I didn't observe similar behavior in other providers.

My code is a nested module structure below. The root code loads the module "create_a_server", and the module loads the "create_dns_name" basic module to create a DNS record as one step in a big workflow.

root terraform configuration code
|-- module.create_a_server
      |-- module.create_dns_name

According to my testing, the following block must be placed in the basic module "create_dns_name".

terraform{
  required_providers {
     infoblox = {
         source = "infobloxopen/infoblox"
         version = "x.y.z"
     }
}

Because the above block is at the basic module level, I must also put the provider block at the same level; otherwise, it throws an error.

provider "infoblox" {
  server = "xxx"
 username = "xxx"
 password = "xxx"
}

If I remove the two blocks above in the basic module "create_dns_name", then run the command terraform providers, the output shows an incorrect provider path:

.
|-- module.create_a_server
       |-- module.create_dns_name
             |-- provider [registry.terraform.io/hashicorp/infoblox]

Keeping the provider block at the basic module level creates another challenge when creating multiple DNS names. The current infoblox_ip* resources do not support creating multiple DNS names for multiple IP addresses. We have to create a loop for the block or module.

wilber82 commented 5 months ago

Sorry, I have figured it out. It is not Infoblox provider's problem.