Skip to content

Commit

Permalink
Merge pull request #187 from UpCloudLtd/feat/managed-databases
Browse files Browse the repository at this point in the history
feat(resource): implement managed database resource types
  • Loading branch information
peknur committed Jan 13, 2022
2 parents d01fee3 + 9bf7014 commit 2fcc770
Show file tree
Hide file tree
Showing 48 changed files with 5,383 additions and 87 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ See updating [Changelog example here](https://keepachangelog.com/en/1.0.0/)
### Added

- server: validate plan and zone field values before executing API commands

- Support for UpCloud Managed Databases
- Support for debuggers like Delve

### Fixed
Expand Down
56 changes: 56 additions & 0 deletions docs/resources/managed_database_logical_database.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "upcloud_managed_database_logical_database Resource - terraform-provider-upcloud"
subcategory: ""
description: |-
This resource represents a logical database in managed database
---

# upcloud_managed_database_logical_database (Resource)

This resource represents a logical database in managed database

## Example Usage

```terraform
# PostgreSQL managed database with additional logical database: example_db
resource "upcloud_managed_database_postgresql" "example" {
name = "postgres"
plan = "1x1xCPU-2GB-25GB"
title = "postgres"
zone = "fi-hel1"
}
resource "upcloud_managed_database_logical_database" "example_db" {
service = upcloud_managed_database_postgresql.example.id
name = "example_db"
}
# MySQL managed database with additional logical database: example2_db
resource "upcloud_managed_database_mysql" "example" {
name = "mymysql"
plan = "1x1xCPU-2GB-25GB"
zone = "fi-hel1"
}
resource "upcloud_managed_database_logical_database" "example2_db" {
service = upcloud_managed_database_mysql.example.id
name = "example2_db"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- **name** (String) Name of the logical database
- **service** (String) Service's UUID for which this user belongs to

### Optional

- **character_set** (String) Default character set for the database (LC_CTYPE)
- **collation** (String) Default collation for the database (LC_COLLATE)
- **id** (String) The ID of this resource.


155 changes: 155 additions & 0 deletions docs/resources/managed_database_mysql.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "upcloud_managed_database_mysql Resource - terraform-provider-upcloud"
subcategory: ""
description: |-
This resource represents MySQL managed database
---

# upcloud_managed_database_mysql (Resource)

This resource represents MySQL managed database

## Example Usage

```terraform
# Minimal config
resource "upcloud_managed_database_mysql" "example_1" {
name = "mysql-1"
plan = "1x1xCPU-2GB-25GB"
zone = "fi-hel1"
}
# Shutdown instance after creation
resource "upcloud_managed_database_mysql" "example_2" {
name = "mysql-2"
plan = "1x1xCPU-2GB-25GB"
zone = "fi-hel1"
powered = false
}
# Service with custom properties
# Note that this basically sets strict mode off which is not normally recommended
resource "upcloud_managed_database_mysql" "example_3" {
name = "mysql-3"
plan = "1x1xCPU-2GB-25GB"
zone = "fi-hel1"
properties {
sql_mode = "NO_ENGINE_SUBSTITUTION"
wait_timeout = 300
sort_buffer_size = 4e+6 # 4MB
max_allowed_packet = 16e+6 # 16MB
admin_username = "admin"
admin_password = "<ADMIN_PASSWORD>"
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- **name** (String) Name of the service. The name is used as a prefix for the logical hostname. Must be unique within an account
- **plan** (String) Service plan to use. This determines how much resources the instance will have
- **zone** (String) Zone where the instance resides

### Optional

- **id** (String) The ID of this resource.
- **maintenance_window_dow** (String) Maintenance window day of week. Lower case weekday name (monday, tuesday, ...)
- **maintenance_window_time** (String) Maintenance window UTC time in hh:mm:ss format
- **powered** (Boolean) The administrative power state of the service
- **properties** (Block List, Max: 1) Database Engine properties for MySQL (see [below for nested schema](#nestedblock--properties))
- **title** (String) Title of a managed database instance

### Read-Only

- **components** (List of Object) Service component information (see [below for nested schema](#nestedatt--components))
- **node_states** (List of Object) Information about nodes providing the managed service (see [below for nested schema](#nestedatt--node_states))
- **primary_database** (String) Primary database name
- **service_host** (String) Hostname to the service instance
- **service_password** (String, Sensitive) Primary username's password to the service instance
- **service_port** (String) Port to the service instance
- **service_uri** (String, Sensitive) URI to the service instance
- **service_username** (String) Primary username to the service instance
- **state** (String) State of the service
- **type** (String) Type of the service

<a id="nestedblock--properties"></a>
### Nested Schema for `properties`

Optional:

- **admin_password** (String, Sensitive) Custom password for admin user. Defaults to random string. This must be set only when a new service is being created.
- **admin_username** (String) Custom username for admin user. This must be set only when a new service is being created.
- **automatic_utility_network_ip_filter** (Boolean) Automatic utility network IP Filter
- **backup_hour** (Number) The hour of day (in UTC) when backup for the service is started. New backup is only started if previous backup has already completed.
- **backup_minute** (Number) The minute of an hour when backup for the service is started. New backup is only started if previous backup has already completed.
- **binlog_retention_period** (Number) The minimum amount of time in seconds to keep binlog entries before deletion. This may be extended for services that require binlog entries for longer than the default for example if using the MySQL Debezium Kafka connector.
- **connect_timeout** (Number) connect_timeout
- **default_time_zone** (String) default_time_zone
- **group_concat_max_len** (Number) group_concat_max_len
- **information_schema_stats_expiry** (Number) information_schema_stats_expiry
- **innodb_ft_min_token_size** (Number) innodb_ft_min_token_size
- **innodb_ft_server_stopword_table** (String) innodb_ft_server_stopword_table
- **innodb_lock_wait_timeout** (Number) innodb_lock_wait_timeout
- **innodb_log_buffer_size** (Number) innodb_log_buffer_size
- **innodb_online_alter_log_max_size** (Number) innodb_online_alter_log_max_size
- **innodb_print_all_deadlocks** (Boolean) innodb_print_all_deadlocks
- **innodb_rollback_on_timeout** (Boolean) innodb_rollback_on_timeout
- **interactive_timeout** (Number) interactive_timeout
- **internal_tmp_mem_storage_engine** (String) internal_tmp_mem_storage_engine
- **ip_filter** (List of String) IP filter
- **long_query_time** (Number) long_query_time
- **max_allowed_packet** (Number) max_allowed_packet
- **max_heap_table_size** (Number) max_heap_table_size
- **migration** (Block List, Max: 1) Migrate data from existing server (see [below for nested schema](#nestedblock--properties--migration))
- **net_read_timeout** (Number) net_read_timeout
- **net_write_timeout** (Number) net_write_timeout
- **public_access** (Boolean) Public Access
- **slow_query_log** (Boolean) slow_query_log
- **sort_buffer_size** (Number) sort_buffer_size
- **sql_mode** (String) sql_mode
- **sql_require_primary_key** (Boolean) sql_require_primary_key
- **tmp_table_size** (Number) tmp_table_size
- **version** (String) MySQL major version
- **wait_timeout** (Number) wait_timeout

<a id="nestedblock--properties--migration"></a>
### Nested Schema for `properties.migration`

Optional:

- **dbname** (String) Database name for bootstrapping the initial connection
- **host** (String) Hostname or IP address of the server where to migrate data from
- **ignore_dbs** (String) Comma-separated list of databases, which should be ignored during migration (supported by MySQL only at the moment)
- **password** (String, Sensitive) Password for authentication with the server where to migrate data from
- **port** (Number) Port number of the server where to migrate data from
- **ssl** (Boolean) The server where to migrate data from is secured with SSL
- **username** (String) User name for authentication with the server where to migrate data from



<a id="nestedatt--components"></a>
### Nested Schema for `components`

Read-Only:

- **component** (String)
- **host** (String)
- **port** (Number)
- **route** (String)
- **usage** (String)


<a id="nestedatt--node_states"></a>
### Nested Schema for `node_states`

Read-Only:

- **name** (String)
- **role** (String)
- **state** (String)


Loading

0 comments on commit 2fcc770

Please sign in to comment.