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

feat(resource): implement managed database resource types #187

Merged
merged 8 commits into from
Jan 13, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
43 changes: 43 additions & 0 deletions docs/resources/managed_database_logical_database.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "upcloud_managed_database_logical_database Resource - terraform-provider-upcloud"
subcategory: ""
description: |-
peknur marked this conversation as resolved.
Show resolved Hide resolved

---

# upcloud_managed_database_logical_database (Resource)



## Example Usage

```terraform
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
peknur marked this conversation as resolved.
Show resolved Hide resolved
name = "example_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: |-

---

# upcloud_managed_database_mysql (Resource)



## 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)
peknur marked this conversation as resolved.
Show resolved Hide resolved
- **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