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

chore(server): improve simple_backup description #680

Merged
merged 1 commit into from
Nov 11, 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
19 changes: 9 additions & 10 deletions internal/service/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ import (
"github.com/UpCloudLtd/terraform-provider-upcloud/internal/validator"
)

const serverTitleLength int = 255
const (
serverTitleLength int = 255
simpleBackupDescription = `Simple backup schedule configuration

The simple backups provide a simplified way to back up *all* of the storages attached to a given server. This means you cannot have simple backup set for a server, and individual ` + "`" + `backup_rules` + "`" + ` on the storages attached to the server. Such configuration will throw an error during execution. This also applies to ` + "`" + `backup_rules` + "`" + ` defined for server templates.

` + storage.BackupRuleSimpleBackupWarning
)

func ResourceServer() *schema.Resource {
return &schema.Resource{
Expand Down Expand Up @@ -387,15 +394,7 @@ func ResourceServer() *schema.Resource {
},
},
"simple_backup": {
Description: `Simple backup schedule configuration
The idea behind simple backups is to provide a simplified way of backing up *all* of the storages attached to a given server.
This means you cannot have simple backup set for a server, and then some individual backup_rules on the storages attached to said server.
Such configuration will throw an error during execution. This also apply to backup_rules set for server templates.
Also, due to how UpCloud API works with simple backups and how Terraform orders the update operations,
it is advised to never switch between simple_backup on the server and individual storages backup_rules in one apply.
If you want to switch from using server simple backup to per-storage defined backup rules,
please first remove simple_backup block from a server, run 'terraform apply',
then add backup_rule to desired storages and run 'terraform apply' again.`,
Description: simpleBackupDescription,
Type: schema.TypeSet,
MaxItems: 1,
Optional: true,
Expand Down
9 changes: 6 additions & 3 deletions internal/service/storage/backup_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ import (
)

// Lines > 1 should have one level of indentation to keep them under the right list item
const BackupRuleDescription = `The criteria to backup the storage.
const (
BackupRuleSimpleBackupWarning = `Also, due to how UpCloud API works with simple backups and how Terraform orders the update operations, it is advised to never switch between ` + "`" + `simple_backup` + "`" + ` on the server and individual storages ` + "`" + `backup_rules` + "`" + ` in one apply. If you want to switch from using server simple backup to per-storage defined backup rules, please first remove ` + "`" + `simple_backup` + "`" + ` block from a server, run ` + "`" + `terraform apply` + "`" + `, then add ` + "`" + `backup_rule` + "`" + ` to desired storages and run ` + "`" + `terraform apply` + "`" + ` again.`
BackupRuleDescription = `The criteria to backup the storage.

Please keep in mind that it's not possible to have a storage with ` + "`" + `backup_rule` + "`" + ` attached to a server with ` + "`" + `simple_backup` + "`" + ` specified. Such configurations will throw errors during execution.
Please keep in mind that it's not possible to have a storage with ` + "`" + `backup_rule` + "`" + ` attached to a server with ` + "`" + `simple_backup` + "`" + ` specified. Such configurations will throw errors during execution.

Also, due to how UpCloud API works with simple backups and how Terraform orders the update operations, it is advised to never switch between ` + "`" + `simple_backup` + "`" + ` on the server and individual storages ` + "`" + `backup_rules` + "`" + ` in one apply. If you want to switch from using server simple backup to per-storage defined backup rules, please first remove simple_backup block from a server, run ` + "`" + `terraform apply` + "`" + `, then add ` + "`" + `backup_rule` + "`" + ` to desired storages and run ` + "`" + `terraform apply` + "`" + ` again.`
` + BackupRuleSimpleBackupWarning
)

type BackupRuleModel struct {
Interval types.String `tfsdk:"interval"`
Expand Down
Loading