Skip to content

Commit ef7d107

Browse files
Bp tf resource (#12158) (#20159)
[upstream:b685f478f17cabae12a3ba27670fdd903f3bba12] Signed-off-by: Modular Magician <[email protected]>
1 parent 637c5c7 commit ef7d107

File tree

4 files changed

+256
-0
lines changed

4 files changed

+256
-0
lines changed

.changelog/12158.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
```release-note:new-resource
2+
`google_backup_dr_backup_plan`
3+
```
4+
```release-note:new-datasource
5+
`google_backup_dr_backup_plan`
6+
```
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Copyright (c) HashiCorp, Inc.
2+
// SPDX-License-Identifier: MPL-2.0
3+
package backupdr
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Copyright (c) HashiCorp, Inc.
2+
// SPDX-License-Identifier: MPL-2.0
3+
package backupdr_test
Lines changed: 244 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
---
2+
# ----------------------------------------------------------------------------
3+
#
4+
# *** AUTO GENERATED CODE *** Type: MMv1 ***
5+
#
6+
# ----------------------------------------------------------------------------
7+
#
8+
# This file is automatically generated by Magic Modules and manual
9+
# changes will be clobbered when the file is regenerated.
10+
#
11+
# Please read more about how to change this file in
12+
# .github/CONTRIBUTING.md.
13+
#
14+
# ----------------------------------------------------------------------------
15+
subcategory: "Backup and DR Service"
16+
description: |-
17+
A backup plan defines when and how to back up a resource, including the backup's schedule, retention, and location.
18+
---
19+
20+
# google_backup_dr_backup_plan
21+
22+
A backup plan defines when and how to back up a resource, including the backup's schedule, retention, and location.
23+
24+
~> **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider.
25+
See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources.
26+
27+
To get more information about BackupPlan, see:
28+
29+
* [API documentation](https://cloud.google.com/backup-disaster-recovery/docs/reference/rest)
30+
* How-to Guides
31+
* [Official Documentation](https://cloud.google.com/backup-disaster-recovery/docs)
32+
33+
## Example Usage - Backup Dr Backup Plan Simple
34+
35+
36+
```hcl
37+
resource "google_backup_dr_backup_vault" "my_backup_vault" {
38+
provider = google-beta
39+
location = "us-central1"
40+
backup_vault_id = "bv-bp-test"
41+
backup_minimum_enforced_retention_duration = "100000s"
42+
}
43+
44+
resource "google_backup_dr_backup_plan" "my-backup-plan-1" {
45+
provider = google-beta
46+
location = "us-central1"
47+
backup_plan_id = "backup-plan-simple-test"
48+
resource_type = "compute.googleapis.com/Instance"
49+
backup_vault = google_backup_dr_backup_vault.my_backup_vault.id
50+
51+
backup_rules {
52+
rule_id = "rule-1"
53+
backup_retention_days = 5
54+
55+
standard_schedule {
56+
recurrence_type = "HOURLY"
57+
hourly_frequency = 6
58+
time_zone = "UTC"
59+
60+
backup_window {
61+
start_hour_of_day = 0
62+
end_hour_of_day = 24
63+
}
64+
}
65+
}
66+
}
67+
```
68+
69+
## Argument Reference
70+
71+
The following arguments are supported:
72+
73+
74+
* `backup_vault` -
75+
(Required)
76+
Backup vault where the backups gets stored using this Backup plan.
77+
78+
* `resource_type` -
79+
(Required)
80+
The resource type to which the `BackupPlan` will be applied. Examples include, "compute.googleapis.com/Instance" and "storage.googleapis.com/Bucket".
81+
82+
* `backup_rules` -
83+
(Required)
84+
The backup rules for this `BackupPlan`. There must be at least one `BackupRule` message.
85+
Structure is [documented below](#nested_backup_rules).
86+
87+
* `location` -
88+
(Required)
89+
The location for the backup plan
90+
91+
* `backup_plan_id` -
92+
(Required)
93+
The ID of the backup plan
94+
95+
96+
<a name="nested_backup_rules"></a>The `backup_rules` block supports:
97+
98+
* `rule_id` -
99+
(Required)
100+
The unique ID of this `BackupRule`. The `rule_id` is unique per `BackupPlan`.
101+
102+
* `backup_retention_days` -
103+
(Required)
104+
Configures the duration for which backup data will be kept. The value should be greater than or equal to minimum enforced retention of the backup vault.
105+
106+
* `standard_schedule` -
107+
(Required)
108+
StandardSchedule defines a schedule that runs within the confines of a defined window of days.
109+
Structure is [documented below](#nested_standard_schedule).
110+
111+
112+
<a name="nested_standard_schedule"></a>The `standard_schedule` block supports:
113+
114+
* `recurrence_type` -
115+
(Required)
116+
RecurrenceType enumerates the applicable periodicity for the schedule.
117+
Possible values are: `HOURLY`, `DAILY`, `WEEKLY`, `MONTHLY`, `YEARLY`.
118+
119+
* `hourly_frequency` -
120+
(Optional)
121+
Specifies frequency for hourly backups. An hourly frequency of 2 means jobs will run every 2 hours from start time till end time defined.
122+
This is required for `recurrence_type`, `HOURLY` and is not applicable otherwise.
123+
124+
* `days_of_week` -
125+
(Optional)
126+
Specifies days of week like MONDAY or TUESDAY, on which jobs will run. This is required for `recurrence_type`, `WEEKLY` and is not applicable otherwise.
127+
Each value may be one of: `DAY_OF_WEEK_UNSPECIFIED`, `MONDAY`, `TUESDAY`, `WEDNESDAY`, `THURSDAY`, `FRIDAY`, `SATURDAY`.
128+
129+
* `days_of_month` -
130+
(Optional)
131+
Specifies days of months like 1, 5, or 14 on which jobs will run.
132+
133+
* `week_day_of_month` -
134+
(Optional)
135+
Specifies a week day of the month like FIRST SUNDAY or LAST MONDAY, on which jobs will run.
136+
Structure is [documented below](#nested_week_day_of_month).
137+
138+
* `months` -
139+
(Optional)
140+
Specifies values of months
141+
Each value may be one of: `MONTH_UNSPECIFIED`, `JANUARY`, `FEBRUARY`, `MARCH`, `APRIL`, `MAY`, `JUNE`, `JULY`, `AUGUST`, `SEPTEMBER`, `OCTOBER`, `NOVEMBER`, `DECEMBER`.
142+
143+
* `time_zone` -
144+
(Required)
145+
The time zone to be used when interpreting the schedule.
146+
147+
* `backup_window` -
148+
(Optional)
149+
A BackupWindow defines the window of the day during which backup jobs will run. Jobs are queued at the beginning of the window and will be marked as
150+
`NOT_RUN` if they do not start by the end of the window.
151+
Structure is [documented below](#nested_backup_window).
152+
153+
154+
<a name="nested_week_day_of_month"></a>The `week_day_of_month` block supports:
155+
156+
* `week_of_month` -
157+
(Required)
158+
WeekOfMonth enumerates possible weeks in the month, e.g. the first, third, or last week of the month.
159+
Possible values are: `WEEK_OF_MONTH_UNSPECIFIED`, `FIRST`, `SECOND`, `THIRD`, `FOURTH`, `LAST`.
160+
161+
* `day_of_week` -
162+
(Required)
163+
Specifies the day of the week.
164+
Possible values are: `DAY_OF_WEEK_UNSPECIFIED`, `MONDAY`, `TUESDAY`, `WEDNESDAY`, `THURSDAY`, `FRIDAY`, `SATURDAY`, `SUNDAY`.
165+
166+
<a name="nested_backup_window"></a>The `backup_window` block supports:
167+
168+
* `start_hour_of_day` -
169+
(Required)
170+
The hour of the day (0-23) when the window starts, for example, if the value of the start hour of the day is 6, that means the backup window starts at 6:00.
171+
172+
* `end_hour_of_day` -
173+
(Optional)
174+
The hour of the day (1-24) when the window ends, for example, if the value of end hour of the day is 10, that means the backup window end time is 10:00.
175+
The end hour of the day should be greater than the start
176+
177+
- - -
178+
179+
180+
* `description` -
181+
(Optional)
182+
The description allows for additional details about `BackupPlan` and its use cases to be provided.
183+
184+
* `project` - (Optional) The ID of the project in which the resource belongs.
185+
If it is not provided, the provider project is used.
186+
187+
188+
## Attributes Reference
189+
190+
In addition to the arguments listed above, the following computed attributes are exported:
191+
192+
* `id` - an identifier for the resource with format `projects/{{project}}/locations/{{location}}/backupPlans/{{backup_plan_id}}`
193+
194+
* `name` -
195+
The name of backup plan resource created
196+
197+
* `backup_vault_service_account` -
198+
The Google Cloud Platform Service Account to be used by the BackupVault for taking backups.
199+
200+
* `create_time` -
201+
When the `BackupPlan` was created.
202+
203+
* `update_time` -
204+
When the `BackupPlan` was last updated.
205+
206+
207+
## Timeouts
208+
209+
This resource provides the following
210+
[Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options:
211+
212+
- `create` - Default is 60 minutes.
213+
- `delete` - Default is 60 minutes.
214+
215+
## Import
216+
217+
218+
BackupPlan can be imported using any of these accepted formats:
219+
220+
* `projects/{{project}}/locations/{{location}}/backupPlans/{{backup_plan_id}}`
221+
* `{{project}}/{{location}}/{{backup_plan_id}}`
222+
* `{{location}}/{{backup_plan_id}}`
223+
224+
225+
In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import BackupPlan using one of the formats above. For example:
226+
227+
```tf
228+
import {
229+
id = "projects/{{project}}/locations/{{location}}/backupPlans/{{backup_plan_id}}"
230+
to = google_backup_dr_backup_plan.default
231+
}
232+
```
233+
234+
When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), BackupPlan can be imported using one of the formats above. For example:
235+
236+
```
237+
$ terraform import google_backup_dr_backup_plan.default projects/{{project}}/locations/{{location}}/backupPlans/{{backup_plan_id}}
238+
$ terraform import google_backup_dr_backup_plan.default {{project}}/{{location}}/{{backup_plan_id}}
239+
$ terraform import google_backup_dr_backup_plan.default {{location}}/{{backup_plan_id}}
240+
```
241+
242+
## User Project Overrides
243+
244+
This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override).

0 commit comments

Comments
 (0)