|
|
@ -47,8 +47,14 @@ func resourceDiskCreate(d *schema.ResourceData, m interface{}) error {
|
|
|
|
urlValues.Add("name", d.Get("name").(string))
|
|
|
|
urlValues.Add("name", d.Get("name").(string))
|
|
|
|
urlValues.Add("size", fmt.Sprintf("%d", d.Get("size").(int)))
|
|
|
|
urlValues.Add("size", fmt.Sprintf("%d", d.Get("size").(int)))
|
|
|
|
urlValues.Add("type", "D") // NOTE: only disks of Data type are managed via plugin
|
|
|
|
urlValues.Add("type", "D") // NOTE: only disks of Data type are managed via plugin
|
|
|
|
urlValues.Add("sep_id", fmt.Sprintf("%d", d.Get("sep_id").(int)))
|
|
|
|
|
|
|
|
urlValues.Add("pool", d.Get("pool").(string))
|
|
|
|
if sepId, ok := d.GetOk("sep_id"); ok {
|
|
|
|
|
|
|
|
urlValues.Add("sep_id", strconv.Itoa(sepId.(int)))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if poolName, ok := d.GetOk("pool"); ok {
|
|
|
|
|
|
|
|
urlValues.Add("pool", poolName.(string))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
argVal, argSet := d.GetOk("description")
|
|
|
|
argVal, argSet := d.GetOk("description")
|
|
|
|
if argSet {
|
|
|
|
if argSet {
|
|
|
@ -198,7 +204,7 @@ func resourceDiskSchemaMake() map[string]*schema.Schema {
|
|
|
|
rets := map[string]*schema.Schema{
|
|
|
|
rets := map[string]*schema.Schema{
|
|
|
|
"name": {
|
|
|
|
"name": {
|
|
|
|
Type: schema.TypeString,
|
|
|
|
Type: schema.TypeString,
|
|
|
|
Optional: true,
|
|
|
|
Required: true,
|
|
|
|
Description: "Name of this disk. NOTE: disk names are NOT unique within an account. If disk ID is specified, disk name is ignored.",
|
|
|
|
Description: "Name of this disk. NOTE: disk names are NOT unique within an account. If disk ID is specified, disk name is ignored.",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
@ -210,23 +216,23 @@ func resourceDiskSchemaMake() map[string]*schema.Schema {
|
|
|
|
|
|
|
|
|
|
|
|
"account_id": {
|
|
|
|
"account_id": {
|
|
|
|
Type: schema.TypeInt,
|
|
|
|
Type: schema.TypeInt,
|
|
|
|
Optional: true,
|
|
|
|
Required: true,
|
|
|
|
Description: "ID of the account this disk belongs to.",
|
|
|
|
Description: "ID of the account this disk belongs to.",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
"sep_id": {
|
|
|
|
"sep_id": {
|
|
|
|
Type: schema.TypeInt,
|
|
|
|
Type: schema.TypeInt,
|
|
|
|
Required: true,
|
|
|
|
Optional: true,
|
|
|
|
|
|
|
|
Computed: true,
|
|
|
|
ForceNew: true,
|
|
|
|
ForceNew: true,
|
|
|
|
ValidateFunc: validation.IntAtLeast(1),
|
|
|
|
|
|
|
|
Description: "Storage end-point provider serving this disk. Cannot be changed for existing disk.",
|
|
|
|
Description: "Storage end-point provider serving this disk. Cannot be changed for existing disk.",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
"pool": {
|
|
|
|
"pool": {
|
|
|
|
Type: schema.TypeString,
|
|
|
|
Type: schema.TypeString,
|
|
|
|
Required: true,
|
|
|
|
Optional: true,
|
|
|
|
|
|
|
|
Computed: true,
|
|
|
|
ForceNew: true,
|
|
|
|
ForceNew: true,
|
|
|
|
ValidateFunc: validation.StringIsNotEmpty,
|
|
|
|
|
|
|
|
Description: "Pool where this disk is located. Cannot be changed for existing disk.",
|
|
|
|
Description: "Pool where this disk is located. Cannot be changed for existing disk.",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|