You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Terraform v1.4.5
on linux_amd64
+ provider registry.terraform.io/namecheap/namecheap v2.1.0
Namecheap provider version
namecheap/namecheap v2.1.0
Affected Resource(s)
The namecheap Terraform provider.
Terraform Configuration Files
Irrelevant for this report.
Debug Output
Irrelevant for this report.
Expected Behavior
The documentation, under Argument Reference, mentions that the provider arguments can be set via environment variables. This is, in fact, preferred as you shouldn't hard-code sensitive data in your Terraform configuration.
Thus, I expected to be able to declare an empty namecheap provider without any warnings:
providernamecheap {}
Actual Behavior
My IDE warns me that api_key, api_user, and user_name are required and missing:
Luckily, this is only a warning, because supplying the appropriate NAMECHEAP_* environment variables works as expected.
Steps to Reproduce
Given a Terraform config:
Add namecheap version 2.1.0 as a required provider
terraform {
required_providers {
# Other provider data...namecheap={
source ="namecheap/namecheap"
version ="2.1.0"
}
}
}
Create a namecheap provider with no arguments:
providernamecheap {}
Depending on the capabilities of your IDE, you should have a warning of sorts pop up. For reference, I'm using IntelliJ IDEA Ultimate with the official Terraform plugin.
Important Factoids
Looking at the provider source, the properties that are logically required are also programmatically flagged with Required: true, while also having a DefaultFunc pointing to the respective environment variable.
If a property has a default, why should it be required? Or if it is required, then what is the purpose of a default value?
I would recommend Replacing the Required: true with Optional: true because that is what these properties are. For inspiration, the AWS provider does the same. They don't use DefaultFunc but rather a configure function to ensure that the configuration is always complete, however the end result is the same.
The text was updated successfully, but these errors were encountered:
Terraform Version
Namecheap provider version
Affected Resource(s)
The namecheap Terraform provider.
Terraform Configuration Files
Irrelevant for this report.
Debug Output
Irrelevant for this report.
Expected Behavior
The documentation, under Argument Reference, mentions that the provider arguments can be set via environment variables. This is, in fact, preferred as you shouldn't hard-code sensitive data in your Terraform configuration.
Thus, I expected to be able to declare an empty
namecheap
provider without any warnings:Actual Behavior
My IDE warns me that
api_key
,api_user
, anduser_name
are required and missing:Luckily, this is only a warning, because supplying the appropriate
NAMECHEAP_*
environment variables works as expected.Steps to Reproduce
Given a Terraform config:
namecheap
version2.1.0
as a required providernamecheap
provider with no arguments:Important Factoids
Looking at the provider source, the properties that are logically required are also programmatically flagged with
Required: true
, while also having aDefaultFunc
pointing to the respective environment variable.If a property has a default, why should it be required? Or if it is required, then what is the purpose of a default value?
I would recommend Replacing the
Required: true
withOptional: true
because that is what these properties are. For inspiration, the AWS provider does the same. They don't useDefaultFunc
but rather aconfigure
function to ensure that the configuration is always complete, however the end result is the same.The text was updated successfully, but these errors were encountered: