Skip to content

Commit 9deb0ac

Browse files
committed
Add disk size in database resource creation
1 parent a426420 commit 9deb0ac

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

ovh/resource_cloud_project_database.go

+5
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,11 @@ func resourceCloudProjectDatabase() *schema.Resource {
180180
Description: "Current status of the cluster",
181181
Computed: true,
182182
},
183+
"disk_size": {
184+
Type: schema.TypeInt,
185+
Description: "Disk size attributes of the cluster",
186+
Optional: true,
187+
},
183188
},
184189
}
185190
}

ovh/types_cloud_project_database.go

+12
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,16 @@ type CloudProjectDatabaseCreateOpts struct {
129129
Description string `json:"description,omitempty"`
130130
NetworkId string `json:"networkId,omitempty"`
131131
NodesPattern CloudProjectDatabaseNodesPattern `json:"nodesPattern,omitempty"`
132+
Disk CloudProjectDatabaseDisk `json:"disk,omitempty"`
132133
Plan string `json:"plan"`
133134
SubnetId string `json:"subnetId,omitempty"`
134135
Version string `json:"version"`
135136
}
136137

138+
type CloudProjectDatabaseDisk struct {
139+
Size int `json:"size"`
140+
}
141+
137142
type CloudProjectDatabaseNodesPattern struct {
138143
Flavor string `json:"flavor"`
139144
Number int `json:"number"`
@@ -164,6 +169,13 @@ func (opts *CloudProjectDatabaseCreateOpts) FromResource(d *schema.ResourceData)
164169
opts.SubnetId = nodes[0].SubnetId
165170
opts.Version = d.Get("version").(string)
166171

172+
diskSize, ok := d.Get("disk_size").(int)
173+
if ok {
174+
if diskSize < 0 {
175+
return fmt.Errorf("the disk size needs to be positive"), nil
176+
}
177+
opts.Disk = CloudProjectDatabaseDisk{diskSize}
178+
}
167179
return nil, opts
168180
}
169181

website/docs/r/cloud_project_database.html.markdown

+3
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ The following arguments are supported:
207207

208208
* `opensearch_acls_enabled` - (Optional) Defines whether the ACLs are enabled on an OpenSearch cluster
209209

210+
* `disk_size` - (Optional) Defines the disk size of the database service.
211+
210212
* `plan` - (Required) Plan of the cluster.
211213
Enum: "essential", "business", "enterprise".
212214

@@ -243,6 +245,7 @@ The following attributes are exported:
243245
* `plan` - See Argument Reference above.
244246
* `status` - Current status of the cluster.
245247
* `version` - See Argument Reference above.
248+
* `disk_size` - See Argument Reference above.
246249

247250
## Timeouts
248251

0 commit comments

Comments
 (0)