gcp.compute.ResourcePolicy
Explore with Pulumi AI
A policy that can be attached to a resource to specify or schedule actions on that resource.
To get more information about ResourcePolicy, see:
Example Usage
Resource Policy Basic
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const foo = new gcp.compute.ResourcePolicy("foo", {
name: "gce-policy",
region: "us-central1",
snapshotSchedulePolicy: {
schedule: {
dailySchedule: {
daysInCycle: 1,
startTime: "04:00",
},
},
},
});
import pulumi
import pulumi_gcp as gcp
foo = gcp.compute.ResourcePolicy("foo",
name="gce-policy",
region="us-central1",
snapshot_schedule_policy=gcp.compute.ResourcePolicySnapshotSchedulePolicyArgs(
schedule=gcp.compute.ResourcePolicySnapshotSchedulePolicyScheduleArgs(
daily_schedule=gcp.compute.ResourcePolicySnapshotSchedulePolicyScheduleDailyScheduleArgs(
days_in_cycle=1,
start_time="04:00",
),
),
))
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewResourcePolicy(ctx, "foo", &compute.ResourcePolicyArgs{
Name: pulumi.String("gce-policy"),
Region: pulumi.String("us-central1"),
SnapshotSchedulePolicy: &compute.ResourcePolicySnapshotSchedulePolicyArgs{
Schedule: &compute.ResourcePolicySnapshotSchedulePolicyScheduleArgs{
DailySchedule: &compute.ResourcePolicySnapshotSchedulePolicyScheduleDailyScheduleArgs{
DaysInCycle: pulumi.Int(1),
StartTime: pulumi.String("04:00"),
},
},
},
})
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 foo = new Gcp.Compute.ResourcePolicy("foo", new()
{
Name = "gce-policy",
Region = "us-central1",
SnapshotSchedulePolicy = new Gcp.Compute.Inputs.ResourcePolicySnapshotSchedulePolicyArgs
{
Schedule = new Gcp.Compute.Inputs.ResourcePolicySnapshotSchedulePolicyScheduleArgs
{
DailySchedule = new Gcp.Compute.Inputs.ResourcePolicySnapshotSchedulePolicyScheduleDailyScheduleArgs
{
DaysInCycle = 1,
StartTime = "04:00",
},
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.ResourcePolicy;
import com.pulumi.gcp.compute.ResourcePolicyArgs;
import com.pulumi.gcp.compute.inputs.ResourcePolicySnapshotSchedulePolicyArgs;
import com.pulumi.gcp.compute.inputs.ResourcePolicySnapshotSchedulePolicyScheduleArgs;
import com.pulumi.gcp.compute.inputs.ResourcePolicySnapshotSchedulePolicyScheduleDailyScheduleArgs;
import java.util.List;
import java.util.ArrayList;
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 foo = new ResourcePolicy("foo", ResourcePolicyArgs.builder()
.name("gce-policy")
.region("us-central1")
.snapshotSchedulePolicy(ResourcePolicySnapshotSchedulePolicyArgs.builder()
.schedule(ResourcePolicySnapshotSchedulePolicyScheduleArgs.builder()
.dailySchedule(ResourcePolicySnapshotSchedulePolicyScheduleDailyScheduleArgs.builder()
.daysInCycle(1)
.startTime("04:00")
.build())
.build())
.build())
.build());
}
}
resources:
foo:
type: gcp:compute:ResourcePolicy
properties:
name: gce-policy
region: us-central1
snapshotSchedulePolicy:
schedule:
dailySchedule:
daysInCycle: 1
startTime: 04:00
Resource Policy Full
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const bar = new gcp.compute.ResourcePolicy("bar", {
name: "gce-policy",
region: "us-central1",
snapshotSchedulePolicy: {
schedule: {
hourlySchedule: {
hoursInCycle: 20,
startTime: "23:00",
},
},
retentionPolicy: {
maxRetentionDays: 10,
onSourceDiskDelete: "KEEP_AUTO_SNAPSHOTS",
},
snapshotProperties: {
labels: {
my_label: "value",
},
storageLocations: "us",
guestFlush: true,
},
},
});
import pulumi
import pulumi_gcp as gcp
bar = gcp.compute.ResourcePolicy("bar",
name="gce-policy",
region="us-central1",
snapshot_schedule_policy=gcp.compute.ResourcePolicySnapshotSchedulePolicyArgs(
schedule=gcp.compute.ResourcePolicySnapshotSchedulePolicyScheduleArgs(
hourly_schedule=gcp.compute.ResourcePolicySnapshotSchedulePolicyScheduleHourlyScheduleArgs(
hours_in_cycle=20,
start_time="23:00",
),
),
retention_policy=gcp.compute.ResourcePolicySnapshotSchedulePolicyRetentionPolicyArgs(
max_retention_days=10,
on_source_disk_delete="KEEP_AUTO_SNAPSHOTS",
),
snapshot_properties=gcp.compute.ResourcePolicySnapshotSchedulePolicySnapshotPropertiesArgs(
labels={
"my_label": "value",
},
storage_locations="us",
guest_flush=True,
),
))
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewResourcePolicy(ctx, "bar", &compute.ResourcePolicyArgs{
Name: pulumi.String("gce-policy"),
Region: pulumi.String("us-central1"),
SnapshotSchedulePolicy: &compute.ResourcePolicySnapshotSchedulePolicyArgs{
Schedule: &compute.ResourcePolicySnapshotSchedulePolicyScheduleArgs{
HourlySchedule: &compute.ResourcePolicySnapshotSchedulePolicyScheduleHourlyScheduleArgs{
HoursInCycle: pulumi.Int(20),
StartTime: pulumi.String("23:00"),
},
},
RetentionPolicy: &compute.ResourcePolicySnapshotSchedulePolicyRetentionPolicyArgs{
MaxRetentionDays: pulumi.Int(10),
OnSourceDiskDelete: pulumi.String("KEEP_AUTO_SNAPSHOTS"),
},
SnapshotProperties: &compute.ResourcePolicySnapshotSchedulePolicySnapshotPropertiesArgs{
Labels: pulumi.StringMap{
"my_label": pulumi.String("value"),
},
StorageLocations: pulumi.String("us"),
GuestFlush: pulumi.Bool(true),
},
},
})
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 bar = new Gcp.Compute.ResourcePolicy("bar", new()
{
Name = "gce-policy",
Region = "us-central1",
SnapshotSchedulePolicy = new Gcp.Compute.Inputs.ResourcePolicySnapshotSchedulePolicyArgs
{
Schedule = new Gcp.Compute.Inputs.ResourcePolicySnapshotSchedulePolicyScheduleArgs
{
HourlySchedule = new Gcp.Compute.Inputs.ResourcePolicySnapshotSchedulePolicyScheduleHourlyScheduleArgs
{
HoursInCycle = 20,
StartTime = "23:00",
},
},
RetentionPolicy = new Gcp.Compute.Inputs.ResourcePolicySnapshotSchedulePolicyRetentionPolicyArgs
{
MaxRetentionDays = 10,
OnSourceDiskDelete = "KEEP_AUTO_SNAPSHOTS",
},
SnapshotProperties = new Gcp.Compute.Inputs.ResourcePolicySnapshotSchedulePolicySnapshotPropertiesArgs
{
Labels =
{
{ "my_label", "value" },
},
StorageLocations = "us",
GuestFlush = true,
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.ResourcePolicy;
import com.pulumi.gcp.compute.ResourcePolicyArgs;
import com.pulumi.gcp.compute.inputs.ResourcePolicySnapshotSchedulePolicyArgs;
import com.pulumi.gcp.compute.inputs.ResourcePolicySnapshotSchedulePolicyScheduleArgs;
import com.pulumi.gcp.compute.inputs.ResourcePolicySnapshotSchedulePolicyScheduleHourlyScheduleArgs;
import com.pulumi.gcp.compute.inputs.ResourcePolicySnapshotSchedulePolicyRetentionPolicyArgs;
import com.pulumi.gcp.compute.inputs.ResourcePolicySnapshotSchedulePolicySnapshotPropertiesArgs;
import java.util.List;
import java.util.ArrayList;
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 bar = new ResourcePolicy("bar", ResourcePolicyArgs.builder()
.name("gce-policy")
.region("us-central1")
.snapshotSchedulePolicy(ResourcePolicySnapshotSchedulePolicyArgs.builder()
.schedule(ResourcePolicySnapshotSchedulePolicyScheduleArgs.builder()
.hourlySchedule(ResourcePolicySnapshotSchedulePolicyScheduleHourlyScheduleArgs.builder()
.hoursInCycle(20)
.startTime("23:00")
.build())
.build())
.retentionPolicy(ResourcePolicySnapshotSchedulePolicyRetentionPolicyArgs.builder()
.maxRetentionDays(10)
.onSourceDiskDelete("KEEP_AUTO_SNAPSHOTS")
.build())
.snapshotProperties(ResourcePolicySnapshotSchedulePolicySnapshotPropertiesArgs.builder()
.labels(Map.of("my_label", "value"))
.storageLocations("us")
.guestFlush(true)
.build())
.build())
.build());
}
}
resources:
bar:
type: gcp:compute:ResourcePolicy
properties:
name: gce-policy
region: us-central1
snapshotSchedulePolicy:
schedule:
hourlySchedule:
hoursInCycle: 20
startTime: 23:00
retentionPolicy:
maxRetentionDays: 10
onSourceDiskDelete: KEEP_AUTO_SNAPSHOTS
snapshotProperties:
labels:
my_label: value
storageLocations: us
guestFlush: true
Resource Policy Placement Policy
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const baz = new gcp.compute.ResourcePolicy("baz", {
name: "gce-policy",
region: "us-central1",
groupPlacementPolicy: {
vmCount: 2,
collocation: "COLLOCATED",
},
});
import pulumi
import pulumi_gcp as gcp
baz = gcp.compute.ResourcePolicy("baz",
name="gce-policy",
region="us-central1",
group_placement_policy=gcp.compute.ResourcePolicyGroupPlacementPolicyArgs(
vm_count=2,
collocation="COLLOCATED",
))
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewResourcePolicy(ctx, "baz", &compute.ResourcePolicyArgs{
Name: pulumi.String("gce-policy"),
Region: pulumi.String("us-central1"),
GroupPlacementPolicy: &compute.ResourcePolicyGroupPlacementPolicyArgs{
VmCount: pulumi.Int(2),
Collocation: pulumi.String("COLLOCATED"),
},
})
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 baz = new Gcp.Compute.ResourcePolicy("baz", new()
{
Name = "gce-policy",
Region = "us-central1",
GroupPlacementPolicy = new Gcp.Compute.Inputs.ResourcePolicyGroupPlacementPolicyArgs
{
VmCount = 2,
Collocation = "COLLOCATED",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.ResourcePolicy;
import com.pulumi.gcp.compute.ResourcePolicyArgs;
import com.pulumi.gcp.compute.inputs.ResourcePolicyGroupPlacementPolicyArgs;
import java.util.List;
import java.util.ArrayList;
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 baz = new ResourcePolicy("baz", ResourcePolicyArgs.builder()
.name("gce-policy")
.region("us-central1")
.groupPlacementPolicy(ResourcePolicyGroupPlacementPolicyArgs.builder()
.vmCount(2)
.collocation("COLLOCATED")
.build())
.build());
}
}
resources:
baz:
type: gcp:compute:ResourcePolicy
properties:
name: gce-policy
region: us-central1
groupPlacementPolicy:
vmCount: 2
collocation: COLLOCATED
Resource Policy Placement Policy Max Distance
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const baz = new gcp.compute.ResourcePolicy("baz", {
name: "gce-policy",
region: "us-central1",
groupPlacementPolicy: {
vmCount: 2,
collocation: "COLLOCATED",
maxDistance: 2,
},
});
import pulumi
import pulumi_gcp as gcp
baz = gcp.compute.ResourcePolicy("baz",
name="gce-policy",
region="us-central1",
group_placement_policy=gcp.compute.ResourcePolicyGroupPlacementPolicyArgs(
vm_count=2,
collocation="COLLOCATED",
max_distance=2,
))
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewResourcePolicy(ctx, "baz", &compute.ResourcePolicyArgs{
Name: pulumi.String("gce-policy"),
Region: pulumi.String("us-central1"),
GroupPlacementPolicy: &compute.ResourcePolicyGroupPlacementPolicyArgs{
VmCount: pulumi.Int(2),
Collocation: pulumi.String("COLLOCATED"),
MaxDistance: pulumi.Int(2),
},
})
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 baz = new Gcp.Compute.ResourcePolicy("baz", new()
{
Name = "gce-policy",
Region = "us-central1",
GroupPlacementPolicy = new Gcp.Compute.Inputs.ResourcePolicyGroupPlacementPolicyArgs
{
VmCount = 2,
Collocation = "COLLOCATED",
MaxDistance = 2,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.ResourcePolicy;
import com.pulumi.gcp.compute.ResourcePolicyArgs;
import com.pulumi.gcp.compute.inputs.ResourcePolicyGroupPlacementPolicyArgs;
import java.util.List;
import java.util.ArrayList;
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 baz = new ResourcePolicy("baz", ResourcePolicyArgs.builder()
.name("gce-policy")
.region("us-central1")
.groupPlacementPolicy(ResourcePolicyGroupPlacementPolicyArgs.builder()
.vmCount(2)
.collocation("COLLOCATED")
.maxDistance(2)
.build())
.build());
}
}
resources:
baz:
type: gcp:compute:ResourcePolicy
properties:
name: gce-policy
region: us-central1
groupPlacementPolicy:
vmCount: 2
collocation: COLLOCATED
maxDistance: 2
Resource Policy Instance Schedule Policy
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const hourly = new gcp.compute.ResourcePolicy("hourly", {
name: "gce-policy",
region: "us-central1",
description: "Start and stop instances",
instanceSchedulePolicy: {
vmStartSchedule: {
schedule: "0 * * * *",
},
vmStopSchedule: {
schedule: "15 * * * *",
},
timeZone: "US/Central",
},
});
import pulumi
import pulumi_gcp as gcp
hourly = gcp.compute.ResourcePolicy("hourly",
name="gce-policy",
region="us-central1",
description="Start and stop instances",
instance_schedule_policy=gcp.compute.ResourcePolicyInstanceSchedulePolicyArgs(
vm_start_schedule=gcp.compute.ResourcePolicyInstanceSchedulePolicyVmStartScheduleArgs(
schedule="0 * * * *",
),
vm_stop_schedule=gcp.compute.ResourcePolicyInstanceSchedulePolicyVmStopScheduleArgs(
schedule="15 * * * *",
),
time_zone="US/Central",
))
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewResourcePolicy(ctx, "hourly", &compute.ResourcePolicyArgs{
Name: pulumi.String("gce-policy"),
Region: pulumi.String("us-central1"),
Description: pulumi.String("Start and stop instances"),
InstanceSchedulePolicy: &compute.ResourcePolicyInstanceSchedulePolicyArgs{
VmStartSchedule: &compute.ResourcePolicyInstanceSchedulePolicyVmStartScheduleArgs{
Schedule: pulumi.String("0 * * * *"),
},
VmStopSchedule: &compute.ResourcePolicyInstanceSchedulePolicyVmStopScheduleArgs{
Schedule: pulumi.String("15 * * * *"),
},
TimeZone: pulumi.String("US/Central"),
},
})
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 hourly = new Gcp.Compute.ResourcePolicy("hourly", new()
{
Name = "gce-policy",
Region = "us-central1",
Description = "Start and stop instances",
InstanceSchedulePolicy = new Gcp.Compute.Inputs.ResourcePolicyInstanceSchedulePolicyArgs
{
VmStartSchedule = new Gcp.Compute.Inputs.ResourcePolicyInstanceSchedulePolicyVmStartScheduleArgs
{
Schedule = "0 * * * *",
},
VmStopSchedule = new Gcp.Compute.Inputs.ResourcePolicyInstanceSchedulePolicyVmStopScheduleArgs
{
Schedule = "15 * * * *",
},
TimeZone = "US/Central",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.ResourcePolicy;
import com.pulumi.gcp.compute.ResourcePolicyArgs;
import com.pulumi.gcp.compute.inputs.ResourcePolicyInstanceSchedulePolicyArgs;
import com.pulumi.gcp.compute.inputs.ResourcePolicyInstanceSchedulePolicyVmStartScheduleArgs;
import com.pulumi.gcp.compute.inputs.ResourcePolicyInstanceSchedulePolicyVmStopScheduleArgs;
import java.util.List;
import java.util.ArrayList;
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 hourly = new ResourcePolicy("hourly", ResourcePolicyArgs.builder()
.name("gce-policy")
.region("us-central1")
.description("Start and stop instances")
.instanceSchedulePolicy(ResourcePolicyInstanceSchedulePolicyArgs.builder()
.vmStartSchedule(ResourcePolicyInstanceSchedulePolicyVmStartScheduleArgs.builder()
.schedule("0 * * * *")
.build())
.vmStopSchedule(ResourcePolicyInstanceSchedulePolicyVmStopScheduleArgs.builder()
.schedule("15 * * * *")
.build())
.timeZone("US/Central")
.build())
.build());
}
}
resources:
hourly:
type: gcp:compute:ResourcePolicy
properties:
name: gce-policy
region: us-central1
description: Start and stop instances
instanceSchedulePolicy:
vmStartSchedule:
schedule: 0 * * * *
vmStopSchedule:
schedule: 15 * * * *
timeZone: US/Central
Resource Policy Snapshot Schedule Chain Name
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const hourly = new gcp.compute.ResourcePolicy("hourly", {
name: "gce-policy",
region: "us-central1",
description: "chain name snapshot",
snapshotSchedulePolicy: {
schedule: {
hourlySchedule: {
hoursInCycle: 20,
startTime: "23:00",
},
},
retentionPolicy: {
maxRetentionDays: 14,
onSourceDiskDelete: "KEEP_AUTO_SNAPSHOTS",
},
snapshotProperties: {
labels: {
my_label: "value",
},
storageLocations: "us",
guestFlush: true,
chainName: "test-schedule-chain-name",
},
},
});
import pulumi
import pulumi_gcp as gcp
hourly = gcp.compute.ResourcePolicy("hourly",
name="gce-policy",
region="us-central1",
description="chain name snapshot",
snapshot_schedule_policy=gcp.compute.ResourcePolicySnapshotSchedulePolicyArgs(
schedule=gcp.compute.ResourcePolicySnapshotSchedulePolicyScheduleArgs(
hourly_schedule=gcp.compute.ResourcePolicySnapshotSchedulePolicyScheduleHourlyScheduleArgs(
hours_in_cycle=20,
start_time="23:00",
),
),
retention_policy=gcp.compute.ResourcePolicySnapshotSchedulePolicyRetentionPolicyArgs(
max_retention_days=14,
on_source_disk_delete="KEEP_AUTO_SNAPSHOTS",
),
snapshot_properties=gcp.compute.ResourcePolicySnapshotSchedulePolicySnapshotPropertiesArgs(
labels={
"my_label": "value",
},
storage_locations="us",
guest_flush=True,
chain_name="test-schedule-chain-name",
),
))
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewResourcePolicy(ctx, "hourly", &compute.ResourcePolicyArgs{
Name: pulumi.String("gce-policy"),
Region: pulumi.String("us-central1"),
Description: pulumi.String("chain name snapshot"),
SnapshotSchedulePolicy: &compute.ResourcePolicySnapshotSchedulePolicyArgs{
Schedule: &compute.ResourcePolicySnapshotSchedulePolicyScheduleArgs{
HourlySchedule: &compute.ResourcePolicySnapshotSchedulePolicyScheduleHourlyScheduleArgs{
HoursInCycle: pulumi.Int(20),
StartTime: pulumi.String("23:00"),
},
},
RetentionPolicy: &compute.ResourcePolicySnapshotSchedulePolicyRetentionPolicyArgs{
MaxRetentionDays: pulumi.Int(14),
OnSourceDiskDelete: pulumi.String("KEEP_AUTO_SNAPSHOTS"),
},
SnapshotProperties: &compute.ResourcePolicySnapshotSchedulePolicySnapshotPropertiesArgs{
Labels: pulumi.StringMap{
"my_label": pulumi.String("value"),
},
StorageLocations: pulumi.String("us"),
GuestFlush: pulumi.Bool(true),
ChainName: pulumi.String("test-schedule-chain-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 hourly = new Gcp.Compute.ResourcePolicy("hourly", new()
{
Name = "gce-policy",
Region = "us-central1",
Description = "chain name snapshot",
SnapshotSchedulePolicy = new Gcp.Compute.Inputs.ResourcePolicySnapshotSchedulePolicyArgs
{
Schedule = new Gcp.Compute.Inputs.ResourcePolicySnapshotSchedulePolicyScheduleArgs
{
HourlySchedule = new Gcp.Compute.Inputs.ResourcePolicySnapshotSchedulePolicyScheduleHourlyScheduleArgs
{
HoursInCycle = 20,
StartTime = "23:00",
},
},
RetentionPolicy = new Gcp.Compute.Inputs.ResourcePolicySnapshotSchedulePolicyRetentionPolicyArgs
{
MaxRetentionDays = 14,
OnSourceDiskDelete = "KEEP_AUTO_SNAPSHOTS",
},
SnapshotProperties = new Gcp.Compute.Inputs.ResourcePolicySnapshotSchedulePolicySnapshotPropertiesArgs
{
Labels =
{
{ "my_label", "value" },
},
StorageLocations = "us",
GuestFlush = true,
ChainName = "test-schedule-chain-name",
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.ResourcePolicy;
import com.pulumi.gcp.compute.ResourcePolicyArgs;
import com.pulumi.gcp.compute.inputs.ResourcePolicySnapshotSchedulePolicyArgs;
import com.pulumi.gcp.compute.inputs.ResourcePolicySnapshotSchedulePolicyScheduleArgs;
import com.pulumi.gcp.compute.inputs.ResourcePolicySnapshotSchedulePolicyScheduleHourlyScheduleArgs;
import com.pulumi.gcp.compute.inputs.ResourcePolicySnapshotSchedulePolicyRetentionPolicyArgs;
import com.pulumi.gcp.compute.inputs.ResourcePolicySnapshotSchedulePolicySnapshotPropertiesArgs;
import java.util.List;
import java.util.ArrayList;
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 hourly = new ResourcePolicy("hourly", ResourcePolicyArgs.builder()
.name("gce-policy")
.region("us-central1")
.description("chain name snapshot")
.snapshotSchedulePolicy(ResourcePolicySnapshotSchedulePolicyArgs.builder()
.schedule(ResourcePolicySnapshotSchedulePolicyScheduleArgs.builder()
.hourlySchedule(ResourcePolicySnapshotSchedulePolicyScheduleHourlyScheduleArgs.builder()
.hoursInCycle(20)
.startTime("23:00")
.build())
.build())
.retentionPolicy(ResourcePolicySnapshotSchedulePolicyRetentionPolicyArgs.builder()
.maxRetentionDays(14)
.onSourceDiskDelete("KEEP_AUTO_SNAPSHOTS")
.build())
.snapshotProperties(ResourcePolicySnapshotSchedulePolicySnapshotPropertiesArgs.builder()
.labels(Map.of("my_label", "value"))
.storageLocations("us")
.guestFlush(true)
.chainName("test-schedule-chain-name")
.build())
.build())
.build());
}
}
resources:
hourly:
type: gcp:compute:ResourcePolicy
properties:
name: gce-policy
region: us-central1
description: chain name snapshot
snapshotSchedulePolicy:
schedule:
hourlySchedule:
hoursInCycle: 20
startTime: 23:00
retentionPolicy:
maxRetentionDays: 14
onSourceDiskDelete: KEEP_AUTO_SNAPSHOTS
snapshotProperties:
labels:
my_label: value
storageLocations: us
guestFlush: true
chainName: test-schedule-chain-name
Resource Policy Consistency Group
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const cgroup = new gcp.compute.ResourcePolicy("cgroup", {
name: "gce-policy",
region: "europe-west1",
diskConsistencyGroupPolicy: {
enabled: true,
},
});
import pulumi
import pulumi_gcp as gcp
cgroup = gcp.compute.ResourcePolicy("cgroup",
name="gce-policy",
region="europe-west1",
disk_consistency_group_policy=gcp.compute.ResourcePolicyDiskConsistencyGroupPolicyArgs(
enabled=True,
))
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewResourcePolicy(ctx, "cgroup", &compute.ResourcePolicyArgs{
Name: pulumi.String("gce-policy"),
Region: pulumi.String("europe-west1"),
DiskConsistencyGroupPolicy: &compute.ResourcePolicyDiskConsistencyGroupPolicyArgs{
Enabled: pulumi.Bool(true),
},
})
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 cgroup = new Gcp.Compute.ResourcePolicy("cgroup", new()
{
Name = "gce-policy",
Region = "europe-west1",
DiskConsistencyGroupPolicy = new Gcp.Compute.Inputs.ResourcePolicyDiskConsistencyGroupPolicyArgs
{
Enabled = true,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.ResourcePolicy;
import com.pulumi.gcp.compute.ResourcePolicyArgs;
import com.pulumi.gcp.compute.inputs.ResourcePolicyDiskConsistencyGroupPolicyArgs;
import java.util.List;
import java.util.ArrayList;
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 cgroup = new ResourcePolicy("cgroup", ResourcePolicyArgs.builder()
.name("gce-policy")
.region("europe-west1")
.diskConsistencyGroupPolicy(ResourcePolicyDiskConsistencyGroupPolicyArgs.builder()
.enabled(true)
.build())
.build());
}
}
resources:
cgroup:
type: gcp:compute:ResourcePolicy
properties:
name: gce-policy
region: europe-west1
diskConsistencyGroupPolicy:
enabled: true
Create ResourcePolicy Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ResourcePolicy(name: string, args?: ResourcePolicyArgs, opts?: CustomResourceOptions);
@overload
def ResourcePolicy(resource_name: str,
args: Optional[ResourcePolicyArgs] = None,
opts: Optional[ResourceOptions] = None)
@overload
def ResourcePolicy(resource_name: str,
opts: Optional[ResourceOptions] = None,
description: Optional[str] = None,
disk_consistency_group_policy: Optional[ResourcePolicyDiskConsistencyGroupPolicyArgs] = None,
group_placement_policy: Optional[ResourcePolicyGroupPlacementPolicyArgs] = None,
instance_schedule_policy: Optional[ResourcePolicyInstanceSchedulePolicyArgs] = None,
name: Optional[str] = None,
project: Optional[str] = None,
region: Optional[str] = None,
snapshot_schedule_policy: Optional[ResourcePolicySnapshotSchedulePolicyArgs] = None)
func NewResourcePolicy(ctx *Context, name string, args *ResourcePolicyArgs, opts ...ResourceOption) (*ResourcePolicy, error)
public ResourcePolicy(string name, ResourcePolicyArgs? args = null, CustomResourceOptions? opts = null)
public ResourcePolicy(String name, ResourcePolicyArgs args)
public ResourcePolicy(String name, ResourcePolicyArgs args, CustomResourceOptions options)
type: gcp:compute:ResourcePolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args ResourcePolicyArgs
- 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 ResourcePolicyArgs
- 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 ResourcePolicyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ResourcePolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ResourcePolicyArgs
- 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 resourcePolicyResource = new Gcp.Compute.ResourcePolicy("resourcePolicyResource", new()
{
Description = "string",
DiskConsistencyGroupPolicy = new Gcp.Compute.Inputs.ResourcePolicyDiskConsistencyGroupPolicyArgs
{
Enabled = false,
},
GroupPlacementPolicy = new Gcp.Compute.Inputs.ResourcePolicyGroupPlacementPolicyArgs
{
AvailabilityDomainCount = 0,
Collocation = "string",
MaxDistance = 0,
VmCount = 0,
},
InstanceSchedulePolicy = new Gcp.Compute.Inputs.ResourcePolicyInstanceSchedulePolicyArgs
{
TimeZone = "string",
ExpirationTime = "string",
StartTime = "string",
VmStartSchedule = new Gcp.Compute.Inputs.ResourcePolicyInstanceSchedulePolicyVmStartScheduleArgs
{
Schedule = "string",
},
VmStopSchedule = new Gcp.Compute.Inputs.ResourcePolicyInstanceSchedulePolicyVmStopScheduleArgs
{
Schedule = "string",
},
},
Name = "string",
Project = "string",
Region = "string",
SnapshotSchedulePolicy = new Gcp.Compute.Inputs.ResourcePolicySnapshotSchedulePolicyArgs
{
Schedule = new Gcp.Compute.Inputs.ResourcePolicySnapshotSchedulePolicyScheduleArgs
{
DailySchedule = new Gcp.Compute.Inputs.ResourcePolicySnapshotSchedulePolicyScheduleDailyScheduleArgs
{
DaysInCycle = 0,
StartTime = "string",
},
HourlySchedule = new Gcp.Compute.Inputs.ResourcePolicySnapshotSchedulePolicyScheduleHourlyScheduleArgs
{
HoursInCycle = 0,
StartTime = "string",
},
WeeklySchedule = new Gcp.Compute.Inputs.ResourcePolicySnapshotSchedulePolicyScheduleWeeklyScheduleArgs
{
DayOfWeeks = new[]
{
new Gcp.Compute.Inputs.ResourcePolicySnapshotSchedulePolicyScheduleWeeklyScheduleDayOfWeekArgs
{
Day = "string",
StartTime = "string",
},
},
},
},
RetentionPolicy = new Gcp.Compute.Inputs.ResourcePolicySnapshotSchedulePolicyRetentionPolicyArgs
{
MaxRetentionDays = 0,
OnSourceDiskDelete = "string",
},
SnapshotProperties = new Gcp.Compute.Inputs.ResourcePolicySnapshotSchedulePolicySnapshotPropertiesArgs
{
ChainName = "string",
GuestFlush = false,
Labels =
{
{ "string", "string" },
},
StorageLocations = "string",
},
},
});
example, err := compute.NewResourcePolicy(ctx, "resourcePolicyResource", &compute.ResourcePolicyArgs{
Description: pulumi.String("string"),
DiskConsistencyGroupPolicy: &compute.ResourcePolicyDiskConsistencyGroupPolicyArgs{
Enabled: pulumi.Bool(false),
},
GroupPlacementPolicy: &compute.ResourcePolicyGroupPlacementPolicyArgs{
AvailabilityDomainCount: pulumi.Int(0),
Collocation: pulumi.String("string"),
MaxDistance: pulumi.Int(0),
VmCount: pulumi.Int(0),
},
InstanceSchedulePolicy: &compute.ResourcePolicyInstanceSchedulePolicyArgs{
TimeZone: pulumi.String("string"),
ExpirationTime: pulumi.String("string"),
StartTime: pulumi.String("string"),
VmStartSchedule: &compute.ResourcePolicyInstanceSchedulePolicyVmStartScheduleArgs{
Schedule: pulumi.String("string"),
},
VmStopSchedule: &compute.ResourcePolicyInstanceSchedulePolicyVmStopScheduleArgs{
Schedule: pulumi.String("string"),
},
},
Name: pulumi.String("string"),
Project: pulumi.String("string"),
Region: pulumi.String("string"),
SnapshotSchedulePolicy: &compute.ResourcePolicySnapshotSchedulePolicyArgs{
Schedule: &compute.ResourcePolicySnapshotSchedulePolicyScheduleArgs{
DailySchedule: &compute.ResourcePolicySnapshotSchedulePolicyScheduleDailyScheduleArgs{
DaysInCycle: pulumi.Int(0),
StartTime: pulumi.String("string"),
},
HourlySchedule: &compute.ResourcePolicySnapshotSchedulePolicyScheduleHourlyScheduleArgs{
HoursInCycle: pulumi.Int(0),
StartTime: pulumi.String("string"),
},
WeeklySchedule: &compute.ResourcePolicySnapshotSchedulePolicyScheduleWeeklyScheduleArgs{
DayOfWeeks: compute.ResourcePolicySnapshotSchedulePolicyScheduleWeeklyScheduleDayOfWeekArray{
&compute.ResourcePolicySnapshotSchedulePolicyScheduleWeeklyScheduleDayOfWeekArgs{
Day: pulumi.String("string"),
StartTime: pulumi.String("string"),
},
},
},
},
RetentionPolicy: &compute.ResourcePolicySnapshotSchedulePolicyRetentionPolicyArgs{
MaxRetentionDays: pulumi.Int(0),
OnSourceDiskDelete: pulumi.String("string"),
},
SnapshotProperties: &compute.ResourcePolicySnapshotSchedulePolicySnapshotPropertiesArgs{
ChainName: pulumi.String("string"),
GuestFlush: pulumi.Bool(false),
Labels: pulumi.StringMap{
"string": pulumi.String("string"),
},
StorageLocations: pulumi.String("string"),
},
},
})
var resourcePolicyResource = new ResourcePolicy("resourcePolicyResource", ResourcePolicyArgs.builder()
.description("string")
.diskConsistencyGroupPolicy(ResourcePolicyDiskConsistencyGroupPolicyArgs.builder()
.enabled(false)
.build())
.groupPlacementPolicy(ResourcePolicyGroupPlacementPolicyArgs.builder()
.availabilityDomainCount(0)
.collocation("string")
.maxDistance(0)
.vmCount(0)
.build())
.instanceSchedulePolicy(ResourcePolicyInstanceSchedulePolicyArgs.builder()
.timeZone("string")
.expirationTime("string")
.startTime("string")
.vmStartSchedule(ResourcePolicyInstanceSchedulePolicyVmStartScheduleArgs.builder()
.schedule("string")
.build())
.vmStopSchedule(ResourcePolicyInstanceSchedulePolicyVmStopScheduleArgs.builder()
.schedule("string")
.build())
.build())
.name("string")
.project("string")
.region("string")
.snapshotSchedulePolicy(ResourcePolicySnapshotSchedulePolicyArgs.builder()
.schedule(ResourcePolicySnapshotSchedulePolicyScheduleArgs.builder()
.dailySchedule(ResourcePolicySnapshotSchedulePolicyScheduleDailyScheduleArgs.builder()
.daysInCycle(0)
.startTime("string")
.build())
.hourlySchedule(ResourcePolicySnapshotSchedulePolicyScheduleHourlyScheduleArgs.builder()
.hoursInCycle(0)
.startTime("string")
.build())
.weeklySchedule(ResourcePolicySnapshotSchedulePolicyScheduleWeeklyScheduleArgs.builder()
.dayOfWeeks(ResourcePolicySnapshotSchedulePolicyScheduleWeeklyScheduleDayOfWeekArgs.builder()
.day("string")
.startTime("string")
.build())
.build())
.build())
.retentionPolicy(ResourcePolicySnapshotSchedulePolicyRetentionPolicyArgs.builder()
.maxRetentionDays(0)
.onSourceDiskDelete("string")
.build())
.snapshotProperties(ResourcePolicySnapshotSchedulePolicySnapshotPropertiesArgs.builder()
.chainName("string")
.guestFlush(false)
.labels(Map.of("string", "string"))
.storageLocations("string")
.build())
.build())
.build());
resource_policy_resource = gcp.compute.ResourcePolicy("resourcePolicyResource",
description="string",
disk_consistency_group_policy=gcp.compute.ResourcePolicyDiskConsistencyGroupPolicyArgs(
enabled=False,
),
group_placement_policy=gcp.compute.ResourcePolicyGroupPlacementPolicyArgs(
availability_domain_count=0,
collocation="string",
max_distance=0,
vm_count=0,
),
instance_schedule_policy=gcp.compute.ResourcePolicyInstanceSchedulePolicyArgs(
time_zone="string",
expiration_time="string",
start_time="string",
vm_start_schedule=gcp.compute.ResourcePolicyInstanceSchedulePolicyVmStartScheduleArgs(
schedule="string",
),
vm_stop_schedule=gcp.compute.ResourcePolicyInstanceSchedulePolicyVmStopScheduleArgs(
schedule="string",
),
),
name="string",
project="string",
region="string",
snapshot_schedule_policy=gcp.compute.ResourcePolicySnapshotSchedulePolicyArgs(
schedule=gcp.compute.ResourcePolicySnapshotSchedulePolicyScheduleArgs(
daily_schedule=gcp.compute.ResourcePolicySnapshotSchedulePolicyScheduleDailyScheduleArgs(
days_in_cycle=0,
start_time="string",
),
hourly_schedule=gcp.compute.ResourcePolicySnapshotSchedulePolicyScheduleHourlyScheduleArgs(
hours_in_cycle=0,
start_time="string",
),
weekly_schedule=gcp.compute.ResourcePolicySnapshotSchedulePolicyScheduleWeeklyScheduleArgs(
day_of_weeks=[gcp.compute.ResourcePolicySnapshotSchedulePolicyScheduleWeeklyScheduleDayOfWeekArgs(
day="string",
start_time="string",
)],
),
),
retention_policy=gcp.compute.ResourcePolicySnapshotSchedulePolicyRetentionPolicyArgs(
max_retention_days=0,
on_source_disk_delete="string",
),
snapshot_properties=gcp.compute.ResourcePolicySnapshotSchedulePolicySnapshotPropertiesArgs(
chain_name="string",
guest_flush=False,
labels={
"string": "string",
},
storage_locations="string",
),
))
const resourcePolicyResource = new gcp.compute.ResourcePolicy("resourcePolicyResource", {
description: "string",
diskConsistencyGroupPolicy: {
enabled: false,
},
groupPlacementPolicy: {
availabilityDomainCount: 0,
collocation: "string",
maxDistance: 0,
vmCount: 0,
},
instanceSchedulePolicy: {
timeZone: "string",
expirationTime: "string",
startTime: "string",
vmStartSchedule: {
schedule: "string",
},
vmStopSchedule: {
schedule: "string",
},
},
name: "string",
project: "string",
region: "string",
snapshotSchedulePolicy: {
schedule: {
dailySchedule: {
daysInCycle: 0,
startTime: "string",
},
hourlySchedule: {
hoursInCycle: 0,
startTime: "string",
},
weeklySchedule: {
dayOfWeeks: [{
day: "string",
startTime: "string",
}],
},
},
retentionPolicy: {
maxRetentionDays: 0,
onSourceDiskDelete: "string",
},
snapshotProperties: {
chainName: "string",
guestFlush: false,
labels: {
string: "string",
},
storageLocations: "string",
},
},
});
type: gcp:compute:ResourcePolicy
properties:
description: string
diskConsistencyGroupPolicy:
enabled: false
groupPlacementPolicy:
availabilityDomainCount: 0
collocation: string
maxDistance: 0
vmCount: 0
instanceSchedulePolicy:
expirationTime: string
startTime: string
timeZone: string
vmStartSchedule:
schedule: string
vmStopSchedule:
schedule: string
name: string
project: string
region: string
snapshotSchedulePolicy:
retentionPolicy:
maxRetentionDays: 0
onSourceDiskDelete: string
schedule:
dailySchedule:
daysInCycle: 0
startTime: string
hourlySchedule:
hoursInCycle: 0
startTime: string
weeklySchedule:
dayOfWeeks:
- day: string
startTime: string
snapshotProperties:
chainName: string
guestFlush: false
labels:
string: string
storageLocations: string
ResourcePolicy Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The ResourcePolicy resource accepts the following input properties:
- Description string
- An optional description of this resource. Provide this property when you create the resource.
- Disk
Consistency ResourceGroup Policy Policy Disk Consistency Group Policy - Replication consistency group for asynchronous disk replication. Structure is documented below.
- Group
Placement ResourcePolicy Policy Group Placement Policy - Resource policy for instances used for placement configuration. Structure is documented below.
- Instance
Schedule ResourcePolicy Policy Instance Schedule Policy - Resource policy for scheduling instance operations. Structure is documented below.
- Name string
- The name of the resource, provided by the client when initially creating
the resource. The resource name must be 1-63 characters long, and comply
with RFC1035. Specifically, the name must be 1-63 characters long and
match the regular expression
a-z
? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Region string
- Region where resource policy resides.
- Snapshot
Schedule ResourcePolicy Policy Snapshot Schedule Policy - Policy for creating snapshots of persistent disks. Structure is documented below.
- Description string
- An optional description of this resource. Provide this property when you create the resource.
- Disk
Consistency ResourceGroup Policy Policy Disk Consistency Group Policy Args - Replication consistency group for asynchronous disk replication. Structure is documented below.
- Group
Placement ResourcePolicy Policy Group Placement Policy Args - Resource policy for instances used for placement configuration. Structure is documented below.
- Instance
Schedule ResourcePolicy Policy Instance Schedule Policy Args - Resource policy for scheduling instance operations. Structure is documented below.
- Name string
- The name of the resource, provided by the client when initially creating
the resource. The resource name must be 1-63 characters long, and comply
with RFC1035. Specifically, the name must be 1-63 characters long and
match the regular expression
a-z
? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Region string
- Region where resource policy resides.
- Snapshot
Schedule ResourcePolicy Policy Snapshot Schedule Policy Args - Policy for creating snapshots of persistent disks. Structure is documented below.
- description String
- An optional description of this resource. Provide this property when you create the resource.
- disk
Consistency ResourceGroup Policy Policy Disk Consistency Group Policy - Replication consistency group for asynchronous disk replication. Structure is documented below.
- group
Placement ResourcePolicy Policy Group Placement Policy - Resource policy for instances used for placement configuration. Structure is documented below.
- instance
Schedule ResourcePolicy Policy Instance Schedule Policy - Resource policy for scheduling instance operations. Structure is documented below.
- name String
- The name of the resource, provided by the client when initially creating
the resource. The resource name must be 1-63 characters long, and comply
with RFC1035. Specifically, the name must be 1-63 characters long and
match the regular expression
a-z
? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- region String
- Region where resource policy resides.
- snapshot
Schedule ResourcePolicy Policy Snapshot Schedule Policy - Policy for creating snapshots of persistent disks. Structure is documented below.
- description string
- An optional description of this resource. Provide this property when you create the resource.
- disk
Consistency ResourceGroup Policy Policy Disk Consistency Group Policy - Replication consistency group for asynchronous disk replication. Structure is documented below.
- group
Placement ResourcePolicy Policy Group Placement Policy - Resource policy for instances used for placement configuration. Structure is documented below.
- instance
Schedule ResourcePolicy Policy Instance Schedule Policy - Resource policy for scheduling instance operations. Structure is documented below.
- name string
- The name of the resource, provided by the client when initially creating
the resource. The resource name must be 1-63 characters long, and comply
with RFC1035. Specifically, the name must be 1-63 characters long and
match the regular expression
a-z
? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- region string
- Region where resource policy resides.
- snapshot
Schedule ResourcePolicy Policy Snapshot Schedule Policy - Policy for creating snapshots of persistent disks. Structure is documented below.
- description str
- An optional description of this resource. Provide this property when you create the resource.
- disk_
consistency_ Resourcegroup_ policy Policy Disk Consistency Group Policy Args - Replication consistency group for asynchronous disk replication. Structure is documented below.
- group_
placement_ Resourcepolicy Policy Group Placement Policy Args - Resource policy for instances used for placement configuration. Structure is documented below.
- instance_
schedule_ Resourcepolicy Policy Instance Schedule Policy Args - Resource policy for scheduling instance operations. Structure is documented below.
- name str
- The name of the resource, provided by the client when initially creating
the resource. The resource name must be 1-63 characters long, and comply
with RFC1035. Specifically, the name must be 1-63 characters long and
match the regular expression
a-z
? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - project str
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- region str
- Region where resource policy resides.
- snapshot_
schedule_ Resourcepolicy Policy Snapshot Schedule Policy Args - Policy for creating snapshots of persistent disks. Structure is documented below.
- description String
- An optional description of this resource. Provide this property when you create the resource.
- disk
Consistency Property MapGroup Policy - Replication consistency group for asynchronous disk replication. Structure is documented below.
- group
Placement Property MapPolicy - Resource policy for instances used for placement configuration. Structure is documented below.
- instance
Schedule Property MapPolicy - Resource policy for scheduling instance operations. Structure is documented below.
- name String
- The name of the resource, provided by the client when initially creating
the resource. The resource name must be 1-63 characters long, and comply
with RFC1035. Specifically, the name must be 1-63 characters long and
match the regular expression
a-z
? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- region String
- Region where resource policy resides.
- snapshot
Schedule Property MapPolicy - Policy for creating snapshots of persistent disks. Structure is documented below.
Outputs
All input properties are implicitly available as output properties. Additionally, the ResourcePolicy resource produces the following output properties:
Look up Existing ResourcePolicy Resource
Get an existing ResourcePolicy 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?: ResourcePolicyState, opts?: CustomResourceOptions): ResourcePolicy
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
description: Optional[str] = None,
disk_consistency_group_policy: Optional[ResourcePolicyDiskConsistencyGroupPolicyArgs] = None,
group_placement_policy: Optional[ResourcePolicyGroupPlacementPolicyArgs] = None,
instance_schedule_policy: Optional[ResourcePolicyInstanceSchedulePolicyArgs] = None,
name: Optional[str] = None,
project: Optional[str] = None,
region: Optional[str] = None,
self_link: Optional[str] = None,
snapshot_schedule_policy: Optional[ResourcePolicySnapshotSchedulePolicyArgs] = None) -> ResourcePolicy
func GetResourcePolicy(ctx *Context, name string, id IDInput, state *ResourcePolicyState, opts ...ResourceOption) (*ResourcePolicy, error)
public static ResourcePolicy Get(string name, Input<string> id, ResourcePolicyState? state, CustomResourceOptions? opts = null)
public static ResourcePolicy get(String name, Output<String> id, ResourcePolicyState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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.
- Description string
- An optional description of this resource. Provide this property when you create the resource.
- Disk
Consistency ResourceGroup Policy Policy Disk Consistency Group Policy - Replication consistency group for asynchronous disk replication. Structure is documented below.
- Group
Placement ResourcePolicy Policy Group Placement Policy - Resource policy for instances used for placement configuration. Structure is documented below.
- Instance
Schedule ResourcePolicy Policy Instance Schedule Policy - Resource policy for scheduling instance operations. Structure is documented below.
- Name string
- The name of the resource, provided by the client when initially creating
the resource. The resource name must be 1-63 characters long, and comply
with RFC1035. Specifically, the name must be 1-63 characters long and
match the regular expression
a-z
? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Region string
- Region where resource policy resides.
- Self
Link string - The URI of the created resource.
- Snapshot
Schedule ResourcePolicy Policy Snapshot Schedule Policy - Policy for creating snapshots of persistent disks. Structure is documented below.
- Description string
- An optional description of this resource. Provide this property when you create the resource.
- Disk
Consistency ResourceGroup Policy Policy Disk Consistency Group Policy Args - Replication consistency group for asynchronous disk replication. Structure is documented below.
- Group
Placement ResourcePolicy Policy Group Placement Policy Args - Resource policy for instances used for placement configuration. Structure is documented below.
- Instance
Schedule ResourcePolicy Policy Instance Schedule Policy Args - Resource policy for scheduling instance operations. Structure is documented below.
- Name string
- The name of the resource, provided by the client when initially creating
the resource. The resource name must be 1-63 characters long, and comply
with RFC1035. Specifically, the name must be 1-63 characters long and
match the regular expression
a-z
? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Region string
- Region where resource policy resides.
- Self
Link string - The URI of the created resource.
- Snapshot
Schedule ResourcePolicy Policy Snapshot Schedule Policy Args - Policy for creating snapshots of persistent disks. Structure is documented below.
- description String
- An optional description of this resource. Provide this property when you create the resource.
- disk
Consistency ResourceGroup Policy Policy Disk Consistency Group Policy - Replication consistency group for asynchronous disk replication. Structure is documented below.
- group
Placement ResourcePolicy Policy Group Placement Policy - Resource policy for instances used for placement configuration. Structure is documented below.
- instance
Schedule ResourcePolicy Policy Instance Schedule Policy - Resource policy for scheduling instance operations. Structure is documented below.
- name String
- The name of the resource, provided by the client when initially creating
the resource. The resource name must be 1-63 characters long, and comply
with RFC1035. Specifically, the name must be 1-63 characters long and
match the regular expression
a-z
? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- region String
- Region where resource policy resides.
- self
Link String - The URI of the created resource.
- snapshot
Schedule ResourcePolicy Policy Snapshot Schedule Policy - Policy for creating snapshots of persistent disks. Structure is documented below.
- description string
- An optional description of this resource. Provide this property when you create the resource.
- disk
Consistency ResourceGroup Policy Policy Disk Consistency Group Policy - Replication consistency group for asynchronous disk replication. Structure is documented below.
- group
Placement ResourcePolicy Policy Group Placement Policy - Resource policy for instances used for placement configuration. Structure is documented below.
- instance
Schedule ResourcePolicy Policy Instance Schedule Policy - Resource policy for scheduling instance operations. Structure is documented below.
- name string
- The name of the resource, provided by the client when initially creating
the resource. The resource name must be 1-63 characters long, and comply
with RFC1035. Specifically, the name must be 1-63 characters long and
match the regular expression
a-z
? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- region string
- Region where resource policy resides.
- self
Link string - The URI of the created resource.
- snapshot
Schedule ResourcePolicy Policy Snapshot Schedule Policy - Policy for creating snapshots of persistent disks. Structure is documented below.
- description str
- An optional description of this resource. Provide this property when you create the resource.
- disk_
consistency_ Resourcegroup_ policy Policy Disk Consistency Group Policy Args - Replication consistency group for asynchronous disk replication. Structure is documented below.
- group_
placement_ Resourcepolicy Policy Group Placement Policy Args - Resource policy for instances used for placement configuration. Structure is documented below.
- instance_
schedule_ Resourcepolicy Policy Instance Schedule Policy Args - Resource policy for scheduling instance operations. Structure is documented below.
- name str
- The name of the resource, provided by the client when initially creating
the resource. The resource name must be 1-63 characters long, and comply
with RFC1035. Specifically, the name must be 1-63 characters long and
match the regular expression
a-z
? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - project str
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- region str
- Region where resource policy resides.
- self_
link str - The URI of the created resource.
- snapshot_
schedule_ Resourcepolicy Policy Snapshot Schedule Policy Args - Policy for creating snapshots of persistent disks. Structure is documented below.
- description String
- An optional description of this resource. Provide this property when you create the resource.
- disk
Consistency Property MapGroup Policy - Replication consistency group for asynchronous disk replication. Structure is documented below.
- group
Placement Property MapPolicy - Resource policy for instances used for placement configuration. Structure is documented below.
- instance
Schedule Property MapPolicy - Resource policy for scheduling instance operations. Structure is documented below.
- name String
- The name of the resource, provided by the client when initially creating
the resource. The resource name must be 1-63 characters long, and comply
with RFC1035. Specifically, the name must be 1-63 characters long and
match the regular expression
a-z
? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- region String
- Region where resource policy resides.
- self
Link String - The URI of the created resource.
- snapshot
Schedule Property MapPolicy - Policy for creating snapshots of persistent disks. Structure is documented below.
Supporting Types
ResourcePolicyDiskConsistencyGroupPolicy, ResourcePolicyDiskConsistencyGroupPolicyArgs
- Enabled bool
- Enable disk consistency on the resource policy.
- Enabled bool
- Enable disk consistency on the resource policy.
- enabled Boolean
- Enable disk consistency on the resource policy.
- enabled boolean
- Enable disk consistency on the resource policy.
- enabled bool
- Enable disk consistency on the resource policy.
- enabled Boolean
- Enable disk consistency on the resource policy.
ResourcePolicyGroupPlacementPolicy, ResourcePolicyGroupPlacementPolicyArgs
- Availability
Domain intCount - The number of availability domains instances will be spread across. If two instances are in different availability domain, they will not be put in the same low latency network
- Collocation string
- Collocation specifies whether to place VMs inside the same availability domain on the same low-latency network.
Specify
COLLOCATED
to enable collocation. Can only be specified withvm_count
. If compute instances are created with a COLLOCATED policy, then exactlyvm_count
instances must be created at the same time with the resource policy attached. Possible values are:COLLOCATED
. - Max
Distance int - Specifies the number of max logical switches.
- Vm
Count int - Number of VMs in this placement group. Google does not recommend that you use this field unless you use a compact policy and you want your policy to work only if it contains this exact number of VMs.
- Availability
Domain intCount - The number of availability domains instances will be spread across. If two instances are in different availability domain, they will not be put in the same low latency network
- Collocation string
- Collocation specifies whether to place VMs inside the same availability domain on the same low-latency network.
Specify
COLLOCATED
to enable collocation. Can only be specified withvm_count
. If compute instances are created with a COLLOCATED policy, then exactlyvm_count
instances must be created at the same time with the resource policy attached. Possible values are:COLLOCATED
. - Max
Distance int - Specifies the number of max logical switches.
- Vm
Count int - Number of VMs in this placement group. Google does not recommend that you use this field unless you use a compact policy and you want your policy to work only if it contains this exact number of VMs.
- availability
Domain IntegerCount - The number of availability domains instances will be spread across. If two instances are in different availability domain, they will not be put in the same low latency network
- collocation String
- Collocation specifies whether to place VMs inside the same availability domain on the same low-latency network.
Specify
COLLOCATED
to enable collocation. Can only be specified withvm_count
. If compute instances are created with a COLLOCATED policy, then exactlyvm_count
instances must be created at the same time with the resource policy attached. Possible values are:COLLOCATED
. - max
Distance Integer - Specifies the number of max logical switches.
- vm
Count Integer - Number of VMs in this placement group. Google does not recommend that you use this field unless you use a compact policy and you want your policy to work only if it contains this exact number of VMs.
- availability
Domain numberCount - The number of availability domains instances will be spread across. If two instances are in different availability domain, they will not be put in the same low latency network
- collocation string
- Collocation specifies whether to place VMs inside the same availability domain on the same low-latency network.
Specify
COLLOCATED
to enable collocation. Can only be specified withvm_count
. If compute instances are created with a COLLOCATED policy, then exactlyvm_count
instances must be created at the same time with the resource policy attached. Possible values are:COLLOCATED
. - max
Distance number - Specifies the number of max logical switches.
- vm
Count number - Number of VMs in this placement group. Google does not recommend that you use this field unless you use a compact policy and you want your policy to work only if it contains this exact number of VMs.
- availability_
domain_ intcount - The number of availability domains instances will be spread across. If two instances are in different availability domain, they will not be put in the same low latency network
- collocation str
- Collocation specifies whether to place VMs inside the same availability domain on the same low-latency network.
Specify
COLLOCATED
to enable collocation. Can only be specified withvm_count
. If compute instances are created with a COLLOCATED policy, then exactlyvm_count
instances must be created at the same time with the resource policy attached. Possible values are:COLLOCATED
. - max_
distance int - Specifies the number of max logical switches.
- vm_
count int - Number of VMs in this placement group. Google does not recommend that you use this field unless you use a compact policy and you want your policy to work only if it contains this exact number of VMs.
- availability
Domain NumberCount - The number of availability domains instances will be spread across. If two instances are in different availability domain, they will not be put in the same low latency network
- collocation String
- Collocation specifies whether to place VMs inside the same availability domain on the same low-latency network.
Specify
COLLOCATED
to enable collocation. Can only be specified withvm_count
. If compute instances are created with a COLLOCATED policy, then exactlyvm_count
instances must be created at the same time with the resource policy attached. Possible values are:COLLOCATED
. - max
Distance Number - Specifies the number of max logical switches.
- vm
Count Number - Number of VMs in this placement group. Google does not recommend that you use this field unless you use a compact policy and you want your policy to work only if it contains this exact number of VMs.
ResourcePolicyInstanceSchedulePolicy, ResourcePolicyInstanceSchedulePolicyArgs
- Time
Zone string - Specifies the time zone to be used in interpreting the schedule. The value of this field must be a time zone name from the tz database: http://en.wikipedia.org/wiki/Tz_database.
- Expiration
Time string - The expiration time of the schedule. The timestamp is an RFC3339 string.
- Start
Time string - The start time of the schedule. The timestamp is an RFC3339 string.
- Vm
Start ResourceSchedule Policy Instance Schedule Policy Vm Start Schedule - Specifies the schedule for starting instances. Structure is documented below.
- Vm
Stop ResourceSchedule Policy Instance Schedule Policy Vm Stop Schedule - Specifies the schedule for stopping instances. Structure is documented below.
- Time
Zone string - Specifies the time zone to be used in interpreting the schedule. The value of this field must be a time zone name from the tz database: http://en.wikipedia.org/wiki/Tz_database.
- Expiration
Time string - The expiration time of the schedule. The timestamp is an RFC3339 string.
- Start
Time string - The start time of the schedule. The timestamp is an RFC3339 string.
- Vm
Start ResourceSchedule Policy Instance Schedule Policy Vm Start Schedule - Specifies the schedule for starting instances. Structure is documented below.
- Vm
Stop ResourceSchedule Policy Instance Schedule Policy Vm Stop Schedule - Specifies the schedule for stopping instances. Structure is documented below.
- time
Zone String - Specifies the time zone to be used in interpreting the schedule. The value of this field must be a time zone name from the tz database: http://en.wikipedia.org/wiki/Tz_database.
- expiration
Time String - The expiration time of the schedule. The timestamp is an RFC3339 string.
- start
Time String - The start time of the schedule. The timestamp is an RFC3339 string.
- vm
Start ResourceSchedule Policy Instance Schedule Policy Vm Start Schedule - Specifies the schedule for starting instances. Structure is documented below.
- vm
Stop ResourceSchedule Policy Instance Schedule Policy Vm Stop Schedule - Specifies the schedule for stopping instances. Structure is documented below.
- time
Zone string - Specifies the time zone to be used in interpreting the schedule. The value of this field must be a time zone name from the tz database: http://en.wikipedia.org/wiki/Tz_database.
- expiration
Time string - The expiration time of the schedule. The timestamp is an RFC3339 string.
- start
Time string - The start time of the schedule. The timestamp is an RFC3339 string.
- vm
Start ResourceSchedule Policy Instance Schedule Policy Vm Start Schedule - Specifies the schedule for starting instances. Structure is documented below.
- vm
Stop ResourceSchedule Policy Instance Schedule Policy Vm Stop Schedule - Specifies the schedule for stopping instances. Structure is documented below.
- time_
zone str - Specifies the time zone to be used in interpreting the schedule. The value of this field must be a time zone name from the tz database: http://en.wikipedia.org/wiki/Tz_database.
- expiration_
time str - The expiration time of the schedule. The timestamp is an RFC3339 string.
- start_
time str - The start time of the schedule. The timestamp is an RFC3339 string.
- vm_
start_ Resourceschedule Policy Instance Schedule Policy Vm Start Schedule - Specifies the schedule for starting instances. Structure is documented below.
- vm_
stop_ Resourceschedule Policy Instance Schedule Policy Vm Stop Schedule - Specifies the schedule for stopping instances. Structure is documented below.
- time
Zone String - Specifies the time zone to be used in interpreting the schedule. The value of this field must be a time zone name from the tz database: http://en.wikipedia.org/wiki/Tz_database.
- expiration
Time String - The expiration time of the schedule. The timestamp is an RFC3339 string.
- start
Time String - The start time of the schedule. The timestamp is an RFC3339 string.
- vm
Start Property MapSchedule - Specifies the schedule for starting instances. Structure is documented below.
- vm
Stop Property MapSchedule - Specifies the schedule for stopping instances. Structure is documented below.
ResourcePolicyInstanceSchedulePolicyVmStartSchedule, ResourcePolicyInstanceSchedulePolicyVmStartScheduleArgs
- Schedule string
- Specifies the frequency for the operation, using the unix-cron format.
- Schedule string
- Specifies the frequency for the operation, using the unix-cron format.
- schedule String
- Specifies the frequency for the operation, using the unix-cron format.
- schedule string
- Specifies the frequency for the operation, using the unix-cron format.
- schedule str
- Specifies the frequency for the operation, using the unix-cron format.
- schedule String
- Specifies the frequency for the operation, using the unix-cron format.
ResourcePolicyInstanceSchedulePolicyVmStopSchedule, ResourcePolicyInstanceSchedulePolicyVmStopScheduleArgs
- Schedule string
- Specifies the frequency for the operation, using the unix-cron format.
- Schedule string
- Specifies the frequency for the operation, using the unix-cron format.
- schedule String
- Specifies the frequency for the operation, using the unix-cron format.
- schedule string
- Specifies the frequency for the operation, using the unix-cron format.
- schedule str
- Specifies the frequency for the operation, using the unix-cron format.
- schedule String
- Specifies the frequency for the operation, using the unix-cron format.
ResourcePolicySnapshotSchedulePolicy, ResourcePolicySnapshotSchedulePolicyArgs
- Schedule
Resource
Policy Snapshot Schedule Policy Schedule - Contains one of an
hourlySchedule
,dailySchedule
, orweeklySchedule
. Structure is documented below. - Retention
Policy ResourcePolicy Snapshot Schedule Policy Retention Policy - Retention policy applied to snapshots created by this resource policy. Structure is documented below.
- Snapshot
Properties ResourcePolicy Snapshot Schedule Policy Snapshot Properties - Properties with which the snapshots are created, such as labels. Structure is documented below.
- Schedule
Resource
Policy Snapshot Schedule Policy Schedule - Contains one of an
hourlySchedule
,dailySchedule
, orweeklySchedule
. Structure is documented below. - Retention
Policy ResourcePolicy Snapshot Schedule Policy Retention Policy - Retention policy applied to snapshots created by this resource policy. Structure is documented below.
- Snapshot
Properties ResourcePolicy Snapshot Schedule Policy Snapshot Properties - Properties with which the snapshots are created, such as labels. Structure is documented below.
- schedule
Resource
Policy Snapshot Schedule Policy Schedule - Contains one of an
hourlySchedule
,dailySchedule
, orweeklySchedule
. Structure is documented below. - retention
Policy ResourcePolicy Snapshot Schedule Policy Retention Policy - Retention policy applied to snapshots created by this resource policy. Structure is documented below.
- snapshot
Properties ResourcePolicy Snapshot Schedule Policy Snapshot Properties - Properties with which the snapshots are created, such as labels. Structure is documented below.
- schedule
Resource
Policy Snapshot Schedule Policy Schedule - Contains one of an
hourlySchedule
,dailySchedule
, orweeklySchedule
. Structure is documented below. - retention
Policy ResourcePolicy Snapshot Schedule Policy Retention Policy - Retention policy applied to snapshots created by this resource policy. Structure is documented below.
- snapshot
Properties ResourcePolicy Snapshot Schedule Policy Snapshot Properties - Properties with which the snapshots are created, such as labels. Structure is documented below.
- schedule
Resource
Policy Snapshot Schedule Policy Schedule - Contains one of an
hourlySchedule
,dailySchedule
, orweeklySchedule
. Structure is documented below. - retention_
policy ResourcePolicy Snapshot Schedule Policy Retention Policy - Retention policy applied to snapshots created by this resource policy. Structure is documented below.
- snapshot_
properties ResourcePolicy Snapshot Schedule Policy Snapshot Properties - Properties with which the snapshots are created, such as labels. Structure is documented below.
- schedule Property Map
- Contains one of an
hourlySchedule
,dailySchedule
, orweeklySchedule
. Structure is documented below. - retention
Policy Property Map - Retention policy applied to snapshots created by this resource policy. Structure is documented below.
- snapshot
Properties Property Map - Properties with which the snapshots are created, such as labels. Structure is documented below.
ResourcePolicySnapshotSchedulePolicyRetentionPolicy, ResourcePolicySnapshotSchedulePolicyRetentionPolicyArgs
- Max
Retention intDays - Maximum age of the snapshot that is allowed to be kept.
- On
Source stringDisk Delete - Specifies the behavior to apply to scheduled snapshots when
the source disk is deleted.
Default value is
KEEP_AUTO_SNAPSHOTS
. Possible values are:KEEP_AUTO_SNAPSHOTS
,APPLY_RETENTION_POLICY
.
- Max
Retention intDays - Maximum age of the snapshot that is allowed to be kept.
- On
Source stringDisk Delete - Specifies the behavior to apply to scheduled snapshots when
the source disk is deleted.
Default value is
KEEP_AUTO_SNAPSHOTS
. Possible values are:KEEP_AUTO_SNAPSHOTS
,APPLY_RETENTION_POLICY
.
- max
Retention IntegerDays - Maximum age of the snapshot that is allowed to be kept.
- on
Source StringDisk Delete - Specifies the behavior to apply to scheduled snapshots when
the source disk is deleted.
Default value is
KEEP_AUTO_SNAPSHOTS
. Possible values are:KEEP_AUTO_SNAPSHOTS
,APPLY_RETENTION_POLICY
.
- max
Retention numberDays - Maximum age of the snapshot that is allowed to be kept.
- on
Source stringDisk Delete - Specifies the behavior to apply to scheduled snapshots when
the source disk is deleted.
Default value is
KEEP_AUTO_SNAPSHOTS
. Possible values are:KEEP_AUTO_SNAPSHOTS
,APPLY_RETENTION_POLICY
.
- max_
retention_ intdays - Maximum age of the snapshot that is allowed to be kept.
- on_
source_ strdisk_ delete - Specifies the behavior to apply to scheduled snapshots when
the source disk is deleted.
Default value is
KEEP_AUTO_SNAPSHOTS
. Possible values are:KEEP_AUTO_SNAPSHOTS
,APPLY_RETENTION_POLICY
.
- max
Retention NumberDays - Maximum age of the snapshot that is allowed to be kept.
- on
Source StringDisk Delete - Specifies the behavior to apply to scheduled snapshots when
the source disk is deleted.
Default value is
KEEP_AUTO_SNAPSHOTS
. Possible values are:KEEP_AUTO_SNAPSHOTS
,APPLY_RETENTION_POLICY
.
ResourcePolicySnapshotSchedulePolicySchedule, ResourcePolicySnapshotSchedulePolicyScheduleArgs
- Daily
Schedule ResourcePolicy Snapshot Schedule Policy Schedule Daily Schedule - The policy will execute every nth day at the specified time. Structure is documented below.
- Hourly
Schedule ResourcePolicy Snapshot Schedule Policy Schedule Hourly Schedule - The policy will execute every nth hour starting at the specified time. Structure is documented below.
- Weekly
Schedule ResourcePolicy Snapshot Schedule Policy Schedule Weekly Schedule - Allows specifying a snapshot time for each day of the week. Structure is documented below.
- Daily
Schedule ResourcePolicy Snapshot Schedule Policy Schedule Daily Schedule - The policy will execute every nth day at the specified time. Structure is documented below.
- Hourly
Schedule ResourcePolicy Snapshot Schedule Policy Schedule Hourly Schedule - The policy will execute every nth hour starting at the specified time. Structure is documented below.
- Weekly
Schedule ResourcePolicy Snapshot Schedule Policy Schedule Weekly Schedule - Allows specifying a snapshot time for each day of the week. Structure is documented below.
- daily
Schedule ResourcePolicy Snapshot Schedule Policy Schedule Daily Schedule - The policy will execute every nth day at the specified time. Structure is documented below.
- hourly
Schedule ResourcePolicy Snapshot Schedule Policy Schedule Hourly Schedule - The policy will execute every nth hour starting at the specified time. Structure is documented below.
- weekly
Schedule ResourcePolicy Snapshot Schedule Policy Schedule Weekly Schedule - Allows specifying a snapshot time for each day of the week. Structure is documented below.
- daily
Schedule ResourcePolicy Snapshot Schedule Policy Schedule Daily Schedule - The policy will execute every nth day at the specified time. Structure is documented below.
- hourly
Schedule ResourcePolicy Snapshot Schedule Policy Schedule Hourly Schedule - The policy will execute every nth hour starting at the specified time. Structure is documented below.
- weekly
Schedule ResourcePolicy Snapshot Schedule Policy Schedule Weekly Schedule - Allows specifying a snapshot time for each day of the week. Structure is documented below.
- daily_
schedule ResourcePolicy Snapshot Schedule Policy Schedule Daily Schedule - The policy will execute every nth day at the specified time. Structure is documented below.
- hourly_
schedule ResourcePolicy Snapshot Schedule Policy Schedule Hourly Schedule - The policy will execute every nth hour starting at the specified time. Structure is documented below.
- weekly_
schedule ResourcePolicy Snapshot Schedule Policy Schedule Weekly Schedule - Allows specifying a snapshot time for each day of the week. Structure is documented below.
- daily
Schedule Property Map - The policy will execute every nth day at the specified time. Structure is documented below.
- hourly
Schedule Property Map - The policy will execute every nth hour starting at the specified time. Structure is documented below.
- weekly
Schedule Property Map - Allows specifying a snapshot time for each day of the week. Structure is documented below.
ResourcePolicySnapshotSchedulePolicyScheduleDailySchedule, ResourcePolicySnapshotSchedulePolicyScheduleDailyScheduleArgs
- Days
In intCycle - Defines a schedule with units measured in days. The value determines how many days pass between the start of each cycle. Days in cycle for snapshot schedule policy must be 1.
- Start
Time string - This must be in UTC format that resolves to one of 00:00, 04:00, 08:00, 12:00, 16:00, or 20:00. For example, both 13:00-5 and 08:00 are valid.
- Days
In intCycle - Defines a schedule with units measured in days. The value determines how many days pass between the start of each cycle. Days in cycle for snapshot schedule policy must be 1.
- Start
Time string - This must be in UTC format that resolves to one of 00:00, 04:00, 08:00, 12:00, 16:00, or 20:00. For example, both 13:00-5 and 08:00 are valid.
- days
In IntegerCycle - Defines a schedule with units measured in days. The value determines how many days pass between the start of each cycle. Days in cycle for snapshot schedule policy must be 1.
- start
Time String - This must be in UTC format that resolves to one of 00:00, 04:00, 08:00, 12:00, 16:00, or 20:00. For example, both 13:00-5 and 08:00 are valid.
- days
In numberCycle - Defines a schedule with units measured in days. The value determines how many days pass between the start of each cycle. Days in cycle for snapshot schedule policy must be 1.
- start
Time string - This must be in UTC format that resolves to one of 00:00, 04:00, 08:00, 12:00, 16:00, or 20:00. For example, both 13:00-5 and 08:00 are valid.
- days_
in_ intcycle - Defines a schedule with units measured in days. The value determines how many days pass between the start of each cycle. Days in cycle for snapshot schedule policy must be 1.
- start_
time str - This must be in UTC format that resolves to one of 00:00, 04:00, 08:00, 12:00, 16:00, or 20:00. For example, both 13:00-5 and 08:00 are valid.
- days
In NumberCycle - Defines a schedule with units measured in days. The value determines how many days pass between the start of each cycle. Days in cycle for snapshot schedule policy must be 1.
- start
Time String - This must be in UTC format that resolves to one of 00:00, 04:00, 08:00, 12:00, 16:00, or 20:00. For example, both 13:00-5 and 08:00 are valid.
ResourcePolicySnapshotSchedulePolicyScheduleHourlySchedule, ResourcePolicySnapshotSchedulePolicyScheduleHourlyScheduleArgs
- Hours
In intCycle - The number of hours between snapshots.
- Start
Time string - Time within the window to start the operations. It must be in an hourly format "HH:MM", where HH : [00-23] and MM : [00] GMT. eg: 21:00
- Hours
In intCycle - The number of hours between snapshots.
- Start
Time string - Time within the window to start the operations. It must be in an hourly format "HH:MM", where HH : [00-23] and MM : [00] GMT. eg: 21:00
- hours
In IntegerCycle - The number of hours between snapshots.
- start
Time String - Time within the window to start the operations. It must be in an hourly format "HH:MM", where HH : [00-23] and MM : [00] GMT. eg: 21:00
- hours
In numberCycle - The number of hours between snapshots.
- start
Time string - Time within the window to start the operations. It must be in an hourly format "HH:MM", where HH : [00-23] and MM : [00] GMT. eg: 21:00
- hours_
in_ intcycle - The number of hours between snapshots.
- start_
time str - Time within the window to start the operations. It must be in an hourly format "HH:MM", where HH : [00-23] and MM : [00] GMT. eg: 21:00
- hours
In NumberCycle - The number of hours between snapshots.
- start
Time String - Time within the window to start the operations. It must be in an hourly format "HH:MM", where HH : [00-23] and MM : [00] GMT. eg: 21:00
ResourcePolicySnapshotSchedulePolicyScheduleWeeklySchedule, ResourcePolicySnapshotSchedulePolicyScheduleWeeklyScheduleArgs
- Day
Of List<ResourceWeeks Policy Snapshot Schedule Policy Schedule Weekly Schedule Day Of Week> - May contain up to seven (one for each day of the week) snapshot times. Structure is documented below.
- Day
Of []ResourceWeeks Policy Snapshot Schedule Policy Schedule Weekly Schedule Day Of Week - May contain up to seven (one for each day of the week) snapshot times. Structure is documented below.
- day
Of List<ResourceWeeks Policy Snapshot Schedule Policy Schedule Weekly Schedule Day Of Week> - May contain up to seven (one for each day of the week) snapshot times. Structure is documented below.
- day
Of ResourceWeeks Policy Snapshot Schedule Policy Schedule Weekly Schedule Day Of Week[] - May contain up to seven (one for each day of the week) snapshot times. Structure is documented below.
- day_
of_ Sequence[Resourceweeks Policy Snapshot Schedule Policy Schedule Weekly Schedule Day Of Week] - May contain up to seven (one for each day of the week) snapshot times. Structure is documented below.
- day
Of List<Property Map>Weeks - May contain up to seven (one for each day of the week) snapshot times. Structure is documented below.
ResourcePolicySnapshotSchedulePolicyScheduleWeeklyScheduleDayOfWeek, ResourcePolicySnapshotSchedulePolicyScheduleWeeklyScheduleDayOfWeekArgs
- day str
- The day of the week to create the snapshot. e.g. MONDAY
Possible values are:
MONDAY
,TUESDAY
,WEDNESDAY
,THURSDAY
,FRIDAY
,SATURDAY
,SUNDAY
. - start_
time str - Time within the window to start the operations. It must be in format "HH:MM", where HH : [00-23] and MM : [00-00] GMT.
ResourcePolicySnapshotSchedulePolicySnapshotProperties, ResourcePolicySnapshotSchedulePolicySnapshotPropertiesArgs
- Chain
Name string - Creates the new snapshot in the snapshot chain labeled with the specified name. The chain name must be 1-63 characters long and comply with RFC1035.
- Guest
Flush bool - Whether to perform a 'guest aware' snapshot.
- Labels Dictionary<string, string>
- A set of key-value pairs.
- Storage
Locations string - Cloud Storage bucket location to store the auto snapshot (regional or multi-regional)
- Chain
Name string - Creates the new snapshot in the snapshot chain labeled with the specified name. The chain name must be 1-63 characters long and comply with RFC1035.
- Guest
Flush bool - Whether to perform a 'guest aware' snapshot.
- Labels map[string]string
- A set of key-value pairs.
- Storage
Locations string - Cloud Storage bucket location to store the auto snapshot (regional or multi-regional)
- chain
Name String - Creates the new snapshot in the snapshot chain labeled with the specified name. The chain name must be 1-63 characters long and comply with RFC1035.
- guest
Flush Boolean - Whether to perform a 'guest aware' snapshot.
- labels Map<String,String>
- A set of key-value pairs.
- storage
Locations String - Cloud Storage bucket location to store the auto snapshot (regional or multi-regional)
- chain
Name string - Creates the new snapshot in the snapshot chain labeled with the specified name. The chain name must be 1-63 characters long and comply with RFC1035.
- guest
Flush boolean - Whether to perform a 'guest aware' snapshot.
- labels {[key: string]: string}
- A set of key-value pairs.
- storage
Locations string - Cloud Storage bucket location to store the auto snapshot (regional or multi-regional)
- chain_
name str - Creates the new snapshot in the snapshot chain labeled with the specified name. The chain name must be 1-63 characters long and comply with RFC1035.
- guest_
flush bool - Whether to perform a 'guest aware' snapshot.
- labels Mapping[str, str]
- A set of key-value pairs.
- storage_
locations str - Cloud Storage bucket location to store the auto snapshot (regional or multi-regional)
- chain
Name String - Creates the new snapshot in the snapshot chain labeled with the specified name. The chain name must be 1-63 characters long and comply with RFC1035.
- guest
Flush Boolean - Whether to perform a 'guest aware' snapshot.
- labels Map<String>
- A set of key-value pairs.
- storage
Locations String - Cloud Storage bucket location to store the auto snapshot (regional or multi-regional)
Import
ResourcePolicy can be imported using any of these accepted formats:
projects/{{project}}/regions/{{region}}/resourcePolicies/{{name}}
{{project}}/{{region}}/{{name}}
{{region}}/{{name}}
{{name}}
When using the pulumi import
command, ResourcePolicy can be imported using one of the formats above. For example:
$ pulumi import gcp:compute/resourcePolicy:ResourcePolicy default projects/{{project}}/regions/{{region}}/resourcePolicies/{{name}}
$ pulumi import gcp:compute/resourcePolicy:ResourcePolicy default {{project}}/{{region}}/{{name}}
$ pulumi import gcp:compute/resourcePolicy:ResourcePolicy default {{region}}/{{name}}
$ pulumi import gcp:compute/resourcePolicy:ResourcePolicy default {{name}}
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
google-beta
Terraform Provider.