Document login ENV.

Change agent default to match proxmox default
This commit is contained in:
Grant Gongaware 2019-05-21 19:24:15 -07:00
parent f7bc26dfe8
commit 24a4408337
2 changed files with 95 additions and 70 deletions

View File

@ -29,9 +29,21 @@ make install
Recommended ISO builder https://github.com/Telmate/terraform-ubuntu-proxmox-iso
## Credentials
```bash
# Credentials and URL optionally defined in the environment
export PM_API_URL="https://xxxx.com:8006/api2/json"
export PM_USER=user@pam
export PM_PASS=password
```
## Run
```
terraform init
terraform plan
terraform apply
```
@ -41,6 +53,12 @@ main.tf:
```
provider "proxmox" {
pm_tls_insecure = true
/*
// Credentials here or environment
pm_api_url = "https://proxmox-server01.example.com:8006/api2/json"
pm_password = "secret"
pm_user = "terraform-user@pve"
*/
}
/* Uses cloud-init options from Proxmox 5.2 */

View File

@ -50,7 +50,7 @@ func resourceVmQemu() *schema.Resource {
"agent": {
Type: schema.TypeInt,
Optional: true,
Default: 1,
Default: 0,
},
"iso": {
Type: schema.TypeString,
@ -66,6 +66,12 @@ func resourceVmQemu() *schema.Resource {
Type: schema.TypeString,
Optional: true,
Default: "l26",
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
if new == "l26" {
return len(d.Get("clone").(string)) > 0 // the cloned source may have a different os, which we shoud leave alone
}
return strings.TrimSpace(old) == strings.TrimSpace(new)
},
},
"memory": {
Type: schema.TypeInt,
@ -589,6 +595,7 @@ func resourceVmQemuRead(d *schema.ResourceData, meta interface{}) error {
d.Set("name", config.Name)
d.Set("desc", config.Description)
d.Set("onboot", config.Onboot)
d.Set("agent", config.Agent)
d.Set("memory", config.Memory)
d.Set("cores", config.QemuCores)
d.Set("sockets", config.QemuSockets)