0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-06-30 18:42:58 +00:00
terraform-provider-proxmox/fwprovider/vm/datasource_schema.go
Pavel Boldyrev d843e46b37
misc(vm2): add support for vga (#1328)
* misc(vm2): add support for `vga`
* fix: use random VM IDs in parallel acc tests

---------

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-05-27 21:30:12 -04:00

68 lines
2.1 KiB
Go

package vm
import (
"context"
"github.com/hashicorp/terraform-plugin-framework-timeouts/resource/timeouts"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/bpg/terraform-provider-proxmox/fwprovider/types/stringset"
"github.com/bpg/terraform-provider-proxmox/fwprovider/vm/cpu"
"github.com/bpg/terraform-provider-proxmox/fwprovider/vm/vga"
)
// Schema defines the schema for the resource.
func (d *Datasource) Schema(
ctx context.Context,
_ datasource.SchemaRequest,
resp *datasource.SchemaResponse,
) {
resp.Schema = schema.Schema{
Description: "This is an experimental implementation of a Proxmox VM datasource using Plugin Framework.",
Attributes: map[string]schema.Attribute{
"clone": schema.SingleNestedAttribute{
Description: "The cloning configuration.",
Optional: true,
Attributes: map[string]schema.Attribute{
"id": schema.Int64Attribute{
Description: "The ID of the VM to clone.",
Required: true,
},
"retries": schema.Int64Attribute{
Description: "The number of retries to perform when cloning the VM (default: 3).",
Optional: true,
Computed: true,
},
},
},
"cpu": cpu.DataSourceSchema(),
"description": schema.StringAttribute{
Description: "The description of the VM.",
Optional: true,
},
"id": schema.Int64Attribute{
Required: true,
Description: "The unique identifier of the VM in the Proxmox cluster.",
},
"name": schema.StringAttribute{
Description: "The name of the VM.",
Optional: true,
},
"node_name": schema.StringAttribute{
Description: "The name of the node where the VM is provisioned.",
Required: true,
},
"tags": stringset.ResourceAttribute("The tags assigned to the VM.", ""),
"template": schema.BoolAttribute{
Description: "Whether the VM is a template.",
Optional: true,
},
"timeouts": timeouts.Attributes(ctx, timeouts.Opts{
Read: true,
}),
"vga": vga.DataSourceSchema(),
},
}
}