8000 Add docs for managed backup Terraform provider attribute by katmayb · Pull Request #19182 · cockroachdb/docs · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add docs for managed backup Terraform provider attribute #19182

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

Merged
merged 4 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Set the following:

- `{cluster_id}` is the unique ID of the cluster. Use this ID when making API requests. You can find the cluster ID in the cluster's Cloud Console page. Find your cluster ID in the URL of the single cluster overview page: `https://cockroachlabs.cloud/cluster/{your_cluster_id}/overview`. The ID should resemble `f78b7feb-b6cf-4396-9d7f-494982d7d81e`.
- `{enabled}` controls whether managed backups are enabled or disabled. If you are disabling managed backups, you cannot set backup frequency or retention. Possible values are: `true`, `false`.
- `{frequency_minutes}` determines [how often](#frequency) the managed backup will run in minutes. Possible values are: `5`, `10`, `15`, `30`, `60`, `240`, `1440`.
- `{frequency_minutes}` determines [how often](#frequency) the managed backup will run in minutes. Possible values are: `5`, `10`, `15`, `30`, `60`, `240` (4 hours), `1440` (24 hours).
- `{retention_days}` sets the number of days Cockroach Labs will [retain](#retention) the managed backup in storage. You can change `retention_days` for the cluster **once** (whether in the Cloud API or [Cloud Console](#cloud-console)). Possible values are: `2`, `7`, `30`, `90`, `365`.

If `{retention_days}` has previously been modified (in the Cloud API or Cloud Console), you will receive the message "cluster already has a retention policy set, open a support ticket to change it". To modify the setting again, contact the [Cockroach Labs Support team]({% link {{site.current_cloud_version}}/support-resources.md %}).
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
You may also want to configure the [managed backup]({% link cockroachcloud/managed-backups.md %}) settings your CockroachDB {{ site.data.products.standard }} cluster takes automatically. To do so, include the `backup_config` attribute in the `cockroach_cluster` resource:

{% include_cached copy-clipboard.html %}
~~~ hcl
backup_config = {
enabled = true
frequency_minutes = 60
retention_days = 30
}
~~~

{{site.data.alerts.callout_info}}
You can modify the [retention]({% link cockroachcloud/managed-backups.md %}#retention) of managed backups only once with one of the following: the [Cloud Console]({% link cockroachcloud/managed-backups.md %}#cloud-console), the [Cloud API]({% link cockroachcloud/managed-backups.md %}#cloud-api), or Terraform. To modify the setting again, contact the [Cockroach Labs Support team]({% link {{site.current_cloud_version}}/support-resources.md %}).
{{site.data.alerts.end}}

For details on the `backup_config` settings, refer to [Managed Backups]({% link cockroachcloud/managed-backups.md %}#cockroachdb-cloud-terraform-provider).
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Set the following for the `backup_config` attribute:

- `enabled` controls whether managed backups are enabled or disabled. If you modify the `retention_days` setting even when managed backups are disabled, this will use the [one possible change](#retention) for `retention_days`. Possible values for the `enabled` setting are: `true` or `false`.
- `frequency_minutes` determines [how often](#frequency) the managed backup will run in minutes. Possible values are: `5`, `10`, `15`, `30`, `60`, `240` (4 hours), `1440` (24 hours).
- `retention_days` sets the number of days Cockroach Labs will [retain](#retention) the managed backup in storage. You can change `retention_days` for the cluster **once** (whether in Terraform, the [Cloud API](#cloud-api), or the [Cloud Console](#cloud-console)). Possible values are: `2`, `7`, `30`, `90`, `365`. Note that:
- If the initial value of the `retention_days` attribute is the default value `30`, you'll be able to modify the backup retention setting once more.
- If the initial value is not the default, you will not be able to modify `retention_days` again. You can refrain from including `retention_days` in the Terraform configuration and instead manage the retention in the Cloud Console.

To modify the setting again, contact the [Cockroach Labs Support team]({% link {{site.current_cloud_version}}/support-resources.md %}). For more details on modifying `retention_days`, refer to the [Updating Backup Retention](https://github.com/cockroachdb/terraform-provider-cockroach/blob/main/docs/guides/updating-backup-retention.md) documentation in the Terraform provider for CockroachDB {{ site.data.products.cloud }} Repository.
42 changes: 38 additions & 4 deletions src/current/cockroachcloud/managed-backups-advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ Configurable managed backup settings are available in all [supported versions]({

Full backups in the cluster will be deleted when they reach the set retention period. At this point, any incremental backups dependent on the deleted full backup will also be deleted. The Cloud Console will not list any backups that are beyond the set retention period, or incremental backups that cannot be restored.

For instructions on how to view and configure managed backup settings, use:
For instructions on how to view and configure managed backup settings, use one of the following:

- The [Cloud Console](#cloud-console).
- The [Cloud API](#cloud-api).
- [Cloud Console](#cloud-console).
- [Cloud API](#cloud-api).
- [CockroachDB {{ site.data.products.cloud }} Terraform provider](#cockroachdb-cloud-terraform-provider).

{% include cockroachcloud/backups/full-backup-setting-change.md %}

Expand Down Expand Up @@ -239,4 +240,37 @@ For each restore job, the tab will display:

## Cloud API

{% include cockroachcloud/backups/cloud-api-get-put.md %}
{% include cockroachcloud/backups/cloud-api-get-put.md %}

## CockroachDB Cloud Terraform provider

You can use the [CockroachDB {{ site.data.products.cloud }} Terraform provider]({% link cockroachcloud/provision-a-cluster-with-terraform.md %}) to specify managed backup settings in {{ site.data.products.advanced }} clusters.

In your `main.tf` Terraform configuration file, use the `backup_config` attribute on the `cockroach_cluster` resource to modify the settings of managed backups. For example:

{% include_cached copy-clipboard.html %}
~~~ hcl
resource "cockroach_cluster" "advanced" {
name = "cockroach-advanced"
cloud_provider = "GCP"
plan = "ADVANCED"
dedicated = {
storage_gib = 15
num_virtual_cpus = 4
}
regions = [
{
name = "us-central1"
node_count = 1
}
]
delete_protection = true
backup_config = {
enabled = true
frequency_minutes = 60
retention_days = 30
}
}
~~~

{% include cockroachcloud/backups/terraform-managed-backups.md %}
43 changes: 39 additions & 4 deletions src/current/cockroachcloud/managed-backups.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ Configurable managed backup settings are available in all [supported versions]({

Full backups in the cluster will be deleted when they reach the set retention period. At this point, any incremental backups dependent on the deleted full backup will also be deleted. The Cloud Console will not list any backups that are beyond the set retention period, or incremental backups that cannot be restored.

For instructions on how to view and configure managed backup settings, use:
For instructions on how to view and configure managed backup settings, use one of the following:

- The [Cloud Console](#cloud-console).
- The [Cloud API](#cloud-api).
- [Cloud Console](#cloud-console).
- [Cloud API](#cloud-api).
- [CockroachDB {{ site.data.products.cloud }} Terraform provider](#cockroachdb-cloud-terraform-provider).

{% include cockroachcloud/backups/full-backup-setting-change.md %}

Expand Down Expand Up @@ -125,4 +126,38 @@ To restore a cluster:

## Cloud API

{% include cockroachcloud/backups/cloud-api-get-put.md %}
{% include cockroachcloud/backups/cloud-api-get-put.md %}

## CockroachDB Cloud Terraform provider

You can use the [CockroachDB {{ site.data.products.cloud }} Terraform provider]({% link cockroachcloud/provision-a-cluster-with-terraform.md %}) to specify managed backup settings in {{ site.data.products.standard }} clusters.

In your `main.tf` Terraform configuration file, use the `backup_config` attribute on the `cockroach_cluster` resource to modify the settings of managed backups. For example:

{% include_cached copy-clipboard.html %}
~~~ hcl
resource "cockroach_cluster" "standard" {
name = "cockroach-standard"
cloud_provider = "GCP"
plan = "STANDARD"
serverless = {
usage_limits = {
provisioned_virtual_cpus = 2
}
upgrade_type = "AUTOMATIC"
}
regions = [
{
name = "us-east1"
}
]
delete_protection = false
backup_config = {
enabled = true
frequency_minutes = 60
retention_days = 30
}
}
~~~

{% include cockroachcloud/backups/terraform-managed-backups.md %}
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ In this tutorial, you will create a CockroachDB {{ site.data.products.standard }
- Under `usage_limits`, set `provisioned_virtual_cpus` to the required maximum vCPUs for the cluster.
- Under `regions`, add the names of one or more regions for the cluster.
- To optionally enable [deletion protection]({% link cockroachcloud/basic-cluster-management.md %}#enable-deletion-protection), set `delete_protection` to `true`.

{% include cockroachcloud/backups/provision-cluster-tf-managed-backups.md %}
{{ remaining_steps }}

{{site.data.alerts.callout_success}}
1E79 Expand Down Expand Up @@ -179,6 +181,8 @@ In this tutorial, you will create a CockroachDB {{ site.data.products.advanced }
- Under `dedicated`, set `storage_gib` to a value large enough to contain the cluster's expected data. Set `num_virtual_cpus` to the number of vCPUs per node.
- Under `regions`, add the names of one or more regions for the cluster and specify the `node_count`, or the number of nodes, per region.
- To optionally enable [deletion protection]({% link cockroachcloud/basic-cluster-management.md %}#enable-deletion-protection), set `delete_protection` to `true`.

{% include cockroachcloud/backups/provision-cluster-tf-managed-backups.md %}
{{ remaining_steps }}

</section>
Expand Down Expand Up @@ -255,3 +259,4 @@ Enter `yes` when prompted to delete the cluster.

- Read the [CockroachDB Cloud Terraform provider reference docs](https://registry.terraform.io/providers/cockroachdb/cockroach/latest/docs) in the Terraform registry, which provide detailed information on the resources you can manage using Terraform.
- Browse the [example recipes](https://github.com/cockroachdb/terraform-provider-cockroach/tree/main/examples) in the Terraform Provider's GitHub repository.
- Refer to the [Managed Backups]({% link cockroachcloud/managed-backups.md %}#cockroachdb-cloud-terraform-provider) page to configure the managed backups for your CockroachDB {{ site.data.products.cloud }} cluster.
Loading
0