pan-net / terraform-provider-powerdns

Terraform PowerDNS provider
https://www.terraform.io/docs/providers/powerdns/
Mozilla Public License 2.0
44 stars 48 forks source link

The attribute "server_url" is required, but no definition was found. #66

Open Nowaker opened 3 years ago

Nowaker commented 3 years ago

Terraform Version

v0.14.2

Affected Resource(s)

All.

Terraform Configuration Files

terraform {
  required_providers {
    powerdns = {
      source = "pan-net/powerdns"
    }
  }
}

provider "powerdns" {
  server_url = "http://example.com/"
}

Expected Behavior

When API key isn't defined (and therefore, Terraform asks for it interactively) but the PowerDNS server URL is defined in the configuration, the provider sees the server URL parameter and talks to it.

Actual Behavior

% terraform plan
Acquiring state lock. This may take a few moments...
provider.powerdns.api_key
  REST API authentication key

  Enter a value: 1234

Releasing state lock. This may take a few moments...

Error: Missing required attribute

  on <input-prompt> line 1:
  (source code not available)

The attribute "server_url" is required, but no definition was found.
mbag commented 3 years ago

Hi, I'm investigating this, because I have tested with the setting you provide, and the behaviour ocurs for both TF 0.13 and TF0.14. However, if both attributes are entered via CLI there is no problem. This makes me suspect the issue is not with provider it self, but rather with terraform executable and the way it parses attributes.

Are you using any other provider that has mutliple required attributes that you could test in the same way? i.e. configure some required attributes via tf files and some via CLI?

Nowaker commented 3 years ago

I actually haven't used Terraform for a long while so I don't remember if this behavior applies to other providers. Last I used, it worked, but it was before the big Terraform changes that happened around a year ago or so. If you could confirm it's a Terraform issue, we could report an issue in their issue tracker as this behavior is definitely not expected. :-)