-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Summary
Currently, the plugin configuration settings for sshPort and sslPort are optional. It is expected that in the case these are not provided the plugin shall sets these to 22 and 443 accordingly.
However it doesn't happen due to the following code in provider.go:
// Configure configures the resource provider with "globals" that control its behavior.
func (p *esxiProvider) Configure(_ context.Context, req *pulumirpc.ConfigureRequest) (*pulumirpc.ConfigureResponse, error) {
vars := req.GetVariables()
host, hostErr := getConfig(vars, "host", "ESXI_HOST")
user, userErr := getConfig(vars, "username", "ESXI_USERNAME")
pass, passErr := getConfig(vars, "password", "ESXI_PASSWORD")
sshPort, sshPortErr := getConfig(vars, "sshPort", "ESXI_SSH_PORT")
sslPort, sslPortErr := getConfig(vars, "sslPort", "ESXI_SSL_PORT")
if len(sshPort) > 0 {
sshPort = "22"
}
if len(sslPort) > 0 {
sslPort = "443"
}
Basically, if the value sshPort is not provided (it is nil) then len(sshPort) should be 0.
Therefore if len(sshPort) > 0 is never true in this scenario and the default value is not assigned.
Also it is correct to say that if sshPort is set to any other valid value, 2222 for example, then this code will change it back to 22.
I've tried it on my local dev box, the port was set to 2222 in the config, but still got a connection to ESXi host ssh listening over the port 22
Diagnostics
Plugin version 1.0.0
Paste the logs from the provider error
N/A
Message from the maintainers:
Impacted by this bug? Give it a ๐. We prioritise the issues with the most ๐.