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 (
|
import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
@ -22,6 +23,20 @@ type providerConfiguration struct {
|
|||||||
|
|
||||||
// Provider - Terrafrom properties for proxmox
|
// Provider - Terrafrom properties for proxmox
|
||||||
func Provider() *schema.Provider {
|
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{
|
return &schema.Provider{
|
||||||
|
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
@ -54,12 +69,7 @@ func Provider() *schema.Provider {
|
|||||||
Optional: true,
|
Optional: true,
|
||||||
Default: false,
|
Default: false,
|
||||||
},
|
},
|
||||||
"pm_otp": {
|
"pm_otp": &pmOTPprompt,
|
||||||
Type: schema.TypeString,
|
|
||||||
Optional: true,
|
|
||||||
DefaultFunc: schema.EnvDefaultFunc("PM_OTP", ""),
|
|
||||||
Description: "OTP 2FA code (if required)",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
ResourcesMap: map[string]*schema.Resource{
|
ResourcesMap: map[string]*schema.Resource{
|
||||||
|
Loading…
Reference in New Issue
Block a user