published on Tuesday, Oct 20, 2026 by Pulumi
published on Tuesday, Oct 20, 2026 by Pulumi
An AutoProtectionPolicy automates backup management by applying a backup plan to all
eligible resources that match the policy’s criteria, instead of protecting each resource
individually. A policy takes effect only after it is attached to a scope, such as a
project, with a googleBackupDrAutoProtectionPolicyBinding.
Warning: This resource is in beta, and should be used with the terraform-provider-google-beta provider. See Provider Versions for more details on beta resources.
To get more information about AutoProtectionPolicy, see:
- API documentation
- How-to Guides
Example Usage
Backup Dr Auto Protection Policy Basic
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const myBackupVault = new gcp.backupdisasterrecovery.BackupVault("my_backup_vault", {
location: "us-central1",
backupVaultId: "bv-app",
backupMinimumEnforcedRetentionDuration: "100000s",
});
const myBackupPlan = new gcp.backupdisasterrecovery.BackupPlan("my_backup_plan", {
location: "us-central1",
backupPlanId: "bp-app",
resourceType: "compute.googleapis.com/Instance",
backupVault: myBackupVault.id,
backupRules: [{
ruleId: "rule-1",
backupRetentionDays: 5,
standardSchedule: {
recurrenceType: "HOURLY",
hourlyFrequency: 6,
timeZone: "UTC",
backupWindow: {
startHourOfDay: 0,
endHourOfDay: 24,
},
},
}],
});
const my_auto_protection_policy = new gcp.backupdisasterrecovery.AutoProtectionPolicy("my-auto-protection-policy", {
location: "us-central1",
autoProtectionPolicyId: "app",
criteria: {
matchingConditions: [{
labelCondition: {
key: "env",
values: ["prod"],
},
}],
},
backupPlanDetails: [{
resourceType: "compute.googleapis.com/Instance",
backupPlan: myBackupPlan.name,
}],
});
import pulumi
import pulumi_gcp as gcp
my_backup_vault = gcp.backupdisasterrecovery.BackupVault("my_backup_vault",
location="us-central1",
backup_vault_id="bv-app",
backup_minimum_enforced_retention_duration="100000s")
my_backup_plan = gcp.backupdisasterrecovery.BackupPlan("my_backup_plan",
location="us-central1",
backup_plan_id="bp-app",
resource_type="compute.googleapis.com/Instance",
backup_vault=my_backup_vault.id,
backup_rules=[{
"rule_id": "rule-1",
"backup_retention_days": 5,
"standard_schedule": {
"recurrence_type": "HOURLY",
"hourly_frequency": 6,
"time_zone": "UTC",
"backup_window": {
"start_hour_of_day": 0,
"end_hour_of_day": 24,
},
},
}])
my_auto_protection_policy = gcp.backupdisasterrecovery.AutoProtectionPolicy("my-auto-protection-policy",
location="us-central1",
auto_protection_policy_id="app",
criteria={
"matching_conditions": [{
"label_condition": {
"key": "env",
"values": ["prod"],
},
}],
},
backup_plan_details=[{
"resource_type": "compute.googleapis.com/Instance",
"backup_plan": my_backup_plan.name,
}])
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v10/go/gcp/backupdisasterrecovery"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
myBackupVault, err := backupdisasterrecovery.NewBackupVault(ctx, "my_backup_vault", &backupdisasterrecovery.BackupVaultArgs{
Location: pulumi.String("us-central1"),
BackupVaultId: pulumi.String("bv-app"),
BackupMinimumEnforcedRetentionDuration: pulumi.String("100000s"),
})
if err != nil {
return err
}
myBackupPlan, err := backupdisasterrecovery.NewBackupPlan(ctx, "my_backup_plan", &backupdisasterrecovery.BackupPlanArgs{
Location: pulumi.String("us-central1"),
BackupPlanId: pulumi.String("bp-app"),
ResourceType: pulumi.String("compute.googleapis.com/Instance"),
BackupVault: myBackupVault.ID(),
BackupRules: backupdisasterrecovery.BackupPlanBackupRuleArray{
&backupdisasterrecovery.BackupPlanBackupRuleArgs{
RuleId: pulumi.String("rule-1"),
BackupRetentionDays: pulumi.Int(5),
StandardSchedule: &backupdisasterrecovery.BackupPlanBackupRuleStandardScheduleArgs{
RecurrenceType: pulumi.String("HOURLY"),
HourlyFrequency: pulumi.Int(6),
TimeZone: pulumi.String("UTC"),
BackupWindow: &backupdisasterrecovery.BackupPlanBackupRuleStandardScheduleBackupWindowArgs{
StartHourOfDay: pulumi.Int(0),
EndHourOfDay: pulumi.Int(24),
},
},
},
},
})
if err != nil {
return err
}
_, err = backupdisasterrecovery.NewAutoProtectionPolicy(ctx, "my-auto-protection-policy", &backupdisasterrecovery.AutoProtectionPolicyArgs{
Location: pulumi.String("us-central1"),
AutoProtectionPolicyId: pulumi.String("app"),
Criteria: &backupdisasterrecovery.AutoProtectionPolicyCriteriaArgs{
MatchingConditions: backupdisasterrecovery.AutoProtectionPolicyCriteriaMatchingConditionArray{
&backupdisasterrecovery.AutoProtectionPolicyCriteriaMatchingConditionArgs{
LabelCondition: &backupdisasterrecovery.AutoProtectionPolicyCriteriaMatchingConditionLabelConditionArgs{
Key: pulumi.String("env"),
Values: pulumi.StringArray{
pulumi.String("prod"),
},
},
},
},
},
BackupPlanDetails: backupdisasterrecovery.AutoProtectionPolicyBackupPlanDetailArray{
&backupdisasterrecovery.AutoProtectionPolicyBackupPlanDetailArgs{
ResourceType: pulumi.String("compute.googleapis.com/Instance"),
BackupPlan: myBackupPlan.Name,
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var myBackupVault = new Gcp.BackupDisasterRecovery.BackupVault("my_backup_vault", new()
{
Location = "us-central1",
BackupVaultId = "bv-app",
BackupMinimumEnforcedRetentionDuration = "100000s",
});
var myBackupPlan = new Gcp.BackupDisasterRecovery.BackupPlan("my_backup_plan", new()
{
Location = "us-central1",
BackupPlanId = "bp-app",
ResourceType = "compute.googleapis.com/Instance",
BackupVault = myBackupVault.Id,
BackupRules = new[]
{
new Gcp.BackupDisasterRecovery.Inputs.BackupPlanBackupRuleArgs
{
RuleId = "rule-1",
BackupRetentionDays = 5,
StandardSchedule = new Gcp.BackupDisasterRecovery.Inputs.BackupPlanBackupRuleStandardScheduleArgs
{
RecurrenceType = "HOURLY",
HourlyFrequency = 6,
TimeZone = "UTC",
BackupWindow = new Gcp.BackupDisasterRecovery.Inputs.BackupPlanBackupRuleStandardScheduleBackupWindowArgs
{
StartHourOfDay = 0,
EndHourOfDay = 24,
},
},
},
},
});
var my_auto_protection_policy = new Gcp.BackupDisasterRecovery.AutoProtectionPolicy("my-auto-protection-policy", new()
{
Location = "us-central1",
AutoProtectionPolicyId = "app",
Criteria = new Gcp.BackupDisasterRecovery.Inputs.AutoProtectionPolicyCriteriaArgs
{
MatchingConditions = new[]
{
new Gcp.BackupDisasterRecovery.Inputs.AutoProtectionPolicyCriteriaMatchingConditionArgs
{
LabelCondition = new Gcp.BackupDisasterRecovery.Inputs.AutoProtectionPolicyCriteriaMatchingConditionLabelConditionArgs
{
Key = "env",
Values = new[]
{
"prod",
},
},
},
},
},
BackupPlanDetails = new[]
{
new Gcp.BackupDisasterRecovery.Inputs.AutoProtectionPolicyBackupPlanDetailArgs
{
ResourceType = "compute.googleapis.com/Instance",
BackupPlan = myBackupPlan.Name,
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.backupdisasterrecovery.BackupVault;
import com.pulumi.gcp.backupdisasterrecovery.BackupVaultArgs;
import com.pulumi.gcp.backupdisasterrecovery.BackupPlan;
import com.pulumi.gcp.backupdisasterrecovery.BackupPlanArgs;
import com.pulumi.gcp.backupdisasterrecovery.inputs.BackupPlanBackupRuleArgs;
import com.pulumi.gcp.backupdisasterrecovery.inputs.BackupPlanBackupRuleStandardScheduleArgs;
import com.pulumi.gcp.backupdisasterrecovery.inputs.BackupPlanBackupRuleStandardScheduleBackupWindowArgs;
import com.pulumi.gcp.backupdisasterrecovery.AutoProtectionPolicy;
import com.pulumi.gcp.backupdisasterrecovery.AutoProtectionPolicyArgs;
import com.pulumi.gcp.backupdisasterrecovery.inputs.AutoProtectionPolicyCriteriaArgs;
import com.pulumi.gcp.backupdisasterrecovery.inputs.AutoProtectionPolicyCriteriaMatchingConditionArgs;
import com.pulumi.gcp.backupdisasterrecovery.inputs.AutoProtectionPolicyCriteriaMatchingConditionLabelConditionArgs;
import com.pulumi.gcp.backupdisasterrecovery.inputs.AutoProtectionPolicyBackupPlanDetailArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var myBackupVault = new BackupVault("myBackupVault", BackupVaultArgs.builder()
.location("us-central1")
.backupVaultId("bv-app")
.backupMinimumEnforcedRetentionDuration("100000s")
.build());
var myBackupPlan = new BackupPlan("myBackupPlan", BackupPlanArgs.builder()
.location("us-central1")
.backupPlanId("bp-app")
.resourceType("compute.googleapis.com/Instance")
.backupVault(myBackupVault.id())
.backupRules(BackupPlanBackupRuleArgs.builder()
.ruleId("rule-1")
.backupRetentionDays(5)
.standardSchedule(BackupPlanBackupRuleStandardScheduleArgs.builder()
.recurrenceType("HOURLY")
.hourlyFrequency(6)
.timeZone("UTC")
.backupWindow(BackupPlanBackupRuleStandardScheduleBackupWindowArgs.builder()
.startHourOfDay(0)
.endHourOfDay(24)
.build())
.build())
.build())
.build());
var my_auto_protection_policy = new AutoProtectionPolicy("my-auto-protection-policy", AutoProtectionPolicyArgs.builder()
.location("us-central1")
.autoProtectionPolicyId("app")
.criteria(AutoProtectionPolicyCriteriaArgs.builder()
.matchingConditions(AutoProtectionPolicyCriteriaMatchingConditionArgs.builder()
.labelCondition(AutoProtectionPolicyCriteriaMatchingConditionLabelConditionArgs.builder()
.key("env")
.values("prod")
.build())
.build())
.build())
.backupPlanDetails(AutoProtectionPolicyBackupPlanDetailArgs.builder()
.resourceType("compute.googleapis.com/Instance")
.backupPlan(myBackupPlan.name())
.build())
.build());
}
}
resources:
myBackupVault:
type: gcp:backupdisasterrecovery:BackupVault
name: my_backup_vault
properties:
location: us-central1
backupVaultId: bv-app
backupMinimumEnforcedRetentionDuration: 100000s
myBackupPlan:
type: gcp:backupdisasterrecovery:BackupPlan
name: my_backup_plan
properties:
location: us-central1
backupPlanId: bp-app
resourceType: compute.googleapis.com/Instance
backupVault: ${myBackupVault.id}
backupRules:
- ruleId: rule-1
backupRetentionDays: 5
standardSchedule:
recurrenceType: HOURLY
hourlyFrequency: 6
timeZone: UTC
backupWindow:
startHourOfDay: 0
endHourOfDay: 24
my-auto-protection-policy:
type: gcp:backupdisasterrecovery:AutoProtectionPolicy
properties:
location: us-central1
autoProtectionPolicyId: app
criteria:
matchingConditions:
- labelCondition:
key: env
values:
- prod
backupPlanDetails:
- resourceType: compute.googleapis.com/Instance
backupPlan: ${myBackupPlan.name}
terraform {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
resource "gcp_backupdisasterrecovery_backup_vault" "my_backup_vault" {
lifecycle {
create_before_destroy = true
}
location = "us-central1"
backup_vault_id = "bv-app"
backup_minimum_enforced_retention_duration = "100000s"
}
resource "gcp_backupdisasterrecovery_backup_plan" "my_backup_plan" {
lifecycle {
create_before_destroy = true
}
location = "us-central1"
backup_plan_id = "bp-app"
resource_type = "compute.googleapis.com/Instance"
backup_vault = gcp_backupdisasterrecovery_backup_vault.my_backup_vault.id
backup_rules {
rule_id = "rule-1"
backup_retention_days = 5
standard_schedule = {
recurrence_type = "HOURLY"
hourly_frequency = 6
time_zone = "UTC"
backup_window = {
start_hour_of_day = 0
end_hour_of_day = 24
}
}
}
}
resource "gcp_backupdisasterrecovery_auto_protection_policy" "my-auto-protection-policy" {
lifecycle {
create_before_destroy = true
}
location = "us-central1"
auto_protection_policy_id = "app"
criteria = {
matching_conditions = [{
label_condition = {
key = "env"
values = ["prod"]
}
}]
}
backup_plan_details {
resource_type = "compute.googleapis.com/Instance"
backup_plan = gcp_backupdisasterrecovery_backup_plan.my_backup_plan.name
}
}
Backup Dr Auto Protection Policy Full
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const myBackupVault = new gcp.backupdisasterrecovery.BackupVault("my_backup_vault", {
location: "us-central1",
backupVaultId: "bv-app-update",
backupMinimumEnforcedRetentionDuration: "100000s",
});
const instanceBackupPlan = new gcp.backupdisasterrecovery.BackupPlan("instance_backup_plan", {
location: "us-central1",
backupPlanId: "bp-app-update-vm",
resourceType: "compute.googleapis.com/Instance",
backupVault: myBackupVault.id,
backupRules: [{
ruleId: "rule-1",
backupRetentionDays: 5,
standardSchedule: {
recurrenceType: "HOURLY",
hourlyFrequency: 6,
timeZone: "UTC",
backupWindow: {
startHourOfDay: 0,
endHourOfDay: 24,
},
},
}],
});
const my_auto_protection_policy = new gcp.backupdisasterrecovery.AutoProtectionPolicy("my-auto-protection-policy", {
location: "us-central1",
autoProtectionPolicyId: "app-update",
description: "Protects production VMs.",
criteria: {
matchingConditions: [{
labelCondition: {
key: "env",
values: ["prod"],
},
}],
},
backupPlanDetails: [{
resourceType: "compute.googleapis.com/Instance",
backupPlan: instanceBackupPlan.name,
}],
});
import pulumi
import pulumi_gcp as gcp
my_backup_vault = gcp.backupdisasterrecovery.BackupVault("my_backup_vault",
location="us-central1",
backup_vault_id="bv-app-update",
backup_minimum_enforced_retention_duration="100000s")
instance_backup_plan = gcp.backupdisasterrecovery.BackupPlan("instance_backup_plan",
location="us-central1",
backup_plan_id="bp-app-update-vm",
resource_type="compute.googleapis.com/Instance",
backup_vault=my_backup_vault.id,
backup_rules=[{
"rule_id": "rule-1",
"backup_retention_days": 5,
"standard_schedule": {
"recurrence_type": "HOURLY",
"hourly_frequency": 6,
"time_zone": "UTC",
"backup_window": {
"start_hour_of_day": 0,
"end_hour_of_day": 24,
},
},
}])
my_auto_protection_policy = gcp.backupdisasterrecovery.AutoProtectionPolicy("my-auto-protection-policy",
location="us-central1",
auto_protection_policy_id="app-update",
description="Protects production VMs.",
criteria={
"matching_conditions": [{
"label_condition": {
"key": "env",
"values": ["prod"],
},
}],
},
backup_plan_details=[{
"resource_type": "compute.googleapis.com/Instance",
"backup_plan": instance_backup_plan.name,
}])
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v10/go/gcp/backupdisasterrecovery"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
myBackupVault, err := backupdisasterrecovery.NewBackupVault(ctx, "my_backup_vault", &backupdisasterrecovery.BackupVaultArgs{
Location: pulumi.String("us-central1"),
BackupVaultId: pulumi.String("bv-app-update"),
BackupMinimumEnforcedRetentionDuration: pulumi.String("100000s"),
})
if err != nil {
return err
}
instanceBackupPlan, err := backupdisasterrecovery.NewBackupPlan(ctx, "instance_backup_plan", &backupdisasterrecovery.BackupPlanArgs{
Location: pulumi.String("us-central1"),
BackupPlanId: pulumi.String("bp-app-update-vm"),
ResourceType: pulumi.String("compute.googleapis.com/Instance"),
BackupVault: myBackupVault.ID(),
BackupRules: backupdisasterrecovery.BackupPlanBackupRuleArray{
&backupdisasterrecovery.BackupPlanBackupRuleArgs{
RuleId: pulumi.String("rule-1"),
BackupRetentionDays: pulumi.Int(5),
StandardSchedule: &backupdisasterrecovery.BackupPlanBackupRuleStandardScheduleArgs{
RecurrenceType: pulumi.String("HOURLY"),
HourlyFrequency: pulumi.Int(6),
TimeZone: pulumi.String("UTC"),
BackupWindow: &backupdisasterrecovery.BackupPlanBackupRuleStandardScheduleBackupWindowArgs{
StartHourOfDay: pulumi.Int(0),
EndHourOfDay: pulumi.Int(24),
},
},
},
},
})
if err != nil {
return err
}
_, err = backupdisasterrecovery.NewAutoProtectionPolicy(ctx, "my-auto-protection-policy", &backupdisasterrecovery.AutoProtectionPolicyArgs{
Location: pulumi.String("us-central1"),
AutoProtectionPolicyId: pulumi.String("app-update"),
Description: pulumi.String("Protects production VMs."),
Criteria: &backupdisasterrecovery.AutoProtectionPolicyCriteriaArgs{
MatchingConditions: backupdisasterrecovery.AutoProtectionPolicyCriteriaMatchingConditionArray{
&backupdisasterrecovery.AutoProtectionPolicyCriteriaMatchingConditionArgs{
LabelCondition: &backupdisasterrecovery.AutoProtectionPolicyCriteriaMatchingConditionLabelConditionArgs{
Key: pulumi.String("env"),
Values: pulumi.StringArray{
pulumi.String("prod"),
},
},
},
},
},
BackupPlanDetails: backupdisasterrecovery.AutoProtectionPolicyBackupPlanDetailArray{
&backupdisasterrecovery.AutoProtectionPolicyBackupPlanDetailArgs{
ResourceType: pulumi.String("compute.googleapis.com/Instance"),
BackupPlan: instanceBackupPlan.Name,
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var myBackupVault = new Gcp.BackupDisasterRecovery.BackupVault("my_backup_vault", new()
{
Location = "us-central1",
BackupVaultId = "bv-app-update",
BackupMinimumEnforcedRetentionDuration = "100000s",
});
var instanceBackupPlan = new Gcp.BackupDisasterRecovery.BackupPlan("instance_backup_plan", new()
{
Location = "us-central1",
BackupPlanId = "bp-app-update-vm",
ResourceType = "compute.googleapis.com/Instance",
BackupVault = myBackupVault.Id,
BackupRules = new[]
{
new Gcp.BackupDisasterRecovery.Inputs.BackupPlanBackupRuleArgs
{
RuleId = "rule-1",
BackupRetentionDays = 5,
StandardSchedule = new Gcp.BackupDisasterRecovery.Inputs.BackupPlanBackupRuleStandardScheduleArgs
{
RecurrenceType = "HOURLY",
HourlyFrequency = 6,
TimeZone = "UTC",
BackupWindow = new Gcp.BackupDisasterRecovery.Inputs.BackupPlanBackupRuleStandardScheduleBackupWindowArgs
{
StartHourOfDay = 0,
EndHourOfDay = 24,
},
},
},
},
});
var my_auto_protection_policy = new Gcp.BackupDisasterRecovery.AutoProtectionPolicy("my-auto-protection-policy", new()
{
Location = "us-central1",
AutoProtectionPolicyId = "app-update",
Description = "Protects production VMs.",
Criteria = new Gcp.BackupDisasterRecovery.Inputs.AutoProtectionPolicyCriteriaArgs
{
MatchingConditions = new[]
{
new Gcp.BackupDisasterRecovery.Inputs.AutoProtectionPolicyCriteriaMatchingConditionArgs
{
LabelCondition = new Gcp.BackupDisasterRecovery.Inputs.AutoProtectionPolicyCriteriaMatchingConditionLabelConditionArgs
{
Key = "env",
Values = new[]
{
"prod",
},
},
},
},
},
BackupPlanDetails = new[]
{
new Gcp.BackupDisasterRecovery.Inputs.AutoProtectionPolicyBackupPlanDetailArgs
{
ResourceType = "compute.googleapis.com/Instance",
BackupPlan = instanceBackupPlan.Name,
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.backupdisasterrecovery.BackupVault;
import com.pulumi.gcp.backupdisasterrecovery.BackupVaultArgs;
import com.pulumi.gcp.backupdisasterrecovery.BackupPlan;
import com.pulumi.gcp.backupdisasterrecovery.BackupPlanArgs;
import com.pulumi.gcp.backupdisasterrecovery.inputs.BackupPlanBackupRuleArgs;
import com.pulumi.gcp.backupdisasterrecovery.inputs.BackupPlanBackupRuleStandardScheduleArgs;
import com.pulumi.gcp.backupdisasterrecovery.inputs.BackupPlanBackupRuleStandardScheduleBackupWindowArgs;
import com.pulumi.gcp.backupdisasterrecovery.AutoProtectionPolicy;
import com.pulumi.gcp.backupdisasterrecovery.AutoProtectionPolicyArgs;
import com.pulumi.gcp.backupdisasterrecovery.inputs.AutoProtectionPolicyCriteriaArgs;
import com.pulumi.gcp.backupdisasterrecovery.inputs.AutoProtectionPolicyCriteriaMatchingConditionArgs;
import com.pulumi.gcp.backupdisasterrecovery.inputs.AutoProtectionPolicyCriteriaMatchingConditionLabelConditionArgs;
import com.pulumi.gcp.backupdisasterrecovery.inputs.AutoProtectionPolicyBackupPlanDetailArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var myBackupVault = new BackupVault("myBackupVault", BackupVaultArgs.builder()
.location("us-central1")
.backupVaultId("bv-app-update")
.backupMinimumEnforcedRetentionDuration("100000s")
.build());
var instanceBackupPlan = new BackupPlan("instanceBackupPlan", BackupPlanArgs.builder()
.location("us-central1")
.backupPlanId("bp-app-update-vm")
.resourceType("compute.googleapis.com/Instance")
.backupVault(myBackupVault.id())
.backupRules(BackupPlanBackupRuleArgs.builder()
.ruleId("rule-1")
.backupRetentionDays(5)
.standardSchedule(BackupPlanBackupRuleStandardScheduleArgs.builder()
.recurrenceType("HOURLY")
.hourlyFrequency(6)
.timeZone("UTC")
.backupWindow(BackupPlanBackupRuleStandardScheduleBackupWindowArgs.builder()
.startHourOfDay(0)
.endHourOfDay(24)
.build())
.build())
.build())
.build());
var my_auto_protection_policy = new AutoProtectionPolicy("my-auto-protection-policy", AutoProtectionPolicyArgs.builder()
.location("us-central1")
.autoProtectionPolicyId("app-update")
.description("Protects production VMs.")
.criteria(AutoProtectionPolicyCriteriaArgs.builder()
.matchingConditions(AutoProtectionPolicyCriteriaMatchingConditionArgs.builder()
.labelCondition(AutoProtectionPolicyCriteriaMatchingConditionLabelConditionArgs.builder()
.key("env")
.values("prod")
.build())
.build())
.build())
.backupPlanDetails(AutoProtectionPolicyBackupPlanDetailArgs.builder()
.resourceType("compute.googleapis.com/Instance")
.backupPlan(instanceBackupPlan.name())
.build())
.build());
}
}
resources:
myBackupVault:
type: gcp:backupdisasterrecovery:BackupVault
name: my_backup_vault
properties:
location: us-central1
backupVaultId: bv-app-update
backupMinimumEnforcedRetentionDuration: 100000s
instanceBackupPlan:
type: gcp:backupdisasterrecovery:BackupPlan
name: instance_backup_plan
properties:
location: us-central1
backupPlanId: bp-app-update-vm
resourceType: compute.googleapis.com/Instance
backupVault: ${myBackupVault.id}
backupRules:
- ruleId: rule-1
backupRetentionDays: 5
standardSchedule:
recurrenceType: HOURLY
hourlyFrequency: 6
timeZone: UTC
backupWindow:
startHourOfDay: 0
endHourOfDay: 24
my-auto-protection-policy:
type: gcp:backupdisasterrecovery:AutoProtectionPolicy
properties:
location: us-central1
autoProtectionPolicyId: app-update
description: Protects production VMs.
criteria:
matchingConditions:
- labelCondition:
key: env
values:
- prod
backupPlanDetails:
- resourceType: compute.googleapis.com/Instance
backupPlan: ${instanceBackupPlan.name}
terraform {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
resource "gcp_backupdisasterrecovery_backup_vault" "my_backup_vault" {
lifecycle {
create_before_destroy = true
}
location = "us-central1"
backup_vault_id = "bv-app-update"
backup_minimum_enforced_retention_duration = "100000s"
}
resource "gcp_backupdisasterrecovery_backup_plan" "instance_backup_plan" {
lifecycle {
create_before_destroy = true
}
location = "us-central1"
backup_plan_id = "bp-app-update-vm"
resource_type = "compute.googleapis.com/Instance"
backup_vault = gcp_backupdisasterrecovery_backup_vault.my_backup_vault.id
backup_rules {
rule_id = "rule-1"
backup_retention_days = 5
standard_schedule = {
recurrence_type = "HOURLY"
hourly_frequency = 6
time_zone = "UTC"
backup_window = {
start_hour_of_day = 0
end_hour_of_day = 24
}
}
}
}
resource "gcp_backupdisasterrecovery_auto_protection_policy" "my-auto-protection-policy" {
lifecycle {
create_before_destroy = true
}
location = "us-central1"
auto_protection_policy_id = "app-update"
description = "Protects production VMs."
criteria = {
matching_conditions = [{
label_condition = {
key = "env"
values = ["prod"]
}
}]
}
backup_plan_details {
resource_type = "compute.googleapis.com/Instance"
backup_plan = gcp_backupdisasterrecovery_backup_plan.instance_backup_plan.name
}
}
Create AutoProtectionPolicy Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new AutoProtectionPolicy(name: string, args: AutoProtectionPolicyArgs, opts?: CustomResourceOptions);@overload
def AutoProtectionPolicy(resource_name: str,
args: AutoProtectionPolicyArgs,
opts: Optional[ResourceOptions] = None)
@overload
def AutoProtectionPolicy(resource_name: str,
opts: Optional[ResourceOptions] = None,
auto_protection_policy_id: Optional[str] = None,
backup_plan_details: Optional[Sequence[AutoProtectionPolicyBackupPlanDetailArgs]] = None,
criteria: Optional[AutoProtectionPolicyCriteriaArgs] = None,
location: Optional[str] = None,
deletion_policy: Optional[str] = None,
description: Optional[str] = None,
project: Optional[str] = None)func NewAutoProtectionPolicy(ctx *Context, name string, args AutoProtectionPolicyArgs, opts ...ResourceOption) (*AutoProtectionPolicy, error)public AutoProtectionPolicy(string name, AutoProtectionPolicyArgs args, CustomResourceOptions? opts = null)
public AutoProtectionPolicy(String name, AutoProtectionPolicyArgs args)
public AutoProtectionPolicy(String name, AutoProtectionPolicyArgs args, CustomResourceOptions options)
type: gcp:backupdisasterrecovery:AutoProtectionPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "gcp_backupdisasterrecovery_auto_protection_policy" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args AutoProtectionPolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args AutoProtectionPolicyArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args AutoProtectionPolicyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args AutoProtectionPolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args AutoProtectionPolicyArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var autoProtectionPolicyResource = new Gcp.BackupDisasterRecovery.AutoProtectionPolicy("autoProtectionPolicyResource", new()
{
AutoProtectionPolicyId = "string",
BackupPlanDetails = new[]
{
new Gcp.BackupDisasterRecovery.Inputs.AutoProtectionPolicyBackupPlanDetailArgs
{
BackupPlan = "string",
ResourceType = "string",
},
},
Criteria = new Gcp.BackupDisasterRecovery.Inputs.AutoProtectionPolicyCriteriaArgs
{
MatchingConditions = new[]
{
new Gcp.BackupDisasterRecovery.Inputs.AutoProtectionPolicyCriteriaMatchingConditionArgs
{
LabelCondition = new Gcp.BackupDisasterRecovery.Inputs.AutoProtectionPolicyCriteriaMatchingConditionLabelConditionArgs
{
Key = "string",
Values = new[]
{
"string",
},
},
},
},
},
Location = "string",
DeletionPolicy = "string",
Description = "string",
Project = "string",
});
example, err := backupdisasterrecovery.NewAutoProtectionPolicy(ctx, "autoProtectionPolicyResource", &backupdisasterrecovery.AutoProtectionPolicyArgs{
AutoProtectionPolicyId: pulumi.String("string"),
BackupPlanDetails: backupdisasterrecovery.AutoProtectionPolicyBackupPlanDetailArray{
&backupdisasterrecovery.AutoProtectionPolicyBackupPlanDetailArgs{
BackupPlan: pulumi.String("string"),
ResourceType: pulumi.String("string"),
},
},
Criteria: &backupdisasterrecovery.AutoProtectionPolicyCriteriaArgs{
MatchingConditions: backupdisasterrecovery.AutoProtectionPolicyCriteriaMatchingConditionArray{
&backupdisasterrecovery.AutoProtectionPolicyCriteriaMatchingConditionArgs{
LabelCondition: &backupdisasterrecovery.AutoProtectionPolicyCriteriaMatchingConditionLabelConditionArgs{
Key: pulumi.String("string"),
Values: pulumi.StringArray{
pulumi.String("string"),
},
},
},
},
},
Location: pulumi.String("string"),
DeletionPolicy: pulumi.String("string"),
Description: pulumi.String("string"),
Project: pulumi.String("string"),
})
resource "gcp_backupdisasterrecovery_auto_protection_policy" "autoProtectionPolicyResource" {
lifecycle {
create_before_destroy = true
}
auto_protection_policy_id = "string"
backup_plan_details {
backup_plan = "string"
resource_type = "string"
}
criteria = {
matching_conditions = [{
label_condition = {
key = "string"
values = ["string"]
}
}]
}
location = "string"
deletion_policy = "string"
description = "string"
project = "string"
}
var autoProtectionPolicyResource = new AutoProtectionPolicy("autoProtectionPolicyResource", AutoProtectionPolicyArgs.builder()
.autoProtectionPolicyId("string")
.backupPlanDetails(AutoProtectionPolicyBackupPlanDetailArgs.builder()
.backupPlan("string")
.resourceType("string")
.build())
.criteria(AutoProtectionPolicyCriteriaArgs.builder()
.matchingConditions(AutoProtectionPolicyCriteriaMatchingConditionArgs.builder()
.labelCondition(AutoProtectionPolicyCriteriaMatchingConditionLabelConditionArgs.builder()
.key("string")
.values("string")
.build())
.build())
.build())
.location("string")
.deletionPolicy("string")
.description("string")
.project("string")
.build());
auto_protection_policy_resource = gcp.backupdisasterrecovery.AutoProtectionPolicy("autoProtectionPolicyResource",
auto_protection_policy_id="string",
backup_plan_details=[{
"backup_plan": "string",
"resource_type": "string",
}],
criteria={
"matching_conditions": [{
"label_condition": {
"key": "string",
"values": ["string"],
},
}],
},
location="string",
deletion_policy="string",
description="string",
project="string")
const autoProtectionPolicyResource = new gcp.backupdisasterrecovery.AutoProtectionPolicy("autoProtectionPolicyResource", {
autoProtectionPolicyId: "string",
backupPlanDetails: [{
backupPlan: "string",
resourceType: "string",
}],
criteria: {
matchingConditions: [{
labelCondition: {
key: "string",
values: ["string"],
},
}],
},
location: "string",
deletionPolicy: "string",
description: "string",
project: "string",
});
type: gcp:backupdisasterrecovery:AutoProtectionPolicy
properties:
autoProtectionPolicyId: string
backupPlanDetails:
- backupPlan: string
resourceType: string
criteria:
matchingConditions:
- labelCondition:
key: string
values:
- string
deletionPolicy: string
description: string
location: string
project: string
AutoProtectionPolicy Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The AutoProtectionPolicy resource accepts the following input properties:
- Auto
Protection stringPolicy Id - The ID of the auto protection policy. This becomes the final component of the policy's resource name.
- Backup
Plan List<AutoDetails Protection Policy Backup Plan Detail> - The backup plans to apply to the resources that match the policy's criteria. Each entry specifies a resource type and the backup plan that protects resources of that type. Currently, only one entry is supported. Structure is documented below.
- Criteria
Auto
Protection Policy Criteria - The criteria that a resource must meet to be protected by the policy. Structure is documented below.
- Location string
- The location of the auto protection policy.
- Deletion
Policy string - Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
- Description string
- A description of the auto protection policy.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Auto
Protection stringPolicy Id - The ID of the auto protection policy. This becomes the final component of the policy's resource name.
- Backup
Plan []AutoDetails Protection Policy Backup Plan Detail Args - The backup plans to apply to the resources that match the policy's criteria. Each entry specifies a resource type and the backup plan that protects resources of that type. Currently, only one entry is supported. Structure is documented below.
- Criteria
Auto
Protection Policy Criteria Args - The criteria that a resource must meet to be protected by the policy. Structure is documented below.
- Location string
- The location of the auto protection policy.
- Deletion
Policy string - Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
- Description string
- A description of the auto protection policy.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- auto_
protection_ stringpolicy_ id - The ID of the auto protection policy. This becomes the final component of the policy's resource name.
- backup_
plan_ list(object)details - The backup plans to apply to the resources that match the policy's criteria. Each entry specifies a resource type and the backup plan that protects resources of that type. Currently, only one entry is supported. Structure is documented below.
- criteria object
- The criteria that a resource must meet to be protected by the policy. Structure is documented below.
- location string
- The location of the auto protection policy.
- deletion_
policy string - Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
- description string
- A description of the auto protection policy.
- project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- auto
Protection StringPolicy Id - The ID of the auto protection policy. This becomes the final component of the policy's resource name.
- backup
Plan List<AutoDetails Protection Policy Backup Plan Detail> - The backup plans to apply to the resources that match the policy's criteria. Each entry specifies a resource type and the backup plan that protects resources of that type. Currently, only one entry is supported. Structure is documented below.
- criteria
Auto
Protection Policy Criteria - The criteria that a resource must meet to be protected by the policy. Structure is documented below.
- location String
- The location of the auto protection policy.
- deletion
Policy String - Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
- description String
- A description of the auto protection policy.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- auto
Protection stringPolicy Id - The ID of the auto protection policy. This becomes the final component of the policy's resource name.
- backup
Plan AutoDetails Protection Policy Backup Plan Detail[] - The backup plans to apply to the resources that match the policy's criteria. Each entry specifies a resource type and the backup plan that protects resources of that type. Currently, only one entry is supported. Structure is documented below.
- criteria
Auto
Protection Policy Criteria - The criteria that a resource must meet to be protected by the policy. Structure is documented below.
- location string
- The location of the auto protection policy.
- deletion
Policy string - Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
- description string
- A description of the auto protection policy.
- project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- auto_
protection_ strpolicy_ id - The ID of the auto protection policy. This becomes the final component of the policy's resource name.
- backup_
plan_ Sequence[Autodetails Protection Policy Backup Plan Detail Args] - The backup plans to apply to the resources that match the policy's criteria. Each entry specifies a resource type and the backup plan that protects resources of that type. Currently, only one entry is supported. Structure is documented below.
- criteria
Auto
Protection Policy Criteria Args - The criteria that a resource must meet to be protected by the policy. Structure is documented below.
- location str
- The location of the auto protection policy.
- deletion_
policy str - Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
- description str
- A description of the auto protection policy.
- project str
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- auto
Protection StringPolicy Id - The ID of the auto protection policy. This becomes the final component of the policy's resource name.
- backup
Plan List<Property Map>Details - The backup plans to apply to the resources that match the policy's criteria. Each entry specifies a resource type and the backup plan that protects resources of that type. Currently, only one entry is supported. Structure is documented below.
- criteria Property Map
- The criteria that a resource must meet to be protected by the policy. Structure is documented below.
- location String
- The location of the auto protection policy.
- deletion
Policy String - Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
- description String
- A description of the auto protection policy.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
Outputs
All input properties are implicitly available as output properties. Additionally, the AutoProtectionPolicy resource produces the following output properties:
- Binding
Summaries List<AutoProtection Policy Binding Summary> - A summary of the scopes that the policy is applied to through bindings. Structure is documented below.
- Create
Time string - The time when the auto protection policy was created.
- Etag string
- The etag of the auto protection policy, used for optimistic concurrency control.
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- The resource name of the auto protection policy, in the format
projects/{project}/locations/{location}/autoProtectionPolicies/{auto_protection_policy_id}. - Policy
Evaluation List<AutoSummaries Protection Policy Policy Evaluation Summary> - A summary of the last run of the job that applies the policy to matching resources. Structure is documented below.
- State string
- The current state of the auto protection policy.
Possible values are
CREATING,ACTIVE,UPDATING, andDELETING. - Update
Time string - The time when the auto protection policy was last updated.
- Binding
Summaries []AutoProtection Policy Binding Summary - A summary of the scopes that the policy is applied to through bindings. Structure is documented below.
- Create
Time string - The time when the auto protection policy was created.
- Etag string
- The etag of the auto protection policy, used for optimistic concurrency control.
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- The resource name of the auto protection policy, in the format
projects/{project}/locations/{location}/autoProtectionPolicies/{auto_protection_policy_id}. - Policy
Evaluation []AutoSummaries Protection Policy Policy Evaluation Summary - A summary of the last run of the job that applies the policy to matching resources. Structure is documented below.
- State string
- The current state of the auto protection policy.
Possible values are
CREATING,ACTIVE,UPDATING, andDELETING. - Update
Time string - The time when the auto protection policy was last updated.
- binding_
summaries list(object) - A summary of the scopes that the policy is applied to through bindings. Structure is documented below.
- create_
time string - The time when the auto protection policy was created.
- etag string
- The etag of the auto protection policy, used for optimistic concurrency control.
- id string
- The provider-assigned unique ID for this managed resource.
- name string
- The resource name of the auto protection policy, in the format
projects/{project}/locations/{location}/autoProtectionPolicies/{auto_protection_policy_id}. - policy_
evaluation_ list(object)summaries - A summary of the last run of the job that applies the policy to matching resources. Structure is documented below.
- state string
- The current state of the auto protection policy.
Possible values are
CREATING,ACTIVE,UPDATING, andDELETING. - update_
time string - The time when the auto protection policy was last updated.
- binding
Summaries List<AutoProtection Policy Binding Summary> - A summary of the scopes that the policy is applied to through bindings. Structure is documented below.
- create
Time String - The time when the auto protection policy was created.
- etag String
- The etag of the auto protection policy, used for optimistic concurrency control.
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- The resource name of the auto protection policy, in the format
projects/{project}/locations/{location}/autoProtectionPolicies/{auto_protection_policy_id}. - policy
Evaluation List<AutoSummaries Protection Policy Policy Evaluation Summary> - A summary of the last run of the job that applies the policy to matching resources. Structure is documented below.
- state String
- The current state of the auto protection policy.
Possible values are
CREATING,ACTIVE,UPDATING, andDELETING. - update
Time String - The time when the auto protection policy was last updated.
- binding
Summaries AutoProtection Policy Binding Summary[] - A summary of the scopes that the policy is applied to through bindings. Structure is documented below.
- create
Time string - The time when the auto protection policy was created.
- etag string
- The etag of the auto protection policy, used for optimistic concurrency control.
- id string
- The provider-assigned unique ID for this managed resource.
- name string
- The resource name of the auto protection policy, in the format
projects/{project}/locations/{location}/autoProtectionPolicies/{auto_protection_policy_id}. - policy
Evaluation AutoSummaries Protection Policy Policy Evaluation Summary[] - A summary of the last run of the job that applies the policy to matching resources. Structure is documented below.
- state string
- The current state of the auto protection policy.
Possible values are
CREATING,ACTIVE,UPDATING, andDELETING. - update
Time string - The time when the auto protection policy was last updated.
- binding_
summaries Sequence[AutoProtection Policy Binding Summary] - A summary of the scopes that the policy is applied to through bindings. Structure is documented below.
- create_
time str - The time when the auto protection policy was created.
- etag str
- The etag of the auto protection policy, used for optimistic concurrency control.
- id str
- The provider-assigned unique ID for this managed resource.
- name str
- The resource name of the auto protection policy, in the format
projects/{project}/locations/{location}/autoProtectionPolicies/{auto_protection_policy_id}. - policy_
evaluation_ Sequence[Autosummaries Protection Policy Policy Evaluation Summary] - A summary of the last run of the job that applies the policy to matching resources. Structure is documented below.
- state str
- The current state of the auto protection policy.
Possible values are
CREATING,ACTIVE,UPDATING, andDELETING. - update_
time str - The time when the auto protection policy was last updated.
- binding
Summaries List<Property Map> - A summary of the scopes that the policy is applied to through bindings. Structure is documented below.
- create
Time String - The time when the auto protection policy was created.
- etag String
- The etag of the auto protection policy, used for optimistic concurrency control.
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- The resource name of the auto protection policy, in the format
projects/{project}/locations/{location}/autoProtectionPolicies/{auto_protection_policy_id}. - policy
Evaluation List<Property Map>Summaries - A summary of the last run of the job that applies the policy to matching resources. Structure is documented below.
- state String
- The current state of the auto protection policy.
Possible values are
CREATING,ACTIVE,UPDATING, andDELETING. - update
Time String - The time when the auto protection policy was last updated.
Look up Existing AutoProtectionPolicy Resource
Get an existing AutoProtectionPolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: AutoProtectionPolicyState, opts?: CustomResourceOptions): AutoProtectionPolicy@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
auto_protection_policy_id: Optional[str] = None,
backup_plan_details: Optional[Sequence[AutoProtectionPolicyBackupPlanDetailArgs]] = None,
binding_summaries: Optional[Sequence[AutoProtectionPolicyBindingSummaryArgs]] = None,
create_time: Optional[str] = None,
criteria: Optional[AutoProtectionPolicyCriteriaArgs] = None,
deletion_policy: Optional[str] = None,
description: Optional[str] = None,
etag: Optional[str] = None,
location: Optional[str] = None,
name: Optional[str] = None,
policy_evaluation_summaries: Optional[Sequence[AutoProtectionPolicyPolicyEvaluationSummaryArgs]] = None,
project: Optional[str] = None,
state: Optional[str] = None,
update_time: Optional[str] = None) -> AutoProtectionPolicyfunc GetAutoProtectionPolicy(ctx *Context, name string, id IDInput, state *AutoProtectionPolicyState, opts ...ResourceOption) (*AutoProtectionPolicy, error)public static AutoProtectionPolicy Get(string name, Input<string> id, AutoProtectionPolicyState? state, CustomResourceOptions? opts = null)public static AutoProtectionPolicy get(String name, Output<String> id, AutoProtectionPolicyState state, CustomResourceOptions options)resources: _: type: gcp:backupdisasterrecovery:AutoProtectionPolicy get: id: ${id}import {
to = gcp_backupdisasterrecovery_auto_protection_policy.example
id = "${id}"
}
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Auto
Protection stringPolicy Id - The ID of the auto protection policy. This becomes the final component of the policy's resource name.
- Backup
Plan List<AutoDetails Protection Policy Backup Plan Detail> - The backup plans to apply to the resources that match the policy's criteria. Each entry specifies a resource type and the backup plan that protects resources of that type. Currently, only one entry is supported. Structure is documented below.
- Binding
Summaries List<AutoProtection Policy Binding Summary> - A summary of the scopes that the policy is applied to through bindings. Structure is documented below.
- Create
Time string - The time when the auto protection policy was created.
- Criteria
Auto
Protection Policy Criteria - The criteria that a resource must meet to be protected by the policy. Structure is documented below.
- Deletion
Policy string - Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
- Description string
- A description of the auto protection policy.
- Etag string
- The etag of the auto protection policy, used for optimistic concurrency control.
- Location string
- The location of the auto protection policy.
- Name string
- The resource name of the auto protection policy, in the format
projects/{project}/locations/{location}/autoProtectionPolicies/{auto_protection_policy_id}. - Policy
Evaluation List<AutoSummaries Protection Policy Policy Evaluation Summary> - A summary of the last run of the job that applies the policy to matching resources. Structure is documented below.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- State string
- The current state of the auto protection policy.
Possible values are
CREATING,ACTIVE,UPDATING, andDELETING. - Update
Time string - The time when the auto protection policy was last updated.
- Auto
Protection stringPolicy Id - The ID of the auto protection policy. This becomes the final component of the policy's resource name.
- Backup
Plan []AutoDetails Protection Policy Backup Plan Detail Args - The backup plans to apply to the resources that match the policy's criteria. Each entry specifies a resource type and the backup plan that protects resources of that type. Currently, only one entry is supported. Structure is documented below.
- Binding
Summaries []AutoProtection Policy Binding Summary Args - A summary of the scopes that the policy is applied to through bindings. Structure is documented below.
- Create
Time string - The time when the auto protection policy was created.
- Criteria
Auto
Protection Policy Criteria Args - The criteria that a resource must meet to be protected by the policy. Structure is documented below.
- Deletion
Policy string - Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
- Description string
- A description of the auto protection policy.
- Etag string
- The etag of the auto protection policy, used for optimistic concurrency control.
- Location string
- The location of the auto protection policy.
- Name string
- The resource name of the auto protection policy, in the format
projects/{project}/locations/{location}/autoProtectionPolicies/{auto_protection_policy_id}. - Policy
Evaluation []AutoSummaries Protection Policy Policy Evaluation Summary Args - A summary of the last run of the job that applies the policy to matching resources. Structure is documented below.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- State string
- The current state of the auto protection policy.
Possible values are
CREATING,ACTIVE,UPDATING, andDELETING. - Update
Time string - The time when the auto protection policy was last updated.
- auto_
protection_ stringpolicy_ id - The ID of the auto protection policy. This becomes the final component of the policy's resource name.
- backup_
plan_ list(object)details - The backup plans to apply to the resources that match the policy's criteria. Each entry specifies a resource type and the backup plan that protects resources of that type. Currently, only one entry is supported. Structure is documented below.
- binding_
summaries list(object) - A summary of the scopes that the policy is applied to through bindings. Structure is documented below.
- create_
time string - The time when the auto protection policy was created.
- criteria object
- The criteria that a resource must meet to be protected by the policy. Structure is documented below.
- deletion_
policy string - Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
- description string
- A description of the auto protection policy.
- etag string
- The etag of the auto protection policy, used for optimistic concurrency control.
- location string
- The location of the auto protection policy.
- name string
- The resource name of the auto protection policy, in the format
projects/{project}/locations/{location}/autoProtectionPolicies/{auto_protection_policy_id}. - policy_
evaluation_ list(object)summaries - A summary of the last run of the job that applies the policy to matching resources. Structure is documented below.
- project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- state string
- The current state of the auto protection policy.
Possible values are
CREATING,ACTIVE,UPDATING, andDELETING. - update_
time string - The time when the auto protection policy was last updated.
- auto
Protection StringPolicy Id - The ID of the auto protection policy. This becomes the final component of the policy's resource name.
- backup
Plan List<AutoDetails Protection Policy Backup Plan Detail> - The backup plans to apply to the resources that match the policy's criteria. Each entry specifies a resource type and the backup plan that protects resources of that type. Currently, only one entry is supported. Structure is documented below.
- binding
Summaries List<AutoProtection Policy Binding Summary> - A summary of the scopes that the policy is applied to through bindings. Structure is documented below.
- create
Time String - The time when the auto protection policy was created.
- criteria
Auto
Protection Policy Criteria - The criteria that a resource must meet to be protected by the policy. Structure is documented below.
- deletion
Policy String - Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
- description String
- A description of the auto protection policy.
- etag String
- The etag of the auto protection policy, used for optimistic concurrency control.
- location String
- The location of the auto protection policy.
- name String
- The resource name of the auto protection policy, in the format
projects/{project}/locations/{location}/autoProtectionPolicies/{auto_protection_policy_id}. - policy
Evaluation List<AutoSummaries Protection Policy Policy Evaluation Summary> - A summary of the last run of the job that applies the policy to matching resources. Structure is documented below.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- state String
- The current state of the auto protection policy.
Possible values are
CREATING,ACTIVE,UPDATING, andDELETING. - update
Time String - The time when the auto protection policy was last updated.
- auto
Protection stringPolicy Id - The ID of the auto protection policy. This becomes the final component of the policy's resource name.
- backup
Plan AutoDetails Protection Policy Backup Plan Detail[] - The backup plans to apply to the resources that match the policy's criteria. Each entry specifies a resource type and the backup plan that protects resources of that type. Currently, only one entry is supported. Structure is documented below.
- binding
Summaries AutoProtection Policy Binding Summary[] - A summary of the scopes that the policy is applied to through bindings. Structure is documented below.
- create
Time string - The time when the auto protection policy was created.
- criteria
Auto
Protection Policy Criteria - The criteria that a resource must meet to be protected by the policy. Structure is documented below.
- deletion
Policy string - Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
- description string
- A description of the auto protection policy.
- etag string
- The etag of the auto protection policy, used for optimistic concurrency control.
- location string
- The location of the auto protection policy.
- name string
- The resource name of the auto protection policy, in the format
projects/{project}/locations/{location}/autoProtectionPolicies/{auto_protection_policy_id}. - policy
Evaluation AutoSummaries Protection Policy Policy Evaluation Summary[] - A summary of the last run of the job that applies the policy to matching resources. Structure is documented below.
- project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- state string
- The current state of the auto protection policy.
Possible values are
CREATING,ACTIVE,UPDATING, andDELETING. - update
Time string - The time when the auto protection policy was last updated.
- auto_
protection_ strpolicy_ id - The ID of the auto protection policy. This becomes the final component of the policy's resource name.
- backup_
plan_ Sequence[Autodetails Protection Policy Backup Plan Detail Args] - The backup plans to apply to the resources that match the policy's criteria. Each entry specifies a resource type and the backup plan that protects resources of that type. Currently, only one entry is supported. Structure is documented below.
- binding_
summaries Sequence[AutoProtection Policy Binding Summary Args] - A summary of the scopes that the policy is applied to through bindings. Structure is documented below.
- create_
time str - The time when the auto protection policy was created.
- criteria
Auto
Protection Policy Criteria Args - The criteria that a resource must meet to be protected by the policy. Structure is documented below.
- deletion_
policy str - Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
- description str
- A description of the auto protection policy.
- etag str
- The etag of the auto protection policy, used for optimistic concurrency control.
- location str
- The location of the auto protection policy.
- name str
- The resource name of the auto protection policy, in the format
projects/{project}/locations/{location}/autoProtectionPolicies/{auto_protection_policy_id}. - policy_
evaluation_ Sequence[Autosummaries Protection Policy Policy Evaluation Summary Args] - A summary of the last run of the job that applies the policy to matching resources. Structure is documented below.
- project str
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- state str
- The current state of the auto protection policy.
Possible values are
CREATING,ACTIVE,UPDATING, andDELETING. - update_
time str - The time when the auto protection policy was last updated.
- auto
Protection StringPolicy Id - The ID of the auto protection policy. This becomes the final component of the policy's resource name.
- backup
Plan List<Property Map>Details - The backup plans to apply to the resources that match the policy's criteria. Each entry specifies a resource type and the backup plan that protects resources of that type. Currently, only one entry is supported. Structure is documented below.
- binding
Summaries List<Property Map> - A summary of the scopes that the policy is applied to through bindings. Structure is documented below.
- create
Time String - The time when the auto protection policy was created.
- criteria Property Map
- The criteria that a resource must meet to be protected by the policy. Structure is documented below.
- deletion
Policy String - Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
- description String
- A description of the auto protection policy.
- etag String
- The etag of the auto protection policy, used for optimistic concurrency control.
- location String
- The location of the auto protection policy.
- name String
- The resource name of the auto protection policy, in the format
projects/{project}/locations/{location}/autoProtectionPolicies/{auto_protection_policy_id}. - policy
Evaluation List<Property Map>Summaries - A summary of the last run of the job that applies the policy to matching resources. Structure is documented below.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- state String
- The current state of the auto protection policy.
Possible values are
CREATING,ACTIVE,UPDATING, andDELETING. - update
Time String - The time when the auto protection policy was last updated.
Supporting Types
AutoProtectionPolicyBackupPlanDetail, AutoProtectionPolicyBackupPlanDetailArgs
- Backup
Plan string - The resource name of the backup plan to apply to the matching resources, in the format
projects/{project}/locations/{location}/backupPlans/{backup_plan_id}. The backup plan must be in the same location as the auto protection policy. - Resource
Type string - The type of resource that this policy automatically protects, for example
compute.googleapis.com/Instanceorcompute.googleapis.com/Disk.
- Backup
Plan string - The resource name of the backup plan to apply to the matching resources, in the format
projects/{project}/locations/{location}/backupPlans/{backup_plan_id}. The backup plan must be in the same location as the auto protection policy. - Resource
Type string - The type of resource that this policy automatically protects, for example
compute.googleapis.com/Instanceorcompute.googleapis.com/Disk.
- backup_
plan string - The resource name of the backup plan to apply to the matching resources, in the format
projects/{project}/locations/{location}/backupPlans/{backup_plan_id}. The backup plan must be in the same location as the auto protection policy. - resource_
type string - The type of resource that this policy automatically protects, for example
compute.googleapis.com/Instanceorcompute.googleapis.com/Disk.
- backup
Plan String - The resource name of the backup plan to apply to the matching resources, in the format
projects/{project}/locations/{location}/backupPlans/{backup_plan_id}. The backup plan must be in the same location as the auto protection policy. - resource
Type String - The type of resource that this policy automatically protects, for example
compute.googleapis.com/Instanceorcompute.googleapis.com/Disk.
- backup
Plan string - The resource name of the backup plan to apply to the matching resources, in the format
projects/{project}/locations/{location}/backupPlans/{backup_plan_id}. The backup plan must be in the same location as the auto protection policy. - resource
Type string - The type of resource that this policy automatically protects, for example
compute.googleapis.com/Instanceorcompute.googleapis.com/Disk.
- backup_
plan str - The resource name of the backup plan to apply to the matching resources, in the format
projects/{project}/locations/{location}/backupPlans/{backup_plan_id}. The backup plan must be in the same location as the auto protection policy. - resource_
type str - The type of resource that this policy automatically protects, for example
compute.googleapis.com/Instanceorcompute.googleapis.com/Disk.
- backup
Plan String - The resource name of the backup plan to apply to the matching resources, in the format
projects/{project}/locations/{location}/backupPlans/{backup_plan_id}. The backup plan must be in the same location as the auto protection policy. - resource
Type String - The type of resource that this policy automatically protects, for example
compute.googleapis.com/Instanceorcompute.googleapis.com/Disk.
AutoProtectionPolicyBindingSummary, AutoProtectionPolicyBindingSummaryArgs
- Project
Count string - (Output) The total number of projects protected by the policy.
- Project
Count string - (Output) The total number of projects protected by the policy.
- project_
count string - (Output) The total number of projects protected by the policy.
- project
Count String - (Output) The total number of projects protected by the policy.
- project
Count string - (Output) The total number of projects protected by the policy.
- project_
count str - (Output) The total number of projects protected by the policy.
- project
Count String - (Output) The total number of projects protected by the policy.
AutoProtectionPolicyCriteria, AutoProtectionPolicyCriteriaArgs
- Matching
Conditions List<AutoProtection Policy Criteria Matching Condition> - A list of matching conditions that a resource must meet to be protected by the policy. Currently, only one condition is supported. Structure is documented below.
- Matching
Conditions []AutoProtection Policy Criteria Matching Condition - A list of matching conditions that a resource must meet to be protected by the policy. Currently, only one condition is supported. Structure is documented below.
- matching_
conditions list(object) - A list of matching conditions that a resource must meet to be protected by the policy. Currently, only one condition is supported. Structure is documented below.
- matching
Conditions List<AutoProtection Policy Criteria Matching Condition> - A list of matching conditions that a resource must meet to be protected by the policy. Currently, only one condition is supported. Structure is documented below.
- matching
Conditions AutoProtection Policy Criteria Matching Condition[] - A list of matching conditions that a resource must meet to be protected by the policy. Currently, only one condition is supported. Structure is documented below.
- matching_
conditions Sequence[AutoProtection Policy Criteria Matching Condition] - A list of matching conditions that a resource must meet to be protected by the policy. Currently, only one condition is supported. Structure is documented below.
- matching
Conditions List<Property Map> - A list of matching conditions that a resource must meet to be protected by the policy. Currently, only one condition is supported. Structure is documented below.
AutoProtectionPolicyCriteriaMatchingCondition, AutoProtectionPolicyCriteriaMatchingConditionArgs
- Label
Condition AutoProtection Policy Criteria Matching Condition Label Condition - A condition that matches resources based on their labels. Structure is documented below.
- Label
Condition AutoProtection Policy Criteria Matching Condition Label Condition - A condition that matches resources based on their labels. Structure is documented below.
- label_
condition object - A condition that matches resources based on their labels. Structure is documented below.
- label
Condition AutoProtection Policy Criteria Matching Condition Label Condition - A condition that matches resources based on their labels. Structure is documented below.
- label
Condition AutoProtection Policy Criteria Matching Condition Label Condition - A condition that matches resources based on their labels. Structure is documented below.
- label_
condition AutoProtection Policy Criteria Matching Condition Label Condition - A condition that matches resources based on their labels. Structure is documented below.
- label
Condition Property Map - A condition that matches resources based on their labels. Structure is documented below.
AutoProtectionPolicyCriteriaMatchingConditionLabelCondition, AutoProtectionPolicyCriteriaMatchingConditionLabelConditionArgs
AutoProtectionPolicyPolicyEvaluationSummary, AutoProtectionPolicyPolicyEvaluationSummaryArgs
- Failed
Resource stringCount - (Output) The number of matching resources whose protection failed during the last job run.
- Matching
Resource stringCount - (Output) The number of resources that currently match the policy's criteria.
- Protected
Resource stringCount - (Output) The number of matching resources that are successfully protected.
- Failed
Resource stringCount - (Output) The number of matching resources whose protection failed during the last job run.
- Matching
Resource stringCount - (Output) The number of resources that currently match the policy's criteria.
- Protected
Resource stringCount - (Output) The number of matching resources that are successfully protected.
- failed_
resource_ stringcount - (Output) The number of matching resources whose protection failed during the last job run.
- matching_
resource_ stringcount - (Output) The number of resources that currently match the policy's criteria.
- protected_
resource_ stringcount - (Output) The number of matching resources that are successfully protected.
- failed
Resource StringCount - (Output) The number of matching resources whose protection failed during the last job run.
- matching
Resource StringCount - (Output) The number of resources that currently match the policy's criteria.
- protected
Resource StringCount - (Output) The number of matching resources that are successfully protected.
- failed
Resource stringCount - (Output) The number of matching resources whose protection failed during the last job run.
- matching
Resource stringCount - (Output) The number of resources that currently match the policy's criteria.
- protected
Resource stringCount - (Output) The number of matching resources that are successfully protected.
- failed_
resource_ strcount - (Output) The number of matching resources whose protection failed during the last job run.
- matching_
resource_ strcount - (Output) The number of resources that currently match the policy's criteria.
- protected_
resource_ strcount - (Output) The number of matching resources that are successfully protected.
- failed
Resource StringCount - (Output) The number of matching resources whose protection failed during the last job run.
- matching
Resource StringCount - (Output) The number of resources that currently match the policy's criteria.
- protected
Resource StringCount - (Output) The number of matching resources that are successfully protected.
Import
AutoProtectionPolicy can be imported using any of these accepted formats:
projects/{{project}}/locations/{{location}}/autoProtectionPolicies/{{auto_protection_policy_id}}{{project}}/{{location}}/{{auto_protection_policy_id}}{{location}}/{{auto_protection_policy_id}}
When using the pulumi import command, AutoProtectionPolicy can be imported using one of the formats above. For example:
$ pulumi import gcp:backupdisasterrecovery/autoProtectionPolicy:AutoProtectionPolicy default projects/{{project}}/locations/{{location}}/autoProtectionPolicies/{{auto_protection_policy_id}}
$ pulumi import gcp:backupdisasterrecovery/autoProtectionPolicy:AutoProtectionPolicy default {{project}}/{{location}}/{{auto_protection_policy_id}}
$ pulumi import gcp:backupdisasterrecovery/autoProtectionPolicy:AutoProtectionPolicy default {{location}}/{{auto_protection_policy_id}}
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Google Cloud (GCP) pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
google-betaTerraform Provider.
published on Tuesday, Oct 20, 2026 by Pulumi