-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add disk in database resource creation #333
Changes from 1 commit
9deb0ac
7ceaa57
711d1e7
196d291
184179f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,11 +129,16 @@ type CloudProjectDatabaseCreateOpts struct { | |
Description string `json:"description,omitempty"` | ||
NetworkId string `json:"networkId,omitempty"` | ||
NodesPattern CloudProjectDatabaseNodesPattern `json:"nodesPattern,omitempty"` | ||
Disk CloudProjectDatabaseDisk `json:"disk,omitempty"` | ||
Plan string `json:"plan"` | ||
SubnetId string `json:"subnetId,omitempty"` | ||
Version string `json:"version"` | ||
} | ||
|
||
type CloudProjectDatabaseDisk struct { | ||
Size int `json:"size"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. omitempty |
||
} | ||
|
||
type CloudProjectDatabaseNodesPattern struct { | ||
Flavor string `json:"flavor"` | ||
Number int `json:"number"` | ||
|
@@ -164,6 +169,13 @@ func (opts *CloudProjectDatabaseCreateOpts) FromResource(d *schema.ResourceData) | |
opts.SubnetId = nodes[0].SubnetId | ||
opts.Version = d.Get("version").(string) | ||
|
||
diskSize, ok := d.Get("disk_size").(int) | ||
if ok { | ||
if diskSize < 0 { | ||
return fmt.Errorf("the disk size needs to be positive"), nil | ||
} | ||
opts.Disk = CloudProjectDatabaseDisk{diskSize} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need with both previous validateFunc and the omitempty. opts.Disk = CloudProjectDatabaseDisk{
Size: d.Get("disk_size").(int)
} like CloudProjectDatabaseM3dbNamespaceCreateOpts Retention field |
||
return nil, opts | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -207,6 +207,8 @@ The following arguments are supported: | |||||
|
||||||
* `opensearch_acls_enabled` - (Optional) Defines whether the ACLs are enabled on an OpenSearch cluster | ||||||
|
||||||
* `disk_size` - (Optional) Defines the disk size of the database service. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to know the unit too?
As a user I don't know "80" what? :-) |
||||||
|
||||||
* `plan` - (Required) Plan of the cluster. | ||||||
Enum: "essential", "business", "enterprise". | ||||||
|
||||||
|
@@ -243,6 +245,7 @@ The following attributes are exported: | |||||
* `plan` - See Argument Reference above. | ||||||
* `status` - Current status of the cluster. | ||||||
* `version` - See Argument Reference above. | ||||||
* `disk_size` - See Argument Reference above. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if you add disk_type as computed, need it here |
||||||
|
||||||
## Timeouts | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use
ValidateFunc
to check here thatdisk_size
is > 0.Like in
ovh/resource_cloud_project_database_kafka_topic.go