mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-07-05 21:43:59 +00:00
fix: handling datastore_id
in LXC template (#180)
This commit is contained in:
parent
27665554de
commit
63dc5cb8f6
@ -1,6 +1,10 @@
|
||||
resource "proxmox_virtual_environment_container" "example_template" {
|
||||
description = "Managed by Terraform"
|
||||
|
||||
disk {
|
||||
datastore_id = element(data.proxmox_virtual_environment_datastores.example.datastore_ids, index(data.proxmox_virtual_environment_datastores.example.datastore_ids, "local-lvm"))
|
||||
}
|
||||
|
||||
initialization {
|
||||
dns {
|
||||
server = "1.1.1.1"
|
||||
@ -37,6 +41,10 @@ resource "proxmox_virtual_environment_container" "example_template" {
|
||||
}
|
||||
|
||||
resource "proxmox_virtual_environment_container" "example" {
|
||||
disk {
|
||||
datastore_id = element(data.proxmox_virtual_environment_datastores.example.datastore_ids, index(data.proxmox_virtual_environment_datastores.example.datastore_ids, "local-lvm"))
|
||||
}
|
||||
|
||||
clone {
|
||||
vm_id = proxmox_virtual_environment_container.example_template.id
|
||||
}
|
||||
|
@ -1393,12 +1393,12 @@ func resourceVirtualEnvironmentContainerRead(ctx context.Context, d *schema.Reso
|
||||
|
||||
if len(clone) > 0 {
|
||||
if len(currentDisk) > 0 {
|
||||
err := d.Set(mkResourceVirtualEnvironmentContainerDiskDatastoreID, []interface{}{disk})
|
||||
err := d.Set(mkResourceVirtualEnvironmentContainerDisk, []interface{}{disk})
|
||||
diags = append(diags, diag.FromErr(err)...)
|
||||
}
|
||||
} else if len(currentDisk) > 0 ||
|
||||
disk[mkResourceVirtualEnvironmentContainerDiskDatastoreID] != dvResourceVirtualEnvironmentContainerDiskDatastoreID {
|
||||
err := d.Set(mkResourceVirtualEnvironmentContainerDiskDatastoreID, []interface{}{disk})
|
||||
err := d.Set(mkResourceVirtualEnvironmentContainerDisk, []interface{}{disk})
|
||||
diags = append(diags, diag.FromErr(err)...)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user