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

Added an Essentials Database resource and datasource #509

Merged
merged 5 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
79 changes: 79 additions & 0 deletions docs/data-sources/rediscloud_essentials_database.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
layout: "rediscloud"
page_title: "Redis Cloud: rediscloud_essentials_database"
description: |-
Database data source for Essentials Subscriptions in the Redis Cloud Terraform provider.
---

# Resource: rediscloud_essentials_database

The Essentials Database data source allows access to the details of an existing database within your Redis Enterprise
Cloud account.

## Example Usage

The following example shows how to locate a single database within a Subscription. This example assumes the subscription only contains a single database.

```hcl-terraform
data "rediscloud_essentials_database" "example" {
subscription_id = "1234"
}
```

The following example shows how to use the name to locate a single database within a subscription that has multiple databases.

```hcl-terraform
data "rediscloud_essentials_database" "example" {
subscription_id = "1234"
name = "first-database"
}
```

## Argument Reference

* `subscription_id` - (Required) ID of the subscription that the database belongs to
* `db_id` - (Optional) The id of the database to filter returned databases
* `name` - (Optional) The name of the database to filter returned databases

## Attribute Reference

* `protocol` - The protocol of the database. Either `redis`, `memcached` or `stack`
* `cloud_provider` - The Cloud Provider hosting this database
* `region` - The region within the Cloud Provider where this database is hosted
* `redis_version_compliance` - The compliance level (redis version) of this database.
* `resp_version` - Either `resp2` or `resp3`. Database's RESP version
* `data_persistence` - The rate of database data persistence (in persistent storage).
* `data_eviction` - The data items eviction policy.
* `replication` - Database replication.
* `activated_on` - When this database was activated.
* `periodic_backup_path` - Automatic backups will be every 24 hours or database will be able to perform immediate backups to this path.
* `public_endpoint` - Public endpoint to access the database.
* `private_endpoint` - Private endpoint to access the database.
* `source_ips` - Set of CIDR addresses to allow access to the database.
* `replica` - Replica details on this database, documented below.
* `client_tls_certificates` - A list of TLS certificates (public keys) with new line characters replaced by \n.
* `password` - The password used to access the database - not present on `memcached` protocol databases.
* `enable_default_user` - When `true` enables connecting to the database with the default user.
* `alert` - Set of alerts to enable on the database, documented below.
* `modules` A list of database modules, documented below.
* `latest_backup_status` - An object containing the JSON-formatted response detailing the latest backup status (or an error if the lookup failed).
* `latest_import_status` - An object containing the JSON-formatted response detailing the latest import status (or an error if the lookup failed).

The `replica` block supports:

* `sync_source` - The sources to replicate, documented below.

The `sync_source` block supports:]

* `endpoint` - A Redis URI (sample format: 'redis://user:password@host:port)'. If the URI provided is Redis Cloud instance, only host and port should be provided (using the format: ['redis://endpoint1:6379', 'redis://endpoint2:6380'] ).
* `encryption` - Defines if encryption should be used to connect to the sync source.
* `server_cert` - TLS certificate chain of the sync source.

The `alert` block supports:

* `name` - The alert name
* `value` - The alert value

Each `modules` entry provides the following attributes

* `name` - The identifier assigned by the database module.
92 changes: 92 additions & 0 deletions docs/resources/rediscloud_essentials_database.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
layout: "rediscloud"
page_title: "Redis Cloud: rediscloud_essentials_database"
description: |-
Essentials Database resource in the Terraform provider Redis Cloud.
greg-oc marked this conversation as resolved.
Show resolved Hide resolved
---

# Resource: rediscloud_essentials_database

Creates an Essentials Database within a specified Essentials Subscription in your Redis Enterprise Cloud Account.

## Example Usage

```hcl
data "rediscloud_payment_method" "card" {
card_type = "Visa"
}

data "rediscloud_essentials_plan" "example" {
name = "250MB"
cloud_provider = "AWS"
region = "eu-west-1"
}

resource "rediscloud_essentials_subscription" "example" {
name = "%s"
plan_id = data.rediscloud_essentials_plan.example.id
payment_method_id = data.rediscloud_payment_method.card.id
}

resource "rediscloud_essentials_database" "example" {
subscription_id = rediscloud_essentials_subscription.example.id
name = "%s"
enable_default_user = true
password = "j43589rhe39f"
greg-oc marked this conversation as resolved.
Show resolved Hide resolved

alert {
name = "throughput-higher-than"
value = 80
}
}
```

## Argument Reference

The following arguments are supported:

* `subscription_id` - (Required) The ID of the subscription to create the database in. **Modifying this attribute will force creation of a new resource.**
* `name` - (Required) A meaningful name to identify the database
* `protocol` - (Optional) The protocol that will be used to access the database, (either ‘redis’, 'memcached’ or 'stack'). **Modifying this attribute will force creation of a new resource.**
* `resp_version` - (Optional) RESP version must be compatible with Redis version.
* `data_persistence` - (Optional) Rate of database data persistence (in persistent storage). Default: 'none'
* `data_eviction` - (Optional) Data items eviction method
* `replication` - (Optional) Databases replication. Default: 'false'
* `periodic_backup_path` - (Optional) If specified, automatic backups will be every 24 hours or database will be able to perform immediate backups to this path.
* `source_ips` - (Optional) List of source IP addresses or subnet masks. If specified, Redis clients will be able to connect to this database only from within the specified source IP addresses ranges. example value: '['192.168.10.0/32', '192.168.12.0/24']'
* `replica` - (Optional) If specified, this database will be a replica of the specified Redis databases provided, documented below.
* `client_tls_certificates` - (Optional) A list of TLS/SSL certificates (public keys) with new line characters replaced by \n.
* `password` - (Optional) Password to access the database. If omitted, a random 32 character long alphanumeric password will be automatically generated
* `enable_default_user` - (Optional) When `true` enables connecting to the database with the default user. Default `true`.
* `alert` - (Optional) A block defining Redis database alert, documented below, can be specified multiple times
* `modules` - (Optional) A list of modules objects, documented below. **Modifying this attribute will force creation of a new resource.**

The `replica` block supports:

* `sync_source` - The sources to replicate, documented below.

The `sync_source` block supports:]

* `endpoint` - A Redis URI (sample format: 'redis://user:password@host:port)'. If the URI provided is Redis Cloud instance, only host and port should be provided (using the format: ['redis://endpoint1:6379', 'redis://endpoint2:6380'] ).
* `encryption` - Defines if encryption should be used to connect to the sync source.
* `server_cert` - TLS certificate chain of the sync source.

The `alert` block supports:

* `name` - The alert name
* `value` - The alert value

Each `modules` entry provides the following attributes

* `name` - The identifier assigned by the database module.

## Attribute Reference

* `cloud_provider` - The Cloud Provider hosting this database
* `region` - The region within the Cloud Provider where this database is hosted
greg-oc marked this conversation as resolved.
Show resolved Hide resolved
* `redis_version_compliance` - The compliance level (redis version) of this database.
* `activated_on` - When this database was activated.
* `public_endpoint` - Public endpoint to access the database.
* `private_endpoint` - Private endpoint to access the database.
* `latest_backup_status` - An object containing the JSON-formatted response detailing the latest backup status (or an error if the lookup failed).
* `latest_import_status` - An object containing the JSON-formatted response detailing the latest import status (or an error if the lookup failed).
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/RedisLabs/terraform-provider-rediscloud
go 1.19

require (
github.com/RedisLabs/rediscloud-go-api v0.13.0
github.com/RedisLabs/rediscloud-go-api v0.14.2
github.com/bflad/tfproviderlint v0.29.0
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
github.com/hashicorp/terraform-plugin-sdk/v2 v2.28.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
github.com/Microsoft/go-winio v0.5.2 h1:a9IhgEQBCUEk6QCdml9CiJGhAws+YwffDHEMp1VMrpA=
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 h1:wPbRQzjjwFc0ih8puEVAOFGELsn1zoIIYdxvML7mDxA=
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g=
github.com/RedisLabs/rediscloud-go-api v0.13.0 h1:QJuxUGiYc8V5JdRyCOyimDHsgjFckr0ol+Midx950cQ=
github.com/RedisLabs/rediscloud-go-api v0.13.0/go.mod h1:LTnlcUHd+NU25dXGikLk1hbyROjaaGHvfMbzdNLX8to=
github.com/RedisLabs/rediscloud-go-api v0.14.2 h1:zHP1m+SMauRt3aDuJkg+kMSCfQO8+/2Y4VESdiw74Oc=
github.com/RedisLabs/rediscloud-go-api v0.14.2/go.mod h1:LTnlcUHd+NU25dXGikLk1hbyROjaaGHvfMbzdNLX8to=
github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ=
github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE=
github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
Expand Down
Loading
Loading