mirror of
https://github.com/letic/terraform-provider-proxmox.git
synced 2024-09-28 22:16:03 +00:00
Merge pull request #75 from Telmate/pm_otp_prompt
support PM_OTP_PROMPT for ondemand interactive OTP
This commit is contained in:
commit
a97425157e
@ -3,6 +3,7 @@ package proxmox
|
||||
import (
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"os"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"sync"
|
||||
@ -22,6 +23,20 @@ type providerConfiguration struct {
|
||||
|
||||
// Provider - Terrafrom properties for proxmox
|
||||
func Provider() *schema.Provider {
|
||||
pmOTPprompt := schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
DefaultFunc: schema.EnvDefaultFunc("PM_OTP", ""),
|
||||
Description: "OTP 2FA code (if required)",
|
||||
}
|
||||
if os.Getenv("PM_OTP_PROMPT") == "1" {
|
||||
pmOTPprompt = schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
DefaultFunc: schema.EnvDefaultFunc("PM_OTP", nil),
|
||||
Description: "OTP 2FA code (if required)",
|
||||
}
|
||||
}
|
||||
return &schema.Provider{
|
||||
|
||||
Schema: map[string]*schema.Schema{
|
||||
@ -54,12 +69,7 @@ func Provider() *schema.Provider {
|
||||
Optional: true,
|
||||
Default: false,
|
||||
},
|
||||
"pm_otp": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
DefaultFunc: schema.EnvDefaultFunc("PM_OTP", ""),
|
||||
Description: "OTP 2FA code (if required)",
|
||||
},
|
||||
"pm_otp": &pmOTPprompt,
|
||||
},
|
||||
|
||||
ResourcesMap: map[string]*schema.Resource{
|
||||
|
Loading…
Reference in New Issue
Block a user