ComputeResourcePolicy
| Property | Value | 
|---|---|
| Google Cloud Service Name | Compute Engine | 
| Google Cloud Service Documentation | /compute/docs/ | 
| Google Cloud REST Resource Name | v1.resourcePolicies | 
| Google Cloud REST Resource Documentation | /compute/docs/reference/rest/v1/resourcePolicies | 
| Config Connector Resource Short Name | gcpcomputeresourcepolicy gcpcomputeresourcepolicies computeresourcepolicy | 
| Config Connector Resource Fully Qualified Name | computeresourcepolicies.compute.cnrm.cloud.google.com | 
| Can Be Referenced by IAMPolicy/IAMPolicyMember | No | 
| Config Connector Default Average Reconcile Interval In Seconds | 600 | 
Custom Resource Definition Properties
Annotations
| Fields | |
|---|---|
| cnrm.cloud.google.com/project-id | |
Spec
Schema
description: string
diskConsistencyGroupPolicy:
  enabled: boolean
groupPlacementPolicy:
  availabilityDomainCount: integer
  collocation: string
  maxDistance: integer
  vmCount: integer
instanceSchedulePolicy:
  expirationTime: string
  startTime: string
  timeZone: string
  vmStartSchedule:
    schedule: string
  vmStopSchedule:
    schedule: string
region: string
resourceID: string
snapshotSchedulePolicy:
  retentionPolicy:
    maxRetentionDays: integer
    onSourceDiskDelete: string
  schedule:
    dailySchedule:
      daysInCycle: integer
      startTime: string
    hourlySchedule:
      hoursInCycle: integer
      startTime: string
    weeklySchedule:
      dayOfWeeks:
      - day: string
        startTime: string
  snapshotProperties:
    chainName: string
    guestFlush: boolean
    labels:
      string: string
    storageLocations:
    - string
| Fields | |
|---|---|
| 
 Optional | 
 Immutable. An optional description of this resource. Provide this property when you create the resource. | 
| 
 Optional | 
 Immutable. Replication consistency group for asynchronous disk replication. | 
| 
 Required* | 
 Immutable. Enable disk consistency on the resource policy. | 
| 
 Optional | 
 Immutable. Resource policy for instances used for placement configuration. | 
| 
 Optional | 
 Immutable. 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. | 
| 
 Optional | 
 Immutable. 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: ["COLLOCATED"]. | 
| 
 Optional | 
 Immutable. Specifies the number of max logical switches. | 
| 
 Optional | 
 Immutable. 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. | 
| 
 Optional | 
 Immutable. Resource policy for scheduling instance operations. | 
| 
 Optional | 
 Immutable. The expiration time of the schedule. The timestamp is an RFC3339 string. | 
| 
 Optional | 
 Immutable. The start time of the schedule. The timestamp is an RFC3339 string. | 
| 
 Required* | 
 Immutable. 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. | 
| 
 Optional | 
 Immutable. Specifies the schedule for starting instances. | 
| 
 Required* | 
 Immutable. Specifies the frequency for the operation, using the unix-cron format. | 
| 
 Optional | 
 Immutable. Specifies the schedule for stopping instances. | 
| 
 Required* | 
 Immutable. Specifies the frequency for the operation, using the unix-cron format. | 
| 
 Required | 
 Immutable. Region where resource policy resides. | 
| 
 Optional | 
 Immutable. Optional. The name of the resource. Used for creation and acquisition. When unset, the value of `metadata.name` is used as the default. | 
| 
 Optional | 
 Immutable. Policy for creating snapshots of persistent disks. | 
| 
 Optional | 
 Immutable. Retention policy applied to snapshots created by this resource policy. | 
| 
 Required* | 
 Immutable. Maximum age of the snapshot that is allowed to be kept. | 
| 
 Optional | 
 Immutable. Specifies the behavior to apply to scheduled snapshots when the source disk is deleted. Default value: "KEEP_AUTO_SNAPSHOTS" Possible values: ["KEEP_AUTO_SNAPSHOTS", "APPLY_RETENTION_POLICY"]. | 
| 
 Required* | 
 Immutable. Contains one of an 'hourlySchedule', 'dailySchedule', or 'weeklySchedule'. | 
| 
 Optional | 
 Immutable. The policy will execute every nth day at the specified time. | 
| 
 Required* | 
 Immutable. 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. | 
| 
 Required* | 
 Immutable. 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. | 
| 
 Optional | 
 Immutable. The policy will execute every nth hour starting at the specified time. | 
| 
 Required* | 
 Immutable. The number of hours between snapshots. | 
| 
 Required* | 
 Immutable. 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. | 
| 
 Optional | 
 Immutable. Allows specifying a snapshot time for each day of the week. | 
| 
 Required* | 
 Immutable. May contain up to seven (one for each day of the week) snapshot times. | 
| 
 Required* | 
 | 
| 
 Required* | 
 Immutable. The day of the week to create the snapshot. e.g. MONDAY Possible values: ["MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY", "SUNDAY"]. | 
| 
 Required* | 
 Immutable. Time within the window to start the operations. It must be in format "HH:MM", where HH : [00-23] and MM : [00-00] GMT. | 
| 
 Optional | 
 Immutable. Properties with which the snapshots are created, such as labels. | 
| 
 Optional | 
 Immutable. 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. | 
| 
 Optional | 
 Immutable. Whether to perform a 'guest aware' snapshot. | 
| 
 Optional | 
 Immutable. A set of key-value pairs. | 
| 
 Optional | 
 Immutable. Cloud Storage bucket location to store the auto snapshot (regional or multi-regional). | 
| 
 Optional | 
 | 
* Field is required when parent field is specified
Status
Schema
conditions:
- lastTransitionTime: string
  message: string
  reason: string
  status: string
  type: string
observedGeneration: integer
selfLink: string
| Fields | |
|---|---|
| conditions | 
 Conditions represent the latest available observation of the resource's current state. | 
| conditions[] | 
 | 
| conditions[].lastTransitionTime | 
 Last time the condition transitioned from one status to another. | 
| conditions[].message | 
 Human-readable message indicating details about last transition. | 
| conditions[].reason | 
 Unique, one-word, CamelCase reason for the condition's last transition. | 
| conditions[].status | 
 Status is the status of the condition. Can be True, False, Unknown. | 
| conditions[].type | 
 Type is the type of the condition. | 
| observedGeneration | 
 ObservedGeneration is the generation of the resource that was most recently observed by the Config Connector controller. If this is equal to metadata.generation, then that means that the current reported status reflects the most recent desired state of the resource. | 
| selfLink | 
 | 
Sample YAML(s)
Daily Resource Policy Schedule
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeResourcePolicy
metadata:
  name: computeresourcepolicy-sample-dailyschedule
spec:
  region: us-central1
  snapshotSchedulePolicy:
    schedule:
      dailySchedule:
        daysInCycle: 1
        startTime: "00:00"
    retentionPolicy:
      maxRetentionDays: 8
      onSourceDiskDelete: KEEP_AUTO_SNAPSHOTS
    snapshotProperties:
      storageLocations:
      - us-central1
      guestFlush: true
      labels:
        autodeleted: "false"
        interval: "daily"
Hourly Resource Policy Schedule
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeResourcePolicy
metadata:
  name: computeresourcepolicy-sample-hourlyschedule
spec:
  region: us-central1
  snapshotSchedulePolicy:
    schedule:
      hourlySchedule:
        hoursInCycle: 4
        startTime: "13:00"
    retentionPolicy:
      maxRetentionDays: 2
      onSourceDiskDelete: APPLY_RETENTION_POLICY
    snapshotProperties:
      labels:
        autodeleted: "true"
        interval: "hourly"
Weekly Resource Policy Schedule
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeResourcePolicy
metadata:
  name: computeresourcepolicy-sample-weeklyschedule
spec:
  region: us-central1
  snapshotSchedulePolicy:
    schedule:
      weeklySchedule:
        dayOfWeeks:
        - startTime: "08:00"
          day: MONDAY
        - startTime: "15:00"
          day: WEDNESDAY
        - startTime: "23:00"
          day: FRIDAY
    retentionPolicy:
      maxRetentionDays: 12
    snapshotProperties:
      storageLocations:
      - us
      guestFlush: false
      labels:
        autodeleted: "false"
        interval: "weekly"