Repository initialization failure regarding API key error
gruberdev opened this issue · 4 comments
Description of the error:
I initialized a new repository with only a main.tf
with the exact instructions read on the readme
of this repository, then I set my API Key as a string as per documentation:
# main.tf
module "condor" {
source = "vultr/condor/vultr"
version = "1.1.1"
provisioner_public_key = chomp(file("~/.ssh/id_rsa.pub"))
cluster_vultr_api_key = var.cluster_vultr_api_key
}
I've tried:
- Using it directly as a string on
condor
module. - Importing it as a variable declared on
main.tf
- Importing it from another file as variable
- Using it on the terminal as an input to the Terraform CLI interface
- Exporting it as an environment variable (using the proper
TF_VAR_
syntax)
If there is only a cluster_vultr_api_key
as variable, then it returns this error:
╷
│ Error: Missing required argument
│
│ The argument "api_key" is required, but was not set.
╵
If there is also an api_key
declared with cluster_vultr_api_key
, it returns:
╷
│ Error: Unsupported argument
│
│ on main.tf line 6, in module "condor":
│ 6: api_key = var.api_key
│
│ An argument named "api_key" is not expected here.
╵
But if you only declare api_key
:
╷
│ Error: Missing required argument
│
│ on main.tf line 1, in module "condor":
│ 1: module "condor" {
│
│ The argument "cluster_vultr_api_key" is required, but no definition was found.
╵
My environment
Terraform v0.15.0
on linux_amd64
+ provider registry.terraform.io/hashicorp/http v2.0.0
+ provider registry.terraform.io/hashicorp/null v3.0.0
+ provider registry.terraform.io/hashicorp/random v3.0.1
+ provider registry.terraform.io/vultr/vultr v2.1.3
On a Debian 10.9 using WSL2. I've tried doing the exact same inside one of Vultr's VPS's and had the same results.
I remember that I could make it work by modifying the terraform-vultr-condor
plugin itself, but I didn't write down which changes I did to the Terraform's code.
I also work with other terraform states/plans in this machine and none of them presented similar errors, so I am not sure what could be the source of this problem. Maybe because it was originally developed prior to v0.13 changes? I will work on this and present a fork if I reach something worth commiting. Thank you.
This is not a bug. Please execute the ssh-add command to add your private key to your ssh-agent as noted in this link
This is not a bug. Please execute the ssh-add command to add your private key to your ssh-agent as noted in this link
The same thing happens:
user/projects/deployment via default
❯ eval `ssh-agent -s`
Agent pid 4131
user/projects/deployment via default
❯ ssh-add ~/.ssh/id_rsa
Identity added: /home/gruber/.ssh/id_rsa (host)
user/projects/deployment via default
❯ terraform plan
╷
│ Error: Missing required argument
│
│ The argument "api_key" is required, but was not set.
╵
If there was an error regarding the ssh-agent, wouldn't it be fixed with these commands? If not, is there any additional debugging information that I could provide to help understand what's happening?
@gruberdev Hello! The missing argument is for the Vultr provider, not the module. Please see this response from #31 for further details.
Additionally, I'll update the README to be more clear on provider configuration requirements.
@gruberdev Hello! The missing argument is for the Vultr provider, not the module. Please see this response from #31 for further details.
Additionally, I'll update the README to be more clear on provider configuration requirements.
That fixed it. Thank you for both the reply and for providing additional information on the README.