Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

powerdns provider attempts to connect to server on provider definition, should wait for resource usage #9209

Closed
joelcollin opened this issue Oct 4, 2016 · 1 comment

Comments

@joelcollin
Copy link
Contributor

Terraform Version

terraform 0.7.3

Affected Resource(s)

Provider: powerdns

Terraform Configuration Files

# Configure the PowerDNS provider
provider "powerdns" {
api_key = "changeme"
server_url = "http://powerdns:8081"
}

Debug Output

None.

Panic Output

None.

Expected Behavior

In our infrastructure, we use PowerDNS resources for some instances, but not for others. The ones requiring powerdns records to be added are located in a Google Compute Engine project and those not requiring it are in another. Unfortunately, across projects, we have a firewall rule that prevents connecting to the PowerDNS server. We do not want to fork our module for this small difference.

To address the issue, we used the "count" property in our powerdns ressources and set it to 0. This is useless because the powerdns provider attempts to validate the API on initialization. This is useless if there are no resources to be

TL;DR: connection to PowerDNS server should only happen if at least one resource is to be provisioned.

Actual Behavior

Connection to PowerDNS happens even if no resource are created.

Steps to Reproduce

  1. Add a powerdns provider, set it to an unreachable address
  2. Set a variable named "powerdns_enabled" with default 1.
  3. In terraform.tfvars, set powerdns_enabled = 0
  4. In your resource file, add a powerdns_record ressource with count = ${var.powerdns_enabled}
  5. Run terraform plan

Problem is in the client.NewClient constructor-like factory:

client.ApiVersion, err = client.detectApiVersion()

This is probably a design decision, but could be moved to the first time client.newRequest is invoked to avoid being used if there are no effective ressources being provisioned.

Important Factoids

Tight firewall between projects prevents from connecting to PowerDNS for some instances that are otherwise identical.

References

None.

@ghost
Copy link

ghost commented Apr 10, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants