-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from IBM-Cloud/Release3.3.0
Release3.3.0
- Loading branch information
Showing
58 changed files
with
2,543 additions
and
776 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
################################################################################################### | ||
################################################################################################### | ||
##### This Terraform file defines the variables used in dbaas Module ###### | ||
##### db Module ###### | ||
################################################################################################### | ||
################################################################################################### | ||
|
||
locals { | ||
service = "databases-for-mysql" # The type of Cloud Databases that you want to create. Currently support for only 'databases-for-mysql'. | ||
plan = "standard" # The name of the service plan that you choose for your instance. All databases use 'standard'. The 'enterprise' is supported only for cassandra and mongodb | ||
db_version = "5.7" # The database version for the mysql dbaas service | ||
member_cpu_allocation_count = 3 # Enables and allocates dedicated CPU per-member to your deployment. Member group cpu must be >= 3 and <= 28 in increments of 1. | ||
member_disk_allocation_mb = 20480 # The amount of disk space for the database, allocated per-member. Member group disk must be >= 20480 and <= 4194304 in increments of 1024. | ||
member_memory_allocation_mb = 1024 # The amount of memory in megabytes for the database, allocated per-member. Member group memory must be >= 1024 and <= 114688 in increments of 128. | ||
users = null # Type = set(map(string)), Database Users. It is set of username and passwords example: [{ "name"= "" "password" = ""}, { "name"= "" "password" = ""}] | ||
create_timeout = "1h" # The creation of an instance is considered failed when no response is received for create_timeout minutes. | ||
update_timeout = "1h" # The update of an instance is considered failed when no response is received for update_timeout minutes. | ||
delete_timeout = "15m" # The deletion of an instance is considered failed when no response is received for delete_timeout minutes. | ||
auto_scaling = [{ # Type = set(map(string)), Configure rules to allow your database to automatically increase its resources. Single block of autoscaling is allowed at once. | ||
/** | ||
* Autoscale Disk: | ||
* note -> [Disk cannot be scaled down] | ||
* Perform autoscaling: [When to scale, based on usage over a period of time] | ||
* When either | ||
* -> Average I/O utilisation is above <io_above_percent> over a <io_over_period> period | ||
* or | ||
* -> when less than <free_space_less_than_percent> free space is remaining | ||
* Then | ||
* Scale up by <rate_increase_percent> every <rate_period_seconds> to a limit of <rate_limit_mb_per_member> per member | ||
* [ A hard limit on scaling, the deployment stops scaling at the limit ] | ||
*/ | ||
"disk" = { | ||
"capacity_enabled" = true # (Optional, Bool) Auto scaling scalar enables or disables the scalar capacity. | ||
"free_space_less_than_percent" = 15 # (Optional, Integer) Auto scaling scalar capacity free space less than percent. | ||
"io_above_percent" = 85 # (Optional, Integer) Auto scaling scalar I/O utilization above percent. | ||
"io_enabled" = true # (Optional, String) Auto scaling scalar I/O utilization over period. | ||
"io_over_period" = "15m" # (Optional, Bool) Auto scaling scalar I/O utilization enabled. | ||
"rate_increase_percent" = 15 # (Optional, Integer) Auto scaling rate increase percent. | ||
"rate_limit_mb_per_member" = 3670016 # (Optional, Integer) Auto scaling rate limit in megabytes per member. Max limit is 3TB. | ||
"rate_period_seconds" = 900 # (Optional, Integer) Auto scaling rate period in seconds. | ||
"rate_units" = "mb" # (Optional, String) Auto scaling rate in units. | ||
} | ||
/** | ||
* Autoscale Memory/RAM : | ||
* Perform autoscaling: | ||
* When [When to scale, based on usage over a period of time] | ||
* -> Average I/O utilisation is above <io_above_percent> over a <io_over_period> period | ||
* Then | ||
* Scale up by <rate_increase_percent> every <rate_period_seconds> to a limit of <rate_limit_mb_per_member> per member | ||
* [ A hard limit on scaling, the deployment stops scaling at the limit ] | ||
*/ | ||
"memory" = { | ||
"io_above_percent" = 90 # (Optional, Integer) Auto scaling scalar I/O utilization above percent. | ||
"io_enabled" = true # (Optional) Auto scaling scalar I/O utilization enabled. | ||
"io_over_period" = "15m" # (Optional, String) Auto scaling scalar I/O utilization over period. | ||
"rate_increase_percent" = 10 # (Optional, Integer) Auto scaling rate in increase percent. | ||
"rate_limit_mb_per_member" = 114688 # (Optional, Integer) Auto scaling rate limit in megabytes per member. Max limit is 114688MB which is 112GB. | ||
"rate_period_seconds" = 900 # (Optional, Integer) Auto scaling rate period in seconds. | ||
"rate_units" = "mb" # (Optional, String) Auto scaling rate in units. | ||
} | ||
} | ||
] | ||
whitelist = null # Type = set(map(string)), Database Whitelist It is set of IP Address and description, example: [{ "address"= "10.248.0.4/32" "description" = ""}, { "address"= "10.248.64.4/32" "description" = ""}] | ||
tags = null # Type = set(string), Tags to the dbaas service, example : ["tag1", "tag2"] | ||
key_protect_instance = null # The instance CRN of a Key Management Services like Key Protect or Hyper Protect Crypto Service (HPCS) that you want to use for disk encryption. | ||
key_protect_key = null # The root key CRN of a Key Management Services like Key Protect or Hyper Protect Crypto Service (HPCS) that you want to use for disk encryption. | ||
backup_id = null # The CRN of a backup resource to restore from. The backup is created by a database deployment with the same service ID. | ||
backup_encryption_key_crn = null # The CRN of a key protect key, that you want to use for encrypting disk that holds deployment backups. | ||
remote_leader_id = null # A CRN of the leader database to make the replica(read-only) deployment. The leader database is created by a database deployment with the same service ID. | ||
} | ||
|
||
/** | ||
* Name: db_access_endpoints | ||
* Type: String | ||
* Description: Allowed network of database instance. It could be 'private', 'public' or 'public-and-private'. | ||
*/ | ||
variable "db_access_endpoints" { | ||
description = "Allowed network of database instance" | ||
type = string | ||
default = "private" | ||
} | ||
|
||
/** | ||
* Name: db_enable_autoscaling | ||
* Type: String | ||
* Description: Enable db autoscaling | ||
*/ | ||
variable "db_enable_autoscaling" { | ||
description = "Enable db autoscaling." | ||
type = bool | ||
default = false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
## Requirements | ||
|
||
No requirements. | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_ibm"></a> [ibm](#provider\_ibm) | 1.33.1 | | ||
|
||
## Modules | ||
|
||
No modules. | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [ibm_is_instance.db](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/is_instance) | resource | | ||
| [ibm_is_volume.data_volume](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/is_volume) | resource | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_bandwidth"></a> [bandwidth](#input\_bandwidth) | Bandwidth per second in GB. The possible values are 3, 5 and 10 | `number` | n/a | yes | | ||
| <a name="input_data_vol_size"></a> [data\_vol\_size](#input\_data\_vol\_size) | Storage size in GB. The value should be between 10 and 2000 | `number` | n/a | yes | | ||
| <a name="input_db_image"></a> [db\_image](#input\_db\_image) | Image for DB VSI | `string` | n/a | yes | | ||
| <a name="input_db_profile"></a> [db\_profile](#input\_db\_profile) | DB Profile | `string` | n/a | yes | | ||
| <a name="input_db_sg"></a> [db\_sg](#input\_db\_sg) | DB Security Group | `string` | n/a | yes | | ||
| <a name="input_db_vsi_count"></a> [db\_vsi\_count](#input\_db\_vsi\_count) | Please enter the total number of instances you want to create in each zones. | `any` | n/a | yes | | ||
| <a name="input_prefix"></a> [prefix](#input\_prefix) | Prefix for all the resources. | `string` | n/a | yes | | ||
| <a name="input_resource_group_id"></a> [resource\_group\_id](#input\_resource\_group\_id) | Resource Group ID | `string` | n/a | yes | | ||
| <a name="input_ssh_key"></a> [ssh\_key](#input\_ssh\_key) | ssh keys for the vsi | `list(any)` | n/a | yes | | ||
| <a name="input_subnets"></a> [subnets](#input\_subnets) | DB subnets Ids. This is required parameter | `list(any)` | n/a | yes | | ||
| <a name="input_tiered_profiles"></a> [tiered\_profiles](#input\_tiered\_profiles) | Tiered profiles for Input/Output per seconds in GBs | `map(any)` | n/a | yes | | ||
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | Required parameter vpc\_id | `string` | n/a | yes | | ||
| <a name="input_zones"></a> [zones](#input\_zones) | List of Availability Zones where compute resource will be created | `list(any)` | n/a | yes | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| <a name="output_db_target"></a> [db\_target](#output\_db\_target) | Target primary network interface address | | ||
| <a name="output_db_vsi"></a> [db\_vsi](#output\_db\_vsi) | Target primary network interface address | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# /** | ||
# ################################################################################################################# | ||
# * Resources Section for the db Module. | ||
# ################################################################################################################# | ||
# */ | ||
|
||
/** | ||
* IBM Cloud Database | ||
* Element : ibm_database | ||
* This resource will be used to create a database as per the users input. | ||
**/ | ||
resource "ibm_database" "db" { | ||
name = "${var.prefix}db" | ||
resource_group_id = var.resource_group_id | ||
location = var.region | ||
version = var.db_version | ||
adminpassword = var.db_admin_password | ||
service = var.service | ||
service_endpoints = var.service_endpoints | ||
plan = var.plan | ||
group { | ||
group_id = "member" | ||
memory { | ||
allocation_mb = var.member_memory_allocation_mb | ||
} | ||
disk { | ||
allocation_mb = var.member_disk_allocation_mb | ||
} | ||
cpu { | ||
allocation_count = var.member_cpu_allocation_count | ||
} | ||
} | ||
key_protect_instance = var.key_protect_instance | ||
key_protect_key = var.key_protect_key | ||
tags = var.tags | ||
backup_id = var.backup_id | ||
backup_encryption_key_crn = var.backup_encryption_key_crn | ||
remote_leader_id = var.remote_leader_id | ||
dynamic "auto_scaling" { | ||
for_each = (var.auto_scaling != null ? var.auto_scaling : []) | ||
content { | ||
disk { | ||
capacity_enabled = auto_scaling.value.disk.capacity_enabled | ||
free_space_less_than_percent = auto_scaling.value.disk.free_space_less_than_percent | ||
io_above_percent = auto_scaling.value.disk.io_above_percent | ||
io_enabled = auto_scaling.value.disk.io_enabled | ||
io_over_period = auto_scaling.value.disk.io_over_period | ||
rate_increase_percent = auto_scaling.value.disk.rate_increase_percent | ||
rate_limit_mb_per_member = auto_scaling.value.disk.rate_limit_mb_per_member | ||
rate_period_seconds = auto_scaling.value.disk.rate_period_seconds | ||
rate_units = auto_scaling.value.disk.rate_units | ||
} | ||
memory { | ||
io_above_percent = auto_scaling.value.memory.io_above_percent | ||
io_enabled = auto_scaling.value.memory.io_enabled | ||
io_over_period = auto_scaling.value.memory.io_over_period | ||
rate_increase_percent = auto_scaling.value.memory.rate_increase_percent | ||
rate_limit_mb_per_member = auto_scaling.value.memory.rate_limit_mb_per_member | ||
rate_period_seconds = auto_scaling.value.memory.rate_period_seconds | ||
rate_units = auto_scaling.value.memory.rate_units | ||
} | ||
} | ||
} | ||
dynamic "users" { | ||
for_each = (var.users != null ? var.users : []) | ||
content { | ||
name = (users.value.name != "" ? users.value.name : null) | ||
password = (users.value.password != "" ? users.value.password : null) | ||
} | ||
} | ||
dynamic "whitelist" { | ||
for_each = (var.whitelist != null ? var.whitelist : []) | ||
content { | ||
address = (whitelist.value.address != "" ? whitelist.value.address : null) | ||
description = (whitelist.value.description != "" ? whitelist.value.description : null) | ||
} | ||
} | ||
timeouts { | ||
create = var.create_timeout | ||
update = var.update_timeout | ||
delete = var.delete_timeout | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# /** | ||
# ################################################################################################################# | ||
# * Output Variable Section for the db Module. | ||
# ################################################################################################################# | ||
# **/ | ||
|
||
|
||
output "db_connection_command" { | ||
value = "MYSQL_PWD=<Admin-PASSWORD> mysql --host=${ibm_database.db.connectionstrings[0].hosts[0].hostname} --port=${ibm_database.db.connectionstrings[0].hosts[0].port} --user=admin ibmclouddb" | ||
} | ||
|
||
output "db_hostname" { | ||
value = ibm_database.db.connectionstrings[0].hosts[0].hostname | ||
} | ||
|
||
output "db_port" { | ||
value = ibm_database.db.connectionstrings[0].hosts[0].port | ||
} | ||
|
||
output "db_certificate" { | ||
value = "${ibm_database.db.connectionstrings[0].certbase64}}" | ||
} |
Oops, something went wrong.