-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add backup resource and data sources (#57)
This change adds backup resource and data sources to manage and inspect backups for the NuoDB DBaaS Control Plane.
- Loading branch information
1 parent
a6f522d
commit 75208d2
Showing
23 changed files
with
1,185 additions
and
96 deletions.
There are no files selected for viewing
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,65 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "nuodbaas_backup Data Source - nuodbaas" | ||
subcategory: "" | ||
description: |- | ||
Data source for exposing information about NuoDB backups created using the DBaaS Control Plane | ||
--- | ||
|
||
# nuodbaas_backup (Data Source) | ||
|
||
Data source for exposing information about NuoDB backups created using the DBaaS Control Plane | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
# Data source that returns the attributes of a specific backup | ||
data "nuodbaas_backup" "backup_details" { | ||
organization = nuodbaas_backup.backup.organization | ||
project = nuodbaas_backup.backup.project | ||
database = nuodbaas_backup.backup.database | ||
name = nuodbaas_backup.backup.name | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `database` (String) The database that the backup belongs to | ||
- `name` (String) The name of the backup | ||
- `organization` (String) The organization that the backup belongs to | ||
- `project` (String) The project that the backup belongs to | ||
|
||
### Read-Only | ||
|
||
- `import_source` (Attributes) (see [below for nested schema](#nestedatt--import_source)) | ||
- `labels` (Map of String) User-defined labels attached to the resource that can be used for filtering | ||
- `status` (Attributes) (see [below for nested schema](#nestedatt--status)) | ||
|
||
<a id="nestedatt--import_source"></a> | ||
### Nested Schema for `import_source` | ||
|
||
Read-Only: | ||
|
||
- `backup_handle` (String) The existing backup handle to import | ||
- `backup_plugin` (String) The plugin used to create the backup to import | ||
|
||
|
||
<a id="nestedatt--status"></a> | ||
### Nested Schema for `status` | ||
|
||
Read-Only: | ||
|
||
- `backup_handle` (String) The handle for the backup | ||
- `backup_plugin` (String) The plugin used to manage the backup | ||
- `created_by_policy` (String) The fully-qualified name of the backup policy that the backup was created by | ||
- `creation_time` (String) The time that the backup was taken | ||
- `message` (String) Message summarizing the state of the backup | ||
- `ready_to_use` (Boolean) Whether the backup is ready to be used to restore a database | ||
- `state` (String) The state of the backup: | ||
* `Pending` - The backup is pending completion | ||
* `Succeeded` - The backup completed successfully and is available for use | ||
* `Failed` - The backup failed and is unusable | ||
* `Deleting` - The backup has been marked for deletion, which is in progress |
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,86 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "nuodbaas_backups Data Source - nuodbaas" | ||
subcategory: "" | ||
description: |- | ||
Data source for listing NuoDB backups created using the DBaaS Control Plane | ||
--- | ||
|
||
# nuodbaas_backups (Data Source) | ||
|
||
Data source for listing NuoDB backups created using the DBaaS Control Plane | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
# Data source that returns the fully-qualified names of all backups | ||
data "nuodbaas_backups" "backup_list" {} | ||
# Data source that returns the fully-qualified names of backups within an organization | ||
data "nuodbaas_backups" "org_backup_list" { | ||
filter = { | ||
organization = "org" | ||
} | ||
} | ||
# Data source that returns the fully-qualified names of backups within a project | ||
data "nuodbaas_backups" "proj_backup_list" { | ||
filter = { | ||
organization = "org" | ||
project = "proj" | ||
} | ||
} | ||
# Data source that returns the fully-qualified names of backups within a database | ||
data "nuodbaas_backups" "db_backup_list" { | ||
filter = { | ||
organization = "org" | ||
project = "proj" | ||
database = "db" | ||
} | ||
} | ||
# Data source that returns the fully-qualified names of backups satisfying label requirements | ||
data "nuodbaas_backups" "label_backup_list" { | ||
filter = { | ||
labels = ["withkey", "key=expected", "key!=unexpected", "!withoutkey"] | ||
} | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Optional | ||
|
||
- `filter` (Attributes) Filters to apply to backups (see [below for nested schema](#nestedatt--filter)) | ||
|
||
### Read-Only | ||
|
||
- `backups` (Attributes List) The list of backups that satisfy the filter requirements (see [below for nested schema](#nestedatt--backups)) | ||
|
||
<a id="nestedatt--filter"></a> | ||
### Nested Schema for `filter` | ||
|
||
Optional: | ||
|
||
- `database` (String) The database to filter backups on. If specified, the project must also be specified. | ||
- `labels` (List of String) List of filters to apply based on labels, which are composed using `AND`. Acceptable filter expressions are: | ||
* `key` - Only return items that have label with specified key | ||
* `key=value` - Only return items that have label with specified key set to value | ||
* `!key` - Only return items that do _not_ have label with specified key | ||
* `key!=value` - Only return items that do _not_ have label with specified key set to value | ||
- `organization` (String) The organization to filter backups on | ||
- `project` (String) The project to filter backups on. If specified, the organization must also be specified. | ||
|
||
|
||
<a id="nestedatt--backups"></a> | ||
### Nested Schema for `backups` | ||
|
||
Read-Only: | ||
|
||
- `database` (String) The database the backup belongs to | ||
- `name` (String) The name of the backup | ||
- `organization` (String) The organization the backup belongs to | ||
- `project` (String) The project the backup belongs to |
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,86 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "nuodbaas_backup Resource - nuodbaas" | ||
subcategory: "" | ||
description: |- | ||
Resource for managing NuoDB backups created using the DBaaS Control Plane | ||
--- | ||
|
||
# nuodbaas_backup (Resource) | ||
|
||
Resource for managing NuoDB backups created using the DBaaS Control Plane | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
# A backup referencing an existing backup handle | ||
resource "nuodbaas_backup" "backup" { | ||
organization = nuodbaas_database.db.organization | ||
project = nuodbaas_database.db.project | ||
database = nuodbaas_database.db.name | ||
name = "backup" | ||
labels = { | ||
latest = "true" | ||
purpose = "test" | ||
} | ||
import_source = { | ||
backup_handle = "backup" | ||
backup_plugin = "embedded.cp.nuodb.com" | ||
} | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `database` (String) The database that the backup belongs to | ||
- `name` (String) The name of the backup | ||
- `organization` (String) The organization that the backup belongs to | ||
- `project` (String) The project that the backup belongs to | ||
|
||
### Optional | ||
|
||
- `import_source` (Attributes) (see [below for nested schema](#nestedatt--import_source)) | ||
- `labels` (Map of String) User-defined labels attached to the resource that can be used for filtering | ||
|
||
### Read-Only | ||
|
||
- `status` (Attributes) (see [below for nested schema](#nestedatt--status)) | ||
|
||
<a id="nestedatt--import_source"></a> | ||
### Nested Schema for `import_source` | ||
|
||
Required: | ||
|
||
- `backup_handle` (String) The existing backup handle to import | ||
- `backup_plugin` (String) The plugin used to create the backup to import | ||
|
||
|
||
<a id="nestedatt--status"></a> | ||
### Nested Schema for `status` | ||
|
||
Read-Only: | ||
|
||
- `backup_handle` (String) The handle for the backup | ||
- `backup_plugin` (String) The plugin used to manage the backup | ||
- `created_by_policy` (String) The fully-qualified name of the backup policy that the backup was created by | ||
- `creation_time` (String) The time that the backup was taken | ||
- `message` (String) Message summarizing the state of the backup | ||
- `ready_to_use` (Boolean) Whether the backup is ready to be used to restore a database | ||
- `state` (String) The state of the backup: | ||
* `Pending` - The backup is pending completion | ||
* `Succeeded` - The backup completed successfully and is available for use | ||
* `Failed` - The backup failed and is unusable | ||
* `Deleting` - The backup has been marked for deletion, which is in progress | ||
|
||
## Import | ||
|
||
Import is supported using the following syntax: | ||
|
||
```shell | ||
# An existing backup can be imported by specifying the organization, | ||
# project name, database name, and backup name separated by "/" | ||
terraform import nuodbaas_backup.backup org/proj/db/backup | ||
``` |
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,7 @@ | ||
# Data source that returns the attributes of a specific backup | ||
data "nuodbaas_backup" "backup_details" { | ||
organization = nuodbaas_backup.backup.organization | ||
project = nuodbaas_backup.backup.project | ||
database = nuodbaas_backup.backup.database | ||
name = nuodbaas_backup.backup.name | ||
} |
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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
# Data source that returns the attributes of a specific backup policy | ||
data "nuodbaas_backuppolicy" "policy_details" { | ||
organization = "org" | ||
name = "pol" | ||
depends_on = [nuodbaas_backuppolicy.pol] | ||
organization = nuodbaas_backuppolicy.pol.organization | ||
name = nuodbaas_backuppolicy.pol.name | ||
} |
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,34 @@ | ||
# Data source that returns the fully-qualified names of all backups | ||
data "nuodbaas_backups" "backup_list" {} | ||
|
||
|
||
# Data source that returns the fully-qualified names of backups within an organization | ||
data "nuodbaas_backups" "org_backup_list" { | ||
filter = { | ||
organization = "org" | ||
} | ||
} | ||
|
||
# Data source that returns the fully-qualified names of backups within a project | ||
data "nuodbaas_backups" "proj_backup_list" { | ||
filter = { | ||
organization = "org" | ||
project = "proj" | ||
} | ||
} | ||
|
||
# Data source that returns the fully-qualified names of backups within a database | ||
data "nuodbaas_backups" "db_backup_list" { | ||
filter = { | ||
organization = "org" | ||
project = "proj" | ||
database = "db" | ||
} | ||
} | ||
|
||
# Data source that returns the fully-qualified names of backups satisfying label requirements | ||
data "nuodbaas_backups" "label_backup_list" { | ||
filter = { | ||
labels = ["withkey", "key=expected", "key!=unexpected", "!withoutkey"] | ||
} | ||
} |
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 |
---|---|---|
@@ -1,7 +1,6 @@ | ||
# Data source that returns the attributes of a specific database | ||
data "nuodbaas_database" "database_details" { | ||
organization = "org" | ||
project = "proj" | ||
name = "db" | ||
depends_on = [nuodbaas_database.db] | ||
organization = nuodbaas_database.db.organization | ||
project = nuodbaas_database.db.project | ||
name = nuodbaas_database.db.name | ||
} |
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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
# Data source that returns the attributes of a specific project | ||
data "nuodbaas_project" "project_details" { | ||
organization = "org" | ||
name = "proj" | ||
depends_on = [nuodbaas_project.proj] | ||
organization = nuodbaas_project.proj.organization | ||
name = nuodbaas_project.proj.name | ||
} |
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,3 @@ | ||
# An existing backup can be imported by specifying the organization, | ||
# project name, database name, and backup name separated by "/" | ||
terraform import nuodbaas_backup.backup org/proj/db/backup |
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,15 @@ | ||
# A backup referencing an existing backup handle | ||
resource "nuodbaas_backup" "backup" { | ||
organization = nuodbaas_database.db.organization | ||
project = nuodbaas_database.db.project | ||
database = nuodbaas_database.db.name | ||
name = "backup" | ||
labels = { | ||
latest = "true" | ||
purpose = "test" | ||
} | ||
import_source = { | ||
backup_handle = "backup" | ||
backup_plugin = "embedded.cp.nuodb.com" | ||
} | ||
} |
Oops, something went wrong.