Skip to content
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

IBM Cloud Databases - Deprecate flat list of scaling attributes #3782

Merged
merged 8 commits into from
May 19, 2022
2 changes: 2 additions & 0 deletions ibm/service/database/data_source_ibm_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,13 @@ func DataSourceIBMDatabaseInstance() *schema.Resource {
Description: "Memory allocation required for cluster",
Type: schema.TypeInt,
Computed: true,
Deprecated: "This field is deprecated please use groups",
},
"members_disk_allocation_mb": {
Description: "Disk allocation required for cluster",
Type: schema.TypeInt,
Computed: true,
Deprecated: "This field is deprecated please use groups",
},
"platform_options": {
Description: "Platform-specific options for this deployment.r",
Expand Down
16 changes: 11 additions & 5 deletions ibm/service/database/resource_ibm_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,49 +206,55 @@ func ResourceIBMDatabaseInstance() *schema.Resource {
Optional: true,
Computed: true,
ConflictsWith: []string{"node_count", "node_memory_allocation_mb", "node_disk_allocation_mb", "node_cpu_allocation_count", "group"},
Deprecated: "This field is deprecated please use groups",
},
"members_disk_allocation_mb": {
Description: "Disk allocation required for cluster",
Type: schema.TypeInt,
Optional: true,
Computed: true,
ConflictsWith: []string{"node_count", "node_memory_allocation_mb", "node_disk_allocation_mb", "node_cpu_allocation_count", "group"},
Deprecated: "This field is deprecated please use groups",
},
"members_cpu_allocation_count": {
Description: "CPU allocation required for cluster",
Type: schema.TypeInt,
Optional: true,
Computed: true,
ConflictsWith: []string{"node_count", "node_memory_allocation_mb", "node_disk_allocation_mb", "node_cpu_allocation_count", "group"},
Deprecated: "This field is deprecated please use groups",
},
"node_count": {
Description: "Total number of nodes in the cluster",
Type: schema.TypeInt,
Optional: true,
Computed: true,
ConflictsWith: []string{"members_memory_allocation_mb", "members_disk_allocation_mb", "members_cpu_allocation_count", "group"},
Deprecated: "This field is deprecated please use groups",
},
"node_memory_allocation_mb": {
Description: "Memory allocation per node",
Type: schema.TypeInt,
Optional: true,
Computed: true,

Description: "Memory allocation per node",
Type: schema.TypeInt,
Optional: true,
Computed: true,
ConflictsWith: []string{"members_memory_allocation_mb", "members_disk_allocation_mb", "members_cpu_allocation_count", "group"},
Deprecated: "This field is deprecated please use groups",
},
"node_disk_allocation_mb": {
Description: "Disk allocation per node",
Type: schema.TypeInt,
Optional: true,
Computed: true,
ConflictsWith: []string{"members_memory_allocation_mb", "members_disk_allocation_mb", "members_cpu_allocation_count", "group"},
Deprecated: "This field is deprecated please use groups",
},
"node_cpu_allocation_count": {
Description: "CPU allocation per node",
Type: schema.TypeInt,
Optional: true,
Computed: true,
ConflictsWith: []string{"members_memory_allocation_mb", "members_disk_allocation_mb", "members_cpu_allocation_count", "group"},
Deprecated: "This field is deprecated please use groups",
},
"plan_validation": {
Description: "For elasticsearch and postgres perform database parameter validation during the plan phase. Otherwise, database parameter validation happens in apply phase.",
Expand Down
91 changes: 72 additions & 19 deletions website/docs/r/database.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,19 @@ resource "ibm_database" "<your_database>" {
tags = ["tag1", "tag2"]

adminpassword = "password12"
members_memory_allocation_mb = 3072
members_disk_allocation_mb = 61440

group {
group_id = "member"

memory {
allocation_mb = 14336
}

disk {
allocation_mb = 20480
}
Comment on lines +39 to +45
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should make sure these allocations are same as the "Small" T-Shirt sizes.
It will be different for each database type.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done :D

}

users {
name = "user123"
password = "password12"
Expand All @@ -51,7 +62,8 @@ output "ICD Etcd database connection string" {

```

### Sample database instance by using `node_` attributes
### **Deprecated** Sample database instance by using `node_` attributes
Please Note this has been deprecated: Please use the `group` attribute instead
An example to configure and deploy database by using `node_` attributes instead of `memory_`.

```terraform
Expand Down Expand Up @@ -215,8 +227,17 @@ resource "ibm_database" "cassandra" {
plan = "enterprise"
location = "us-south"
adminpassword = "password12"
members_memory_allocation_mb = 36864
members_disk_allocation_mb = 61440
group {
group_id = "member"

memory {
allocation_mb = 14336
}

disk {
allocation_mb = 20480
}
}
users {
name = "user123"
password = "password12"
Expand Down Expand Up @@ -251,8 +272,19 @@ resource "ibm_database" "mongodb" {
plan = "enterprise"
location = "us-south"
adminpassword = "password12"
members_disk_allocation_mb = 61440
members_memory_allocation_mb = 43008

group {
group_id = "member"

memory {
allocation_mb = 14336
}

disk {
allocation_mb = 20480
}
}

tags = ["one:two"]
users {
name = "dbuser"
Expand Down Expand Up @@ -364,8 +396,17 @@ resource "ibm_database" "edb" {
plan = "standard"
location = "us-south"
adminpassword = "password12"
members_memory_allocation_mb = 3072
members_disk_allocation_mb = 61440
group {
group_id = "member"

memory {
allocation_mb = 14336
}

disk {
allocation_mb = 20480
}
}
tags = ["one:two"]
users {
name = "user123"
Expand All @@ -392,9 +433,21 @@ data "ibm_resource_group" "test_acc" {

resource "ibm_database" "db" {
location = "us-east"
members_cpu_allocation_count = 0
members_disk_allocation_mb = 10240
members_memory_allocation_mb = 2048
group {
group_id = "member"

memory {
allocation_mb = 14336
}

disk {
allocation_mb = 20480
}

cpu {
allocation_count = 3
}
}
name = "telus-database"
service = "databases-for-postgresql"
plan = "standard"
Expand Down Expand Up @@ -498,13 +551,13 @@ Review the argument reference that you can specify for your resource.
Nested scheme for `cpu`:
- `allocation_count` - (Optional, Integer) Allocated dedicated CPU per-member.

- `members_memory_allocation_mb` - (Optional, Integer) The amount of memory in megabytes for the database, split across all members. If not specified, the default setting of the database service is used, which can vary by database type.
- `members_disk_allocation_mb` - (Optional, Integer) The amount of disk space for the database, split across all members. If not specified, the default setting of the database service is used, which can vary by database type.
- `members_cpu_allocation_count` - (Optional, Integer) Enables and allocates the number of specified dedicated cores to your deployment.
- `node_count` - (Optional, Integer) The total number of nodes in the cluster. If not specified defaults to the database minimum node count. These vary by database type. See the documentation related to each database for the defaults. https://cloud.ibm.com/docs/services/databases-for-postgresql/howto-provisioning.html#list-of-additional-parameters
- `node_cpu_allocation_count` - (Optional, Integer) Enables and allocates the number of specified dedicated cores to your deployment per node.
- `node_disk_allocation_mb` - (Optional, Integer) The disk size of the database per node. As above.
- `node_memory_allocation_mb` - (Optional,Integer) The memory size for the database per node. If not specified defaults to the database default. These vary by database type. See the documentation related to each database for the defaults. https://cloud.ibm.com/docs/services/databases-for-postgresql/howto-provisioning.html#list-of-additional-parameters
- `members_memory_allocation_mb` **Deprecated** - (Optional, Integer) The amount of memory in megabytes for the database, split across all members. If not specified, the default setting of the database service is used, which can vary by database type.
- `members_disk_allocation_mb` **Deprecated** - (Optional, Integer) The amount of disk space for the database, split across all members. If not specified, the default setting of the database service is used, which can vary by database type.
- `members_cpu_allocation_count` **Deprecated** - (Optional, Integer) Enables and allocates the number of specified dedicated cores to your deployment.
- `node_count` **Deprecated** - (Optional, Integer) The total number of nodes in the cluster. If not specified defaults to the database minimum node count. These vary by database type. See the documentation related to each database for the defaults. https://cloud.ibm.com/docs/services/databases-for-postgresql/howto-provisioning.html#list-of-additional-parameters
- `node_cpu_allocation_count` **Deprecated** - (Optional, Integer) Enables and allocates the number of specified dedicated cores to your deployment per node.
- `node_disk_allocation_mb` **Deprecated** - (Optional, Integer) The disk size of the database per node. As above.
- `node_memory_allocation_mb` **Deprecated** - (Optional,Integer) The memory size for the database per node. If not specified defaults to the database default. These vary by database type. See the documentation related to each database for the defaults. https://cloud.ibm.com/docs/services/databases-for-postgresql/howto-provisioning.html#list-of-additional-parameters

~> **Note:** `members_memory_allocation_mb`, `members_disk_allocation_mb`, `members_cpu_allocation_count` conflicts with `node_count`,`node_cpu_allocation_count`, `node_disk_allocation_mb`, `node_memory_allocation_mb`. `group` conflicts with `node_` and `members_` arguments. Either members, node, or group arguments have to be provided.
- `name` - (Required, String) A descriptive name that is used to identify the database instance. The name must not include spaces.
Expand Down