|
| 1 | +package baremetal |
| 2 | + |
| 3 | +import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" |
| 4 | + |
| 5 | +func PartitioningSchema() *schema.Schema { |
| 6 | + return &schema.Schema{ |
| 7 | + Type: schema.TypeList, |
| 8 | + Optional: true, |
| 9 | + Description: "Configuration for partitioning schema.", |
| 10 | + Elem: &schema.Resource{ |
| 11 | + Schema: map[string]*schema.Schema{ |
| 12 | + "disks": { |
| 13 | + Type: schema.TypeList, |
| 14 | + Optional: true, |
| 15 | + Description: "List of disks with partitions.", |
| 16 | + Elem: &schema.Resource{ |
| 17 | + Schema: map[string]*schema.Schema{ |
| 18 | + "device": { |
| 19 | + Type: schema.TypeString, |
| 20 | + Required: true, |
| 21 | + Description: "Device name (e.g., /dev/nvme0n1).", |
| 22 | + }, |
| 23 | + "partitions": { |
| 24 | + Type: schema.TypeList, |
| 25 | + Optional: true, |
| 26 | + Description: "Partitions for the disk.", |
| 27 | + Elem: &schema.Resource{ |
| 28 | + Schema: map[string]*schema.Schema{ |
| 29 | + "label": { |
| 30 | + Type: schema.TypeString, |
| 31 | + Required: true, |
| 32 | + Description: "Partition label.", |
| 33 | + }, |
| 34 | + "number": { |
| 35 | + Type: schema.TypeInt, |
| 36 | + Required: true, |
| 37 | + Description: "Partition number.", |
| 38 | + }, |
| 39 | + "size": { |
| 40 | + Type: schema.TypeInt, |
| 41 | + Required: true, |
| 42 | + Description: "Partition size in bytes.", |
| 43 | + }, |
| 44 | + }, |
| 45 | + }, |
| 46 | + }, |
| 47 | + }, |
| 48 | + }, |
| 49 | + }, |
| 50 | + "raids": { |
| 51 | + Type: schema.TypeList, |
| 52 | + Optional: true, |
| 53 | + Description: "RAID configurations.", |
| 54 | + Elem: &schema.Resource{ |
| 55 | + Schema: map[string]*schema.Schema{ |
| 56 | + "name": { |
| 57 | + Type: schema.TypeString, |
| 58 | + Required: true, |
| 59 | + Description: "Name of the RAID device.", |
| 60 | + }, |
| 61 | + "level": { |
| 62 | + Type: schema.TypeString, |
| 63 | + Required: true, |
| 64 | + Description: "RAID level.", |
| 65 | + }, |
| 66 | + "devices": { |
| 67 | + Type: schema.TypeList, |
| 68 | + Required: true, |
| 69 | + Elem: &schema.Schema{ |
| 70 | + Type: schema.TypeString, |
| 71 | + }, |
| 72 | + Description: "Devices in the RAID.", |
| 73 | + }, |
| 74 | + }, |
| 75 | + }, |
| 76 | + }, |
| 77 | + "filesystems": { |
| 78 | + Type: schema.TypeList, |
| 79 | + Optional: true, |
| 80 | + Description: "Filesystem configurations.", |
| 81 | + Elem: &schema.Resource{ |
| 82 | + Schema: map[string]*schema.Schema{ |
| 83 | + "device": { |
| 84 | + Type: schema.TypeString, |
| 85 | + Required: true, |
| 86 | + Description: "Device name for the filesystem.", |
| 87 | + }, |
| 88 | + "format": { |
| 89 | + Type: schema.TypeString, |
| 90 | + Required: true, |
| 91 | + Description: "Filesystem format.", |
| 92 | + }, |
| 93 | + "mountpoint": { |
| 94 | + Type: schema.TypeString, |
| 95 | + Required: true, |
| 96 | + Description: "Mountpoint for the filesystem.", |
| 97 | + }, |
| 98 | + }, |
| 99 | + }, |
| 100 | + }, |
| 101 | + "zfs": { |
| 102 | + Type: schema.TypeList, |
| 103 | + Optional: true, |
| 104 | + Description: "ZFS configurations.", |
| 105 | + Elem: &schema.Resource{ |
| 106 | + Schema: map[string]*schema.Schema{ |
| 107 | + "pools": { |
| 108 | + Type: schema.TypeList, |
| 109 | + Optional: true, |
| 110 | + Description: "List of ZFS pools.", |
| 111 | + Elem: &schema.Resource{ |
| 112 | + Schema: map[string]*schema.Schema{ |
| 113 | + "name": { |
| 114 | + Type: schema.TypeString, |
| 115 | + Required: true, |
| 116 | + Description: "Name of the ZFS pool.", |
| 117 | + }, |
| 118 | + "type": { |
| 119 | + Type: schema.TypeString, |
| 120 | + Required: true, |
| 121 | + Description: "Type of the ZFS pool (e.g., mirror, raidz).", |
| 122 | + }, |
| 123 | + "devices": { |
| 124 | + Type: schema.TypeList, |
| 125 | + Required: true, |
| 126 | + Elem: &schema.Schema{ |
| 127 | + Type: schema.TypeString, |
| 128 | + }, |
| 129 | + Description: "Devices in the ZFS pool.", |
| 130 | + }, |
| 131 | + "options": { |
| 132 | + Type: schema.TypeList, |
| 133 | + Optional: true, |
| 134 | + Elem: &schema.Schema{ |
| 135 | + Type: schema.TypeString, |
| 136 | + }, |
| 137 | + Description: "Options for the ZFS pool.", |
| 138 | + }, |
| 139 | + }, |
| 140 | + }, |
| 141 | + }, |
| 142 | + }, |
| 143 | + }, |
| 144 | + }, |
| 145 | + }, |
| 146 | + }, |
| 147 | + } |
| 148 | +} |
0 commit comments