Skip to content

Commit

Permalink
chore(server): improve simple_backup description (#680)
Browse files Browse the repository at this point in the history
  • Loading branch information
kangasta authored Nov 11, 2024
1 parent fe5897d commit 1b47327
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
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

0 comments on commit 1b47327

Please sign in to comment.