OsPolicyAssignment

Represents an OSPolicyAssignment resource.

Example Usage

Fixed_os_policy_assignment

An example of an osconfig os policy assignment with fixed rollout disruption budget

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.osconfig.OsPolicyAssignment;
import com.pulumi.gcp.osconfig.OsPolicyAssignmentArgs;
import com.pulumi.gcp.osconfig.inputs.OsPolicyAssignmentInstanceFilterArgs;
import com.pulumi.gcp.osconfig.inputs.OsPolicyAssignmentOsPolicyArgs;
import com.pulumi.gcp.osconfig.inputs.OsPolicyAssignmentRolloutArgs;
import com.pulumi.gcp.osconfig.inputs.OsPolicyAssignmentRolloutDisruptionBudgetArgs;
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 primary = new OsPolicyAssignment("primary", OsPolicyAssignmentArgs.builder()
.description("A test os policy assignment")
.instanceFilter(OsPolicyAssignmentInstanceFilterArgs.builder()
.all(false)
.exclusionLabels(OsPolicyAssignmentInstanceFilterExclusionLabelArgs.builder()
.labels(Map.of("label-two", "value-two"))
.build())
.inclusionLabels(OsPolicyAssignmentInstanceFilterInclusionLabelArgs.builder()
.labels(Map.of("label-one", "value-one"))
.build())
.inventories(OsPolicyAssignmentInstanceFilterInventoryArgs.builder()
.osShortName("centos")
.osVersion("8.*")
.build())
.build())
.location("us-west1-a")
.osPolicies(OsPolicyAssignmentOsPolicyArgs.builder()
.allowNoResourceGroupMatch(false)
.description("A test os policy")
.id("policy")
.mode("VALIDATION")
.resourceGroups(OsPolicyAssignmentOsPolicyResourceGroupArgs.builder()
.inventoryFilters(OsPolicyAssignmentOsPolicyResourceGroupInventoryFilterArgs.builder()
.osShortName("centos")
.osVersion("8.*")
.build())
.resources(OsPolicyAssignmentOsPolicyResourceGroupResourceArgs.builder()
.id("apt")
.pkg(OsPolicyAssignmentOsPolicyResourceGroupResourcePkgArgs.builder()
.apt(OsPolicyAssignmentOsPolicyResourceGroupResourcePkgAptArgs.builder()
.name("bazel")
.build())
.desiredState("INSTALLED")
.build())
.build())
.build())
.build())
.project("my-project-name")
.rollout(OsPolicyAssignmentRolloutArgs.builder()
.disruptionBudget(OsPolicyAssignmentRolloutDisruptionBudgetArgs.builder()
.fixed(1)
.build())
.minWaitDuration("3.5s")
.build())
.build());
}
}

Import

OSPolicyAssignment can be imported using any of these accepted formats

$ pulumi import gcp:osconfig/osPolicyAssignment:OsPolicyAssignment default projects/{{project}}/locations/{{location}}/osPolicyAssignments/{{name}}
$ pulumi import gcp:osconfig/osPolicyAssignment:OsPolicyAssignment default {{project}}/{{location}}/{{name}}
$ pulumi import gcp:osconfig/osPolicyAssignment:OsPolicyAssignment default {{location}}/{{name}}

Properties

Link copied to clipboard
val baseline: Output<Boolean>

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.

Link copied to clipboard
val deleted: Output<Boolean>

Output only. Indicates that this revision deletes the OS policy assignment.

Link copied to clipboard
val description: Output<String>?

Policy description. Length of the description is limited to 1024 characters. (Optional) OS policy assignment description. Length of the description is limited to 1024 characters.

Link copied to clipboard
val etag: Output<String>

The etag for this OS policy assignment. If this is provided on update, it must match the server's etag.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard

Required. Filter to select VMs.

Link copied to clipboard
val location: Output<String>

The location for the resource

Link copied to clipboard
val name: Output<String>

Resource name.

Link copied to clipboard

Required. List of OS policies to be applied to the VMs.

Link copied to clipboard
val project: Output<String>

The project for the resource

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val reconciling: Output<Boolean>

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

Link copied to clipboard

Output only. The timestamp that the revision was created.

Link copied to clipboard
val revisionId: Output<String>

Output only. The assignment revision ID A new revision is committed whenever a rollout is triggered for a OS policy assignment

Link copied to clipboard

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.

Link copied to clipboard
val rolloutState: Output<String>

Output only. OS policy assignment rollout state Possible values: ROLLOUT_STATE_UNSPECIFIED, IN_PROGRESS, CANCELLING, CANCELLED, SUCCEEDED

Link copied to clipboard

Set to true to skip awaiting rollout during resource creation and update.

Link copied to clipboard
val uid: Output<String>

Output only. Server generated unique id for the OS policy assignment resource.

Link copied to clipboard
val urn: Output<String>