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

Add backup_config attribute to cockroach_cluster resource #242

Merged
merged 2 commits into from
Oct 28, 2024

Conversation

fantapop
Copy link
Collaborator

The ability to manage backup configurations for clusters is added here.

Note that this is an alternate approach to #241 . Here we add the backup_config as an attribute on the cluster resource instead of giving it a dedicated resource. This pattern is more in line with our other resources because conceptually, the backup configuration for a cluster exists whether or not it is being managed in terraform.

@kathancox I've copied most of the documentation over directly from the other PR that you reviewed. There were some changes in format because now that the backup config is attached to an attribute, there wasn't as much room to put the large block of text necessary for documenting the work arounds for setting retention days. Instead, I created a separate page as a "guide" for this purpose.

Commit checklist

  • Changelog
  • Doc gen (make generate)
  • Integration test(s)
  • Acceptance test(s)
  • Example(s)

This brings in sdk changes for controlling backup configuration.
Copy link

@kathancox kathancox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The markdown files lgtm! All comments non-blocking, optional nits.

@@ -28,6 +28,7 @@ data "cockroach_cluster" "cockroach" {
### Read-Only

- `account_id` (String) The cloud provider account ID that hosts the cluster. Needed for CMEK and other advanced features.
- `backup_config` (Attributes) (see [below for nested schema](#nestedatt--backup_config))
Copy link

@kathancox kathancox Oct 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `backup_config` (Attributes) (see [below for nested schema](#nestedatt--backup_config))
- `backup_config` (Attributes) Refer to [Nested Schema for `backup_config`](#nestedatt--backup_config).

That change might be overly doc-sy.
Do you need the anchor link <a id="nestedatt--backup_config"></a>? Would it work to just use the heading as the link, so it would probably be (#nested-schema-for-backup_config). I'm assuming this works the same as other .md files, but maybe I'm wrong!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is all generated automatically. We could customize it, but I'm unclear if we could do it in a way that wouldn't provide ongoing maintenance. It may be possible but It would need to be considered for a separate project and would need to be prioritized.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, makes sense!


Changing the value of `backup_config.retention_days` after using your one change
will be a multi-step operation. Here are two workflows that will work. Both of
these options assume you already have modified retention_days once and as a

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
these options assume you already have modified retention_days once and as a
these options assume you already have modified `retention_days` once and as a

these options assume you already have modified retention_days once and as a
result must open a support ticket:

* Change it and then open a ticket before applying:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Change it and then open a ticket before applying:
* Change it, and then open a ticket before applying the change to Terraform. To do this:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional nit; just trying to connect the numbered steps to this sentence.

1. Update `backup_config.retention_days` to the new value in Terraform.
1. Before applying the run, contact support to change
`backup_config.retention_days` to the new value.
1. Apply the changes in Terraform. A Terraform READ operation will complete,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. Apply the changes in Terraform. A Terraform READ operation will complete,
1. Apply the changes in Terraform. A Terraform `READ` operation will complete,

1. Apply the changes in Terraform. A Terraform READ operation will complete,
recognize the existing value, and update the tf state.
* Temporarily remove management of the `backup_config.retention_days` from
Terraform, update it via ticket, and then add it back.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Terraform, update it via ticket, and then add it back.
Terraform, update it via ticket, and then add it back. To do this:

CHANGELOG.md Outdated
Comment on lines 10 to 13
- management of cluster backup settings is now supported using the
`backup_config` attribute on the `cockroach_cluster` resource. See
[Cluster Backups](https://www.cockroachlabs.com/docs/cockroachcloud/managed-backups)
for more information.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- management of cluster backup settings is now supported using the
`backup_config` attribute on the `cockroach_cluster` resource. See
[Cluster Backups](https://www.cockroachlabs.com/docs/cockroachcloud/managed-backups)
for more information.
- Management of cluster backup settings is now supported using the
`backup_config` attribute on the `cockroach_cluster` resource. For more information, refer to
[Cluster Backups](https://www.cockroachlabs.com/docs/cockroachcloud/managed-backups).

these options assume you already have modified retention_days once and as a
result must open a support ticket:

* Change it and then open a ticket before applying:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Change it and then open a ticket before applying:
* Change it, and then open a ticket before applying the change to Terraform. To do this:

Comment on lines 30 to 31
* Temporarily remove management of the `backup_config.retention_days` from
Terraform, update it via ticket, and then add it back.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Temporarily remove management of the `backup_config.retention_days` from
Terraform, update it via ticket, and then add it back.
* Temporarily remove management of the `backup_config.retention_days` from
Terraform, update it via ticket, and then add it back. To do this:


Changing the value of `backup_config.retention_days` after using your one change
will be a multi-step operation. Here are two workflows that will work. Both of
these options assume you already have modified retention_days once and as a

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
these options assume you already have modified retention_days once and as a
these options assume you already have modified `retention_days` once and as a

1. Update `backup_config.retention_days` to the new value in Terraform.
1. Before applying the run, contact support to change
`backup_config.retention_days` to the new value.
1. Apply the changes in Terraform. A Terraform READ operation will complete,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. Apply the changes in Terraform. A Terraform READ operation will complete,
1. Apply the changes in Terraform. A Terraform `READ` operation will complete,

@fantapop fantapop force-pushed the fantapop/CC-27591-backup-configuration-in-cluster branch from 8b59700 to 29282c1 Compare October 28, 2024 16:41
@fantapop
Copy link
Collaborator Author

Thanks for your attention on this @kathancox . I've made the requested changes here.

The ability to manage backup configurations for clusters is added here.
@fantapop fantapop force-pushed the fantapop/CC-27591-backup-configuration-in-cluster branch from 29282c1 to 25b0dd4 Compare October 28, 2024 17:25
Copy link
Contributor

@rgcase rgcase left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM looks great, I think this looks much better than having it as its own resource.

@fantapop fantapop mentioned this pull request Oct 28, 2024
5 tasks
@fantapop fantapop merged commit 9cc0df1 into main Oct 28, 2024
4 checks passed
@fantapop fantapop deleted the fantapop/CC-27591-backup-configuration-in-cluster branch October 28, 2024 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants