-
Notifications
You must be signed in to change notification settings - Fork 89
feat(automation): Onboard volume backup automation #1768
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
Draft
Fyusel
wants to merge
1
commit into
main
Choose a base branch
from
onboard-volume-backup-automation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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: "stackit_volume_automation Data Source - stackit" | ||
| subcategory: "" | ||
| description: |- | ||
| Volume automation datasource schema. Must have a region specified in the provider configuration. | ||
| ~> This datasource is in beta and may be subject to breaking changes in the future. Use with caution. See our guide https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/guides/opting_into_beta_resources for how to opt-in to use beta resources. | ||
| --- | ||
|
|
||
| # stackit_volume_automation (Data Source) | ||
|
|
||
| Volume automation datasource schema. Must have a `region` specified in the provider configuration. | ||
|
|
||
| ~> This datasource is in beta and may be subject to breaking changes in the future. Use with caution. See our [guide](https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/guides/opting_into_beta_resources) for how to opt-in to use beta resources. | ||
|
|
||
| ## Example Usage | ||
|
|
||
| ```terraform | ||
| data "stackit_volume_automation" "example" { | ||
| project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" | ||
| automation_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" | ||
| } | ||
| ``` | ||
|
|
||
| <!-- schema generated by tfplugindocs --> | ||
| ## Schema | ||
|
|
||
| ### Required | ||
|
|
||
| - `automation_id` (String) ID of the volume automation. | ||
| - `project_id` (String) STACKIT Project ID to which the volume automation is associated. | ||
|
|
||
| ### Optional | ||
|
|
||
| - `region` (String) The resource region. If not defined, the provider region is used. | ||
|
|
||
| ### Read-Only | ||
|
|
||
| - `description` (String) The volume automation description. | ||
| - `id` (String) Terraform's internal resource identifier. It is structured as "`project_id`,`region`,`automation_id`". | ||
| - `input` (Attributes) Configuration input for the volume automation. Exactly one of the nested attributes must be set. (see [below for nested schema](#nestedatt--input)) | ||
| - `name` (String) The volume automation name. | ||
| - `template_id` (String) ID of the automation template this volume automation is based on. | ||
| - `triggers` (Attributes) Triggers that determine when the automation runs. (see [below for nested schema](#nestedatt--triggers)) | ||
|
|
||
| <a id="nestedatt--input"></a> | ||
| ### Nested Schema for `input` | ||
|
|
||
| Read-Only: | ||
|
|
||
| - `volume_recovery_point_management` (Attributes) Configuration for automated volume recovery point (snapshot) management. (see [below for nested schema](#nestedatt--input--volume_recovery_point_management)) | ||
|
|
||
| <a id="nestedatt--input--volume_recovery_point_management"></a> | ||
| ### Nested Schema for `input.volume_recovery_point_management` | ||
|
|
||
| Read-Only: | ||
|
|
||
| - `inherit_volume_labels` (Boolean) Whether recovery points inherit the labels of the volume they were created from. Defaults to `false`. | ||
| - `recovery_point_labels` (Map of String) Labels to attach to created recovery points. | ||
| - `snapshot_retention_policy` (Attributes) Defines how long created recovery points (snapshots) are retained. (see [below for nested schema](#nestedatt--input--volume_recovery_point_management--snapshot_retention_policy)) | ||
| - `volume_label_selector` (String) Label selector used to select the volumes this automation applies to. | ||
|
|
||
| <a id="nestedatt--input--volume_recovery_point_management--snapshot_retention_policy"></a> | ||
| ### Nested Schema for `input.volume_recovery_point_management.snapshot_retention_policy` | ||
|
|
||
| Read-Only: | ||
|
|
||
| - `kind` (String) The retention policy kind. Valid values are: `count`, `indefinitely`. | ||
| - `value` (Number) Number of recovery points to retain. Required if `kind` is `count`, must not be set otherwise. | ||
|
|
||
|
|
||
|
|
||
|
|
||
| <a id="nestedatt--triggers"></a> | ||
| ### Nested Schema for `triggers` | ||
|
|
||
| Read-Only: | ||
|
|
||
| - `schedule` (Attributes) Runs the automation on a recurring schedule. (see [below for nested schema](#nestedatt--triggers--schedule)) | ||
|
|
||
| <a id="nestedatt--triggers--schedule"></a> | ||
| ### Nested Schema for `triggers.schedule` | ||
|
|
||
| Read-Only: | ||
|
|
||
| - `rrule` (String) An `rrule` (Recurrence Rule) is a standardized string format used in iCalendar (RFC 5545) to define repeating events, and you can generate one by using a dedicated library or by using online generator tools to specify parameters like frequency, interval, and end dates. |
This file contains hidden or 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,126 @@ | ||
| --- | ||
| # generated by https://github.com/hashicorp/terraform-plugin-docs | ||
| page_title: "stackit_volume_automation Resource - stackit" | ||
| subcategory: "" | ||
| description: |- | ||
| Volume automation resource schema. Must have a region specified in the provider configuration. | ||
| ~> This resource is in beta and may be subject to breaking changes in the future. Use with caution. See our guide https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/guides/opting_into_beta_resources for how to opt-in to use beta resources. | ||
| --- | ||
|
|
||
| # stackit_volume_automation (Resource) | ||
|
|
||
| Volume automation resource schema. Must have a `region` specified in the provider configuration. | ||
|
|
||
| ~> This resource is in beta and may be subject to breaking changes in the future. Use with caution. See our [guide](https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/guides/opting_into_beta_resources) for how to opt-in to use beta resources. | ||
|
|
||
| ## Example Usage | ||
|
|
||
| ```terraform | ||
| resource "stackit_volume_automation" "example" { | ||
| project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" | ||
| template_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" | ||
| name = "example-volume-automation" | ||
| description = "Creates daily volume snapshots and keeps the last 7." | ||
| input = { | ||
| volume_recovery_point_management = { | ||
| inherit_volume_labels = true | ||
| recovery_point_labels = { | ||
| "created-by" = "terraform" | ||
| } | ||
| volume_label_selector = "backup=daily" | ||
| snapshot_retention_policy = { | ||
| kind = "count" | ||
| value = 4 | ||
| } | ||
| } | ||
| } | ||
| triggers = { | ||
| schedule = { | ||
| rrule = "DTSTART;TZID=Europe/Sofia:20200803T023000 RRULE:FREQ=DAILY;INTERVAL=1" | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| <!-- schema generated by tfplugindocs --> | ||
| ## Schema | ||
|
|
||
| ### Required | ||
|
|
||
| - `project_id` (String) STACKIT Project ID to which the volume automation is associated. | ||
| - `template_id` (String) ID of the automation template this volume automation is based on. | ||
|
|
||
| ### Optional | ||
|
|
||
| - `description` (String) The volume automation description. | ||
| - `input` (Attributes) Configuration input for the volume automation. Exactly one of the nested attributes must be set. (see [below for nested schema](#nestedatt--input)) | ||
| - `name` (String) The volume automation name. | ||
| - `region` (String) The resource region. If not defined, the provider region is used. | ||
| - `triggers` (Attributes) Triggers that determine when the automation runs. (see [below for nested schema](#nestedatt--triggers)) | ||
|
|
||
| ### Read-Only | ||
|
|
||
| - `automation_id` (String) ID of the volume automation. | ||
| - `id` (String) Terraform's internal resource identifier. It is structured as "`project_id`,`region`,`automation_id`". | ||
|
|
||
| <a id="nestedatt--input"></a> | ||
| ### Nested Schema for `input` | ||
|
|
||
| Optional: | ||
|
|
||
| - `volume_recovery_point_management` (Attributes) Configuration for automated volume recovery point (snapshot) management. (see [below for nested schema](#nestedatt--input--volume_recovery_point_management)) | ||
|
|
||
| <a id="nestedatt--input--volume_recovery_point_management"></a> | ||
| ### Nested Schema for `input.volume_recovery_point_management` | ||
|
|
||
| Required: | ||
|
|
||
| - `snapshot_retention_policy` (Attributes) Defines how long created recovery points (snapshots) are retained. (see [below for nested schema](#nestedatt--input--volume_recovery_point_management--snapshot_retention_policy)) | ||
|
|
||
| Optional: | ||
|
|
||
| - `inherit_volume_labels` (Boolean) Whether recovery points inherit the labels of the volume they were created from. Defaults to `false`. | ||
| - `recovery_point_labels` (Map of String) Labels to attach to created recovery points. | ||
| - `volume_label_selector` (String) Label selector used to select the volumes this automation applies to. | ||
|
|
||
| <a id="nestedatt--input--volume_recovery_point_management--snapshot_retention_policy"></a> | ||
| ### Nested Schema for `input.volume_recovery_point_management.snapshot_retention_policy` | ||
|
|
||
| Required: | ||
|
|
||
| - `kind` (String) The retention policy kind. Valid values are: `count`, `indefinitely`. | ||
|
|
||
| Optional: | ||
|
|
||
| - `value` (Number) Number of recovery points to retain. Required if `kind` is `count`, must not be set otherwise. | ||
|
|
||
|
|
||
|
|
||
|
|
||
| <a id="nestedatt--triggers"></a> | ||
| ### Nested Schema for `triggers` | ||
|
|
||
| Optional: | ||
|
|
||
| - `schedule` (Attributes) Runs the automation on a recurring schedule. (see [below for nested schema](#nestedatt--triggers--schedule)) | ||
|
|
||
| <a id="nestedatt--triggers--schedule"></a> | ||
| ### Nested Schema for `triggers.schedule` | ||
|
|
||
| Required: | ||
|
|
||
| - `rrule` (String) An `rrule` (Recurrence Rule) is a standardized string format used in iCalendar (RFC 5545) to define repeating events, and you can generate one by using a dedicated library or by using online generator tools to specify parameters like frequency, interval, and end dates. | ||
|
|
||
| ## Import | ||
|
|
||
| Import is supported using the following syntax: | ||
|
|
||
| In Terraform v1.5.0 and later, the [` + "`" + `import` + "`" + ` block](https://developer.hashicorp.com/terraform/language/import) can be used with the ` + "`" + `id` + "`" + ` attribute, for example: | ||
|
|
||
| ```terraform | ||
| # Only use the import statement, if you want to import an existing volume automation resource | ||
| import { | ||
| to = stackit_volume_automation.import-example | ||
| id = "${var.project_id},${var.region},${var.automation_id}" | ||
| } | ||
| ``` |
4 changes: 4 additions & 0 deletions
4
examples/data-sources/stackit_volume_automation/data-source.tf
This file contains hidden or 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,4 @@ | ||
| data "stackit_volume_automation" "example" { | ||
| project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" | ||
| automation_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" | ||
| } |
5 changes: 5 additions & 0 deletions
5
examples/resources/stackit_volume_automation/import-by-string-id.tf
This file contains hidden or 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,5 @@ | ||
| # Only use the import statement, if you want to import an existing volume automation resource | ||
| import { | ||
| to = stackit_volume_automation.import-example | ||
| id = "${var.project_id},${var.region},${var.automation_id}" | ||
| } |
This file contains hidden or 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,24 @@ | ||
| resource "stackit_volume_automation" "example" { | ||
| project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" | ||
| template_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" | ||
| name = "example-volume-automation" | ||
| description = "Creates daily volume snapshots and keeps the last 7." | ||
| input = { | ||
| volume_recovery_point_management = { | ||
| inherit_volume_labels = true | ||
| recovery_point_labels = { | ||
| "created-by" = "terraform" | ||
| } | ||
| volume_label_selector = "backup=daily" | ||
| snapshot_retention_policy = { | ||
| kind = "count" | ||
| value = 4 | ||
| } | ||
| } | ||
| } | ||
| triggers = { | ||
| schedule = { | ||
| rrule = "DTSTART;TZID=Europe/Sofia:20200803T023000 RRULE:FREQ=DAILY;INTERVAL=1" | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
types.StringPointerValue()can be used instead. It does the same thing and comes directly from the framework