google::compute-resource-policy

Creates a resource policy.

Example

google::compute-resource-policy example-policy-alpha
    name: "example-policy-alpha"
    region: "us-central1"
    description: "Resource policy example alpha"

    snapshot-schedule-policy
        schedule
            weekly-schedule
                day-of-weeks
                    day: "FRIDAY"
                    start-time: "00:00"
                end
                day-of-weeks
                    day: "MONDAY"
                    start-time: "00:00"
                end
            end
        end

        retention-policy
            max-retention-days: 7
            on-source-disk-delete: "KEEP_AUTO_SNAPSHOTS"
        end

        snapshot-properties
            guest-flush: false
            labels: {
                "foo": "bar"
            }
storage-locations: [“us-central1”]
end

end

end

Attributes

Attribute Description
region Name of the region. (Required)
name The name of the resource policy. Must be a string 1-63 characters long and 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. Valid values satisfy the regex: [^[a-z]([-a-z0-9]{1,61}[a-z0-9])?]. (Required)
description Description for the resource policy.
snapshot-schedule-policy subresource

Resource policy for persistent disks for creating snapshots. (Required)

retention-policy subresource

Retention policy applied to snapshots created by this resource policy.

max-retention-days
Maximum age of the snapshot that is allowed to be kept.
on-source-disk-delete
The behavior to apply to scheduled snapshots when the source disk is deleted. Valid values are APPLY_RETENTION_POLICY, KEEP_AUTO_SNAPSHOTS or UNSPECIFIED_ON_SOURCE_DISK_DELETE.
schedule subresource

Specifies what kind of infrastructure maintenance Google is allowed to perform on this VM and when. Schedule that is applied to disks covered by this policy.

daily-schedule subresource

Define a schedule that runs every nth day of the month. Cannot be set if any of hourly-schedule or weekly-schedule is set.

days-in-cycle
Defines a schedule that runs every nth day of the month. (Required)
start-time
Start time of the window. 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. (Required)
hourly-schedule subresource

Define a schedule that runs every nth hour. Cannot be set if any of daily-schedule or weekly-schedule is set.

hours-in-cycle
Defines a schedule that runs every nth hour, [1-23]. Valid values are between 1 to 23. (Required)
start-time
Time within the window to start the operations. Must be in format “HH:MM”, where HH equals [00-23] and MM equals [00-00] GMT. (Required)
weekly-schedule subresource

Define a schedule that runs on specified days of the week. Cannot be set if any of daily-schedule or hourly-schedule is set.

day-of-weeks list
Up to 7 intervals/windows, one for each day of the week.
snapshot-properties subresource

Properties with which snapshots are created such as labels and storage locations.

guest-flush
Perform a guest aware snapshot.
labels map
Labels to apply to scheduled snapshots.
storage-locations list
Cloud Storage bucket storage location of the auto snapshot (regional or multi-regional).

Outputs

Attribute Description
self-link Server-defined fully-qualified URL for this resource.