1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. compute
  5. ResourcePolicy
Google Cloud Classic v7.19.0 published on Thursday, Apr 18, 2024 by Pulumi

gcp.compute.ResourcePolicy

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.19.0 published on Thursday, Apr 18, 2024 by Pulumi

    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.

    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.
    DiskConsistencyGroupPolicy ResourcePolicyDiskConsistencyGroupPolicy
    Replication consistency group for asynchronous disk replication. Structure is documented below.
    GroupPlacementPolicy ResourcePolicyGroupPlacementPolicy
    Resource policy for instances used for placement configuration. Structure is documented below.
    InstanceSchedulePolicy ResourcePolicyInstanceSchedulePolicy
    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.
    SnapshotSchedulePolicy ResourcePolicySnapshotSchedulePolicy
    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.
    DiskConsistencyGroupPolicy ResourcePolicyDiskConsistencyGroupPolicyArgs
    Replication consistency group for asynchronous disk replication. Structure is documented below.
    GroupPlacementPolicy ResourcePolicyGroupPlacementPolicyArgs
    Resource policy for instances used for placement configuration. Structure is documented below.
    InstanceSchedulePolicy ResourcePolicyInstanceSchedulePolicyArgs
    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.
    SnapshotSchedulePolicy ResourcePolicySnapshotSchedulePolicyArgs
    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.
    diskConsistencyGroupPolicy ResourcePolicyDiskConsistencyGroupPolicy
    Replication consistency group for asynchronous disk replication. Structure is documented below.
    groupPlacementPolicy ResourcePolicyGroupPlacementPolicy
    Resource policy for instances used for placement configuration. Structure is documented below.
    instanceSchedulePolicy ResourcePolicyInstanceSchedulePolicy
    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.
    snapshotSchedulePolicy ResourcePolicySnapshotSchedulePolicy
    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.
    diskConsistencyGroupPolicy ResourcePolicyDiskConsistencyGroupPolicy
    Replication consistency group for asynchronous disk replication. Structure is documented below.
    groupPlacementPolicy ResourcePolicyGroupPlacementPolicy
    Resource policy for instances used for placement configuration. Structure is documented below.
    instanceSchedulePolicy ResourcePolicyInstanceSchedulePolicy
    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.
    snapshotSchedulePolicy ResourcePolicySnapshotSchedulePolicy
    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_group_policy ResourcePolicyDiskConsistencyGroupPolicyArgs
    Replication consistency group for asynchronous disk replication. Structure is documented below.
    group_placement_policy ResourcePolicyGroupPlacementPolicyArgs
    Resource policy for instances used for placement configuration. Structure is documented below.
    instance_schedule_policy ResourcePolicyInstanceSchedulePolicyArgs
    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_policy ResourcePolicySnapshotSchedulePolicyArgs
    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.
    diskConsistencyGroupPolicy Property Map
    Replication consistency group for asynchronous disk replication. Structure is documented below.
    groupPlacementPolicy Property Map
    Resource policy for instances used for placement configuration. Structure is documented below.
    instanceSchedulePolicy Property Map
    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.
    snapshotSchedulePolicy Property Map
    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:

    Id string
    The provider-assigned unique ID for this managed resource.
    SelfLink string
    The URI of the created resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    SelfLink string
    The URI of the created resource.
    id String
    The provider-assigned unique ID for this managed resource.
    selfLink String
    The URI of the created resource.
    id string
    The provider-assigned unique ID for this managed resource.
    selfLink string
    The URI of the created resource.
    id str
    The provider-assigned unique ID for this managed resource.
    self_link str
    The URI of the created resource.
    id String
    The provider-assigned unique ID for this managed resource.
    selfLink String
    The URI of the created resource.

    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.
    The following state arguments are supported:
    Description string
    An optional description of this resource. Provide this property when you create the resource.
    DiskConsistencyGroupPolicy ResourcePolicyDiskConsistencyGroupPolicy
    Replication consistency group for asynchronous disk replication. Structure is documented below.
    GroupPlacementPolicy ResourcePolicyGroupPlacementPolicy
    Resource policy for instances used for placement configuration. Structure is documented below.
    InstanceSchedulePolicy ResourcePolicyInstanceSchedulePolicy
    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.
    SelfLink string
    The URI of the created resource.
    SnapshotSchedulePolicy ResourcePolicySnapshotSchedulePolicy
    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.
    DiskConsistencyGroupPolicy ResourcePolicyDiskConsistencyGroupPolicyArgs
    Replication consistency group for asynchronous disk replication. Structure is documented below.
    GroupPlacementPolicy ResourcePolicyGroupPlacementPolicyArgs
    Resource policy for instances used for placement configuration. Structure is documented below.
    InstanceSchedulePolicy ResourcePolicyInstanceSchedulePolicyArgs
    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.
    SelfLink string
    The URI of the created resource.
    SnapshotSchedulePolicy ResourcePolicySnapshotSchedulePolicyArgs
    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.
    diskConsistencyGroupPolicy ResourcePolicyDiskConsistencyGroupPolicy
    Replication consistency group for asynchronous disk replication. Structure is documented below.
    groupPlacementPolicy ResourcePolicyGroupPlacementPolicy
    Resource policy for instances used for placement configuration. Structure is documented below.
    instanceSchedulePolicy ResourcePolicyInstanceSchedulePolicy
    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.
    selfLink String
    The URI of the created resource.
    snapshotSchedulePolicy ResourcePolicySnapshotSchedulePolicy
    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.
    diskConsistencyGroupPolicy ResourcePolicyDiskConsistencyGroupPolicy
    Replication consistency group for asynchronous disk replication. Structure is documented below.
    groupPlacementPolicy ResourcePolicyGroupPlacementPolicy
    Resource policy for instances used for placement configuration. Structure is documented below.
    instanceSchedulePolicy ResourcePolicyInstanceSchedulePolicy
    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.
    selfLink string
    The URI of the created resource.
    snapshotSchedulePolicy ResourcePolicySnapshotSchedulePolicy
    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_group_policy ResourcePolicyDiskConsistencyGroupPolicyArgs
    Replication consistency group for asynchronous disk replication. Structure is documented below.
    group_placement_policy ResourcePolicyGroupPlacementPolicyArgs
    Resource policy for instances used for placement configuration. Structure is documented below.
    instance_schedule_policy ResourcePolicyInstanceSchedulePolicyArgs
    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_policy ResourcePolicySnapshotSchedulePolicyArgs
    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.
    diskConsistencyGroupPolicy Property Map
    Replication consistency group for asynchronous disk replication. Structure is documented below.
    groupPlacementPolicy Property Map
    Resource policy for instances used for placement configuration. Structure is documented below.
    instanceSchedulePolicy Property Map
    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.
    selfLink String
    The URI of the created resource.
    snapshotSchedulePolicy Property Map
    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

    AvailabilityDomainCount int
    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 with vm_count. If compute instances are created with a COLLOCATED policy, then exactly vm_count instances must be created at the same time with the resource policy attached. Possible values are: COLLOCATED.
    MaxDistance int
    Specifies the number of max logical switches.
    VmCount 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.
    AvailabilityDomainCount int
    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 with vm_count. If compute instances are created with a COLLOCATED policy, then exactly vm_count instances must be created at the same time with the resource policy attached. Possible values are: COLLOCATED.
    MaxDistance int
    Specifies the number of max logical switches.
    VmCount 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.
    availabilityDomainCount Integer
    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 with vm_count. If compute instances are created with a COLLOCATED policy, then exactly vm_count instances must be created at the same time with the resource policy attached. Possible values are: COLLOCATED.
    maxDistance Integer
    Specifies the number of max logical switches.
    vmCount 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.
    availabilityDomainCount number
    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 with vm_count. If compute instances are created with a COLLOCATED policy, then exactly vm_count instances must be created at the same time with the resource policy attached. Possible values are: COLLOCATED.
    maxDistance number
    Specifies the number of max logical switches.
    vmCount 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_count int
    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 with vm_count. If compute instances are created with a COLLOCATED policy, then exactly vm_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.
    availabilityDomainCount Number
    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 with vm_count. If compute instances are created with a COLLOCATED policy, then exactly vm_count instances must be created at the same time with the resource policy attached. Possible values are: COLLOCATED.
    maxDistance Number
    Specifies the number of max logical switches.
    vmCount 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

    TimeZone 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.
    ExpirationTime string
    The expiration time of the schedule. The timestamp is an RFC3339 string.
    StartTime string
    The start time of the schedule. The timestamp is an RFC3339 string.
    VmStartSchedule ResourcePolicyInstanceSchedulePolicyVmStartSchedule
    Specifies the schedule for starting instances. Structure is documented below.
    VmStopSchedule ResourcePolicyInstanceSchedulePolicyVmStopSchedule
    Specifies the schedule for stopping instances. Structure is documented below.
    TimeZone 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.
    ExpirationTime string
    The expiration time of the schedule. The timestamp is an RFC3339 string.
    StartTime string
    The start time of the schedule. The timestamp is an RFC3339 string.
    VmStartSchedule ResourcePolicyInstanceSchedulePolicyVmStartSchedule
    Specifies the schedule for starting instances. Structure is documented below.
    VmStopSchedule ResourcePolicyInstanceSchedulePolicyVmStopSchedule
    Specifies the schedule for stopping instances. Structure is documented below.
    timeZone 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.
    expirationTime String
    The expiration time of the schedule. The timestamp is an RFC3339 string.
    startTime String
    The start time of the schedule. The timestamp is an RFC3339 string.
    vmStartSchedule ResourcePolicyInstanceSchedulePolicyVmStartSchedule
    Specifies the schedule for starting instances. Structure is documented below.
    vmStopSchedule ResourcePolicyInstanceSchedulePolicyVmStopSchedule
    Specifies the schedule for stopping instances. Structure is documented below.
    timeZone 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.
    expirationTime string
    The expiration time of the schedule. The timestamp is an RFC3339 string.
    startTime string
    The start time of the schedule. The timestamp is an RFC3339 string.
    vmStartSchedule ResourcePolicyInstanceSchedulePolicyVmStartSchedule
    Specifies the schedule for starting instances. Structure is documented below.
    vmStopSchedule ResourcePolicyInstanceSchedulePolicyVmStopSchedule
    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_schedule ResourcePolicyInstanceSchedulePolicyVmStartSchedule
    Specifies the schedule for starting instances. Structure is documented below.
    vm_stop_schedule ResourcePolicyInstanceSchedulePolicyVmStopSchedule
    Specifies the schedule for stopping instances. Structure is documented below.
    timeZone 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.
    expirationTime String
    The expiration time of the schedule. The timestamp is an RFC3339 string.
    startTime String
    The start time of the schedule. The timestamp is an RFC3339 string.
    vmStartSchedule Property Map
    Specifies the schedule for starting instances. Structure is documented below.
    vmStopSchedule Property Map
    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 ResourcePolicySnapshotSchedulePolicySchedule
    Contains one of an hourlySchedule, dailySchedule, or weeklySchedule. Structure is documented below.
    RetentionPolicy ResourcePolicySnapshotSchedulePolicyRetentionPolicy
    Retention policy applied to snapshots created by this resource policy. Structure is documented below.
    SnapshotProperties ResourcePolicySnapshotSchedulePolicySnapshotProperties
    Properties with which the snapshots are created, such as labels. Structure is documented below.
    Schedule ResourcePolicySnapshotSchedulePolicySchedule
    Contains one of an hourlySchedule, dailySchedule, or weeklySchedule. Structure is documented below.
    RetentionPolicy ResourcePolicySnapshotSchedulePolicyRetentionPolicy
    Retention policy applied to snapshots created by this resource policy. Structure is documented below.
    SnapshotProperties ResourcePolicySnapshotSchedulePolicySnapshotProperties
    Properties with which the snapshots are created, such as labels. Structure is documented below.
    schedule ResourcePolicySnapshotSchedulePolicySchedule
    Contains one of an hourlySchedule, dailySchedule, or weeklySchedule. Structure is documented below.
    retentionPolicy ResourcePolicySnapshotSchedulePolicyRetentionPolicy
    Retention policy applied to snapshots created by this resource policy. Structure is documented below.
    snapshotProperties ResourcePolicySnapshotSchedulePolicySnapshotProperties
    Properties with which the snapshots are created, such as labels. Structure is documented below.
    schedule ResourcePolicySnapshotSchedulePolicySchedule
    Contains one of an hourlySchedule, dailySchedule, or weeklySchedule. Structure is documented below.
    retentionPolicy ResourcePolicySnapshotSchedulePolicyRetentionPolicy
    Retention policy applied to snapshots created by this resource policy. Structure is documented below.
    snapshotProperties ResourcePolicySnapshotSchedulePolicySnapshotProperties
    Properties with which the snapshots are created, such as labels. Structure is documented below.
    schedule ResourcePolicySnapshotSchedulePolicySchedule
    Contains one of an hourlySchedule, dailySchedule, or weeklySchedule. Structure is documented below.
    retention_policy ResourcePolicySnapshotSchedulePolicyRetentionPolicy
    Retention policy applied to snapshots created by this resource policy. Structure is documented below.
    snapshot_properties ResourcePolicySnapshotSchedulePolicySnapshotProperties
    Properties with which the snapshots are created, such as labels. Structure is documented below.
    schedule Property Map
    Contains one of an hourlySchedule, dailySchedule, or weeklySchedule. Structure is documented below.
    retentionPolicy Property Map
    Retention policy applied to snapshots created by this resource policy. Structure is documented below.
    snapshotProperties Property Map
    Properties with which the snapshots are created, such as labels. Structure is documented below.

    ResourcePolicySnapshotSchedulePolicyRetentionPolicy, ResourcePolicySnapshotSchedulePolicyRetentionPolicyArgs

    MaxRetentionDays int
    Maximum age of the snapshot that is allowed to be kept.
    OnSourceDiskDelete string
    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.
    MaxRetentionDays int
    Maximum age of the snapshot that is allowed to be kept.
    OnSourceDiskDelete string
    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.
    maxRetentionDays Integer
    Maximum age of the snapshot that is allowed to be kept.
    onSourceDiskDelete String
    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.
    maxRetentionDays number
    Maximum age of the snapshot that is allowed to be kept.
    onSourceDiskDelete string
    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_days int
    Maximum age of the snapshot that is allowed to be kept.
    on_source_disk_delete str
    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.
    maxRetentionDays Number
    Maximum age of the snapshot that is allowed to be kept.
    onSourceDiskDelete String
    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

    DailySchedule ResourcePolicySnapshotSchedulePolicyScheduleDailySchedule
    The policy will execute every nth day at the specified time. Structure is documented below.
    HourlySchedule ResourcePolicySnapshotSchedulePolicyScheduleHourlySchedule
    The policy will execute every nth hour starting at the specified time. Structure is documented below.
    WeeklySchedule ResourcePolicySnapshotSchedulePolicyScheduleWeeklySchedule
    Allows specifying a snapshot time for each day of the week. Structure is documented below.
    DailySchedule ResourcePolicySnapshotSchedulePolicyScheduleDailySchedule
    The policy will execute every nth day at the specified time. Structure is documented below.
    HourlySchedule ResourcePolicySnapshotSchedulePolicyScheduleHourlySchedule
    The policy will execute every nth hour starting at the specified time. Structure is documented below.
    WeeklySchedule ResourcePolicySnapshotSchedulePolicyScheduleWeeklySchedule
    Allows specifying a snapshot time for each day of the week. Structure is documented below.
    dailySchedule ResourcePolicySnapshotSchedulePolicyScheduleDailySchedule
    The policy will execute every nth day at the specified time. Structure is documented below.
    hourlySchedule ResourcePolicySnapshotSchedulePolicyScheduleHourlySchedule
    The policy will execute every nth hour starting at the specified time. Structure is documented below.
    weeklySchedule ResourcePolicySnapshotSchedulePolicyScheduleWeeklySchedule
    Allows specifying a snapshot time for each day of the week. Structure is documented below.
    dailySchedule ResourcePolicySnapshotSchedulePolicyScheduleDailySchedule
    The policy will execute every nth day at the specified time. Structure is documented below.
    hourlySchedule ResourcePolicySnapshotSchedulePolicyScheduleHourlySchedule
    The policy will execute every nth hour starting at the specified time. Structure is documented below.
    weeklySchedule ResourcePolicySnapshotSchedulePolicyScheduleWeeklySchedule
    Allows specifying a snapshot time for each day of the week. Structure is documented below.
    daily_schedule ResourcePolicySnapshotSchedulePolicyScheduleDailySchedule
    The policy will execute every nth day at the specified time. Structure is documented below.
    hourly_schedule ResourcePolicySnapshotSchedulePolicyScheduleHourlySchedule
    The policy will execute every nth hour starting at the specified time. Structure is documented below.
    weekly_schedule ResourcePolicySnapshotSchedulePolicyScheduleWeeklySchedule
    Allows specifying a snapshot time for each day of the week. Structure is documented below.
    dailySchedule Property Map
    The policy will execute every nth day at the specified time. Structure is documented below.
    hourlySchedule Property Map
    The policy will execute every nth hour starting at the specified time. Structure is documented below.
    weeklySchedule Property Map
    Allows specifying a snapshot time for each day of the week. Structure is documented below.

    ResourcePolicySnapshotSchedulePolicyScheduleDailySchedule, ResourcePolicySnapshotSchedulePolicyScheduleDailyScheduleArgs

    DaysInCycle int
    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.
    StartTime 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.
    DaysInCycle int
    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.
    StartTime 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.
    daysInCycle Integer
    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.
    startTime 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.
    daysInCycle number
    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.
    startTime 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_cycle int
    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.
    daysInCycle Number
    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.
    startTime 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

    HoursInCycle int
    The number of hours between snapshots.
    StartTime 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
    HoursInCycle int
    The number of hours between snapshots.
    StartTime 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
    hoursInCycle Integer
    The number of hours between snapshots.
    startTime 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
    hoursInCycle number
    The number of hours between snapshots.
    startTime 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_cycle int
    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
    hoursInCycle Number
    The number of hours between snapshots.
    startTime 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

    DayOfWeeks List<ResourcePolicySnapshotSchedulePolicyScheduleWeeklyScheduleDayOfWeek>
    May contain up to seven (one for each day of the week) snapshot times. Structure is documented below.
    DayOfWeeks []ResourcePolicySnapshotSchedulePolicyScheduleWeeklyScheduleDayOfWeek
    May contain up to seven (one for each day of the week) snapshot times. Structure is documented below.
    dayOfWeeks List<ResourcePolicySnapshotSchedulePolicyScheduleWeeklyScheduleDayOfWeek>
    May contain up to seven (one for each day of the week) snapshot times. Structure is documented below.
    dayOfWeeks ResourcePolicySnapshotSchedulePolicyScheduleWeeklyScheduleDayOfWeek[]
    May contain up to seven (one for each day of the week) snapshot times. Structure is documented below.
    day_of_weeks Sequence[ResourcePolicySnapshotSchedulePolicyScheduleWeeklyScheduleDayOfWeek]
    May contain up to seven (one for each day of the week) snapshot times. Structure is documented below.
    dayOfWeeks List<Property Map>
    May contain up to seven (one for each day of the week) snapshot times. Structure is documented below.

    ResourcePolicySnapshotSchedulePolicyScheduleWeeklyScheduleDayOfWeek, ResourcePolicySnapshotSchedulePolicyScheduleWeeklyScheduleDayOfWeekArgs

    Day string
    The day of the week to create the snapshot. e.g. MONDAY Possible values are: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY.
    StartTime string
    Time within the window to start the operations. It must be in format "HH:MM", where HH : [00-23] and MM : [00-00] GMT.
    Day string
    The day of the week to create the snapshot. e.g. MONDAY Possible values are: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY.
    StartTime string
    Time within the window to start the operations. It must be in format "HH:MM", where HH : [00-23] and MM : [00-00] GMT.
    day String
    The day of the week to create the snapshot. e.g. MONDAY Possible values are: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY.
    startTime String
    Time within the window to start the operations. It must be in format "HH:MM", where HH : [00-23] and MM : [00-00] GMT.
    day string
    The day of the week to create the snapshot. e.g. MONDAY Possible values are: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY.
    startTime string
    Time within the window to start the operations. It must be in format "HH:MM", where HH : [00-23] and MM : [00-00] GMT.
    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.
    day String
    The day of the week to create the snapshot. e.g. MONDAY Possible values are: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY.
    startTime String
    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

    ChainName 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.
    GuestFlush bool
    Whether to perform a 'guest aware' snapshot.
    Labels Dictionary<string, string>
    A set of key-value pairs.
    StorageLocations string
    Cloud Storage bucket location to store the auto snapshot (regional or multi-regional)
    ChainName 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.
    GuestFlush bool
    Whether to perform a 'guest aware' snapshot.
    Labels map[string]string
    A set of key-value pairs.
    StorageLocations string
    Cloud Storage bucket location to store the auto snapshot (regional or multi-regional)
    chainName 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.
    guestFlush Boolean
    Whether to perform a 'guest aware' snapshot.
    labels Map<String,String>
    A set of key-value pairs.
    storageLocations String
    Cloud Storage bucket location to store the auto snapshot (regional or multi-regional)
    chainName 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.
    guestFlush boolean
    Whether to perform a 'guest aware' snapshot.
    labels {[key: string]: string}
    A set of key-value pairs.
    storageLocations 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)
    chainName 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.
    guestFlush Boolean
    Whether to perform a 'guest aware' snapshot.
    labels Map<String>
    A set of key-value pairs.
    storageLocations 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.
    gcp logo
    Google Cloud Classic v7.19.0 published on Thursday, Apr 18, 2024 by Pulumi