OS policy assignment is an API resource that is used to apply a set
of OS policies to a dynamically targeted group of Compute Engine VM
instances.
An OS policy is used to define the desired state configuration for a
Compute Engine VM instance through a set of configuration resources
that provide capabilities such as installing or removing software
packages, or executing a script.
For more information, see OS policy and OS policy
assignment <https://cloud.google.com/compute/docs/os-configuration-management/working-with-os-policies>__.
Attributes
Name
Description
name
str
Resource name.
Format:
projects/{project_number}/locations/{location}/osPolicyAssignments/{os_policy_assignment_id}
This field is ignored when you create an OS policy
assignment.
description
str
OS policy assignment description.
Length of the description is limited to 1024
characters.
os_policies
MutableSequence[google.cloud.osconfig_v1alpha.types.OSPolicy]
Required. List of OS policies to be applied
to the VMs.
google.cloud.osconfig_v1alpha.types.OSPolicyAssignment.Rollout
Required. Rollout to deploy the OS policy assignment. A
rollout is triggered in the following situations:
1) OSPolicyAssignment is created.
2) OSPolicyAssignment is updated and the update contains
changes to one of the following fields:
- instance_filter
- os_policies
3) OSPolicyAssignment is deleted.
revision_id
str
Output only. The assignment revision ID
A new revision is committed whenever a rollout
is triggered for a OS policy assignment
revision_create_time
google.protobuf.timestamp_pb2.Timestamp
Output only. The timestamp that the revision
was created.
etag
str
The etag for this OS policy assignment.
If this is provided on update, it must match the
server's etag.
bool
Output only. Indicates that this revision has been
successfully rolled out in this zone and new VMs will be
assigned OS policies from this revision.
For a given OS policy assignment, there is only one revision
with a value of true for this field.
deleted
bool
Output only. Indicates that this revision
deletes the OS policy assignment.
reconciling
bool
Output only. Indicates that reconciliation is in progress
for the revision. This value is true when the
rollout_state is one of:
- IN_PROGRESS
- CANCELLING
uid
str
Output only. Server generated unique id for
the OS policy assignment resource.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-11 UTC."],[],[],null,["# Class OSPolicyAssignment (1.21.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.21.0 (latest)](/python/docs/reference/osconfig/latest/google.cloud.osconfig_v1alpha.types.OSPolicyAssignment)\n- [1.20.2](/python/docs/reference/osconfig/1.20.2/google.cloud.osconfig_v1alpha.types.OSPolicyAssignment)\n- [1.19.0](/python/docs/reference/osconfig/1.19.0/google.cloud.osconfig_v1alpha.types.OSPolicyAssignment)\n- [1.18.1](/python/docs/reference/osconfig/1.18.1/google.cloud.osconfig_v1alpha.types.OSPolicyAssignment)\n- [1.17.5](/python/docs/reference/osconfig/1.17.5/google.cloud.osconfig_v1alpha.types.OSPolicyAssignment)\n- [1.16.0](/python/docs/reference/osconfig/1.16.0/google.cloud.osconfig_v1alpha.types.OSPolicyAssignment)\n- [1.15.3](/python/docs/reference/osconfig/1.15.3/google.cloud.osconfig_v1alpha.types.OSPolicyAssignment)\n- [1.14.1](/python/docs/reference/osconfig/1.14.1/google.cloud.osconfig_v1alpha.types.OSPolicyAssignment)\n- [1.13.0](/python/docs/reference/osconfig/1.13.0/google.cloud.osconfig_v1alpha.types.OSPolicyAssignment)\n- [1.12.4](/python/docs/reference/osconfig/1.12.4/google.cloud.osconfig_v1alpha.types.OSPolicyAssignment)\n- [1.11.2](/python/docs/reference/osconfig/1.11.2/google.cloud.osconfig_v1alpha.types.OSPolicyAssignment)\n- [1.10.0](/python/docs/reference/osconfig/1.10.0/google.cloud.osconfig_v1alpha.types.OSPolicyAssignment)\n- [1.9.0](/python/docs/reference/osconfig/1.9.0/google.cloud.osconfig_v1alpha.types.OSPolicyAssignment)\n- [1.8.0](/python/docs/reference/osconfig/1.8.0/google.cloud.osconfig_v1alpha.types.OSPolicyAssignment)\n- [1.7.1](/python/docs/reference/osconfig/1.7.1/google.cloud.osconfig_v1alpha.types.OSPolicyAssignment)\n- [1.6.0](/python/docs/reference/osconfig/1.6.0/google.cloud.osconfig_v1alpha.types.OSPolicyAssignment)\n- [1.5.2](/python/docs/reference/osconfig/1.5.2/google.cloud.osconfig_v1alpha.types.OSPolicyAssignment)\n- [1.4.0](/python/docs/reference/osconfig/1.4.0/google.cloud.osconfig_v1alpha.types.OSPolicyAssignment)\n- [1.3.2](/python/docs/reference/osconfig/1.3.2/google.cloud.osconfig_v1alpha.types.OSPolicyAssignment)\n- [1.2.0](/python/docs/reference/osconfig/1.2.0/google.cloud.osconfig_v1alpha.types.OSPolicyAssignment)\n- [1.1.0](/python/docs/reference/osconfig/1.1.0/google.cloud.osconfig_v1alpha.types.OSPolicyAssignment)\n- [1.0.0](/python/docs/reference/osconfig/1.0.0/google.cloud.osconfig_v1alpha.types.OSPolicyAssignment)\n- [0.1.2](/python/docs/reference/osconfig/0.1.2/google.cloud.osconfig_v1alpha.types.OSPolicyAssignment) \n\n OSPolicyAssignment(mapping=None, *, ignore_unknown_fields=False, **kwargs)\n\nOS policy assignment is an API resource that is used to apply a set\nof OS policies to a dynamically targeted group of Compute Engine VM\ninstances.\n\nAn OS policy is used to define the desired state configuration for a\nCompute Engine VM instance through a set of configuration resources\nthat provide capabilities such as installing or removing software\npackages, or executing a script.\n\nFor more information, see `OS policy and OS policy\nassignment \u003chttps://cloud.google.com/compute/docs/os-configuration-management/working-with-os-policies\u003e`__.\n\nClasses\n-------\n\n### InstanceFilter\n\n InstanceFilter(mapping=None, *, ignore_unknown_fields=False, **kwargs)\n\nFilters to select target VMs for an assignment.\n\nIf more than one filter criteria is specified below, a VM will\nbe selected if and only if it satisfies all of them.\n\n### LabelSet\n\n LabelSet(mapping=None, *, ignore_unknown_fields=False, **kwargs)\n\nMessage representing label set.\n\n- A label is a key value pair set for a VM.\n- A LabelSet is a set of labels.\n- Labels within a LabelSet are ANDed. In other words, a LabelSet is applicable for a VM only if it matches all the labels in the LabelSet.\n- Example: A LabelSet with 2 labels: `env=prod` and `type=webserver` will only be applicable for those VMs with both labels present.\n\n### Rollout\n\n Rollout(mapping=None, *, ignore_unknown_fields=False, **kwargs)\n\nMessage to configure the rollout at the zonal level for the\nOS policy assignment.\n\n### RolloutState\n\n RolloutState(value)\n\nOS policy assignment rollout state"]]