PaloAltoNetworks / terraform-provider-panos

Terraform Panos provider
https://www.terraform.io/docs/providers/panos/
MIT License
89 stars 71 forks source link

Error: Missing value for parameter "user" #263

Open jontreynes opened 3 years ago

jontreynes commented 3 years ago

Describe the bug

I have a provider block that looks like this

provider "panos" {
    alias    = "node1"
    hostname = "10.0.0.0"
    api_key  = file("${path.root}/${node_name}/${api_key_name}")
}

Expected behavior

I expect it to register the provider.

Current behavior

Instead, it fails with the following error

Error: Missing value for parameter "user". 

 on core-egress-dev-1.tf line 5, in provider "panos": 

 5: provider "panos" {

core-egress-dev-1 is the name of the module that makes use of the panos provider.

Considerations

The error does not make sense to me yet. There is no "user" parameter for the provider, except username, which is an optional parameter and is replaced by api_key.

The only "user" parameter I've found in the provider.go file is when it calls resourceUseridLogin which takes in "user" as input, but I am not using panos_userid_login at all in my code.

shinmog commented 3 years ago

Seems like you're using Terraform 0.12, but I have no idea what version of the provider you're using, so I am trying against the most recent version of the provider.

Using Terraform 0.12.29 and panos provider version 1.8, I am not getting an error when I try to use the provider with just the API key.

This is my plan file (no module usage, just straight HCL):

provider "panos" {
    hostname = "127.0.0.1"
    api_key = "(redacted api key)"
    alias = "node1"
}

resource "panos_address_object" "o" {
    name = "made by terraform"
    value = "10.55.55.66"
    provider = panos.node1
}