import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * 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 about the OS policy resource definitions and examples, see * [OS policy and OS policy assignment](https://cloud.google.com/compute/docs/os-configuration-management/working-with-os-policies). * * To get more information about OSPolicyAssignment, see: * * * [API documentation](https://cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments) * * How-to Guides * * [Official Documentation](https://cloud.google.com/compute/docs/os-configuration-management/create-os-policy-assignment) * * ## Example Usage * * ### Os Config Os Policy Assignment Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const primary = new gcp.osconfig.OsPolicyAssignment("primary", { * instanceFilter: { * all: false, * exclusionLabels: [{ * labels: { * "label-two": "value-two", * }, * }], * inclusionLabels: [{ * labels: { * "label-one": "value-one", * }, * }], * inventories: [{ * osShortName: "centos", * osVersion: "8.*", * }], * }, * location: "us-central1-a", * name: "policy-assignment", * osPolicies: [{ * id: "policy", * mode: "VALIDATION", * resourceGroups: [{ * resources: [ * { * id: "apt-to-yum", * repository: { * apt: { * archiveType: "DEB", * components: ["doc"], * distribution: "debian", * uri: "https://atl.mirrors.clouvider.net/debian", * gpgKey: ".gnupg/pubring.kbx", * }, * }, * }, * { * id: "exec1", * exec: { * validate: { * interpreter: "SHELL", * args: ["arg1"], * file: { * localPath: "$HOME/script.sh", * }, * outputFilePath: "$HOME/out", * }, * enforce: { * interpreter: "SHELL", * args: ["arg1"], * file: { * allowInsecure: true, * remote: { * uri: "https://www.example.com/script.sh", * sha256Checksum: "c7938fed83afdccbb0e86a2a2e4cad7d5035012ca3214b4a61268393635c3063", * }, * }, * outputFilePath: "$HOME/out", * }, * }, * }, * ], * inventoryFilters: [{ * osShortName: "centos", * osVersion: "8.*", * }], * }], * allowNoResourceGroupMatch: false, * description: "A test os policy", * }], * rollout: { * disruptionBudget: { * percent: 100, * }, * minWaitDuration: "3s", * }, * description: "A test os policy assignment", * }); * ``` * * ## Import * * OSPolicyAssignment can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{location}}/osPolicyAssignments/{{name}}` * * `{{project}}/{{location}}/{{name}}` * * `{{location}}/{{name}}` * * When using the `pulumi import` command, OSPolicyAssignment can be imported using one of the formats above. For example: * * ```sh * $ 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}} * ``` */ export declare class OsPolicyAssignment extends pulumi.CustomResource { /** * Get an existing OsPolicyAssignment resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input, state?: OsPolicyAssignmentState, opts?: pulumi.CustomResourceOptions): OsPolicyAssignment; /** * Returns true if the given object is an instance of OsPolicyAssignment. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is OsPolicyAssignment; /** * 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. */ readonly baseline: pulumi.Output; /** * Output only. Indicates that this revision deletes the OS policy * assignment. */ readonly deleted: pulumi.Output; /** * OS policy assignment description. Length of the description is limited to 1024 characters. */ readonly description: pulumi.Output; /** * The etag for this OS policy assignment. If this is provided on * update, it must match the server's etag. */ readonly etag: pulumi.Output; /** * Filter to select VMs. Structure is * documented below. */ readonly instanceFilter: pulumi.Output; /** * The location for the resource */ readonly location: pulumi.Output; /** * Resource name. */ readonly name: pulumi.Output; /** * List of OS policies to be applied to the VMs. * Structure is documented below. */ readonly osPolicies: pulumi.Output; /** * The project for the resource */ readonly project: pulumi.Output; /** * Output only. Indicates that reconciliation is in progress * for the revision. This value is `true` when the `rolloutState` is one of: */ readonly reconciling: pulumi.Output; /** * Output only. The timestamp that the revision was * created. */ readonly revisionCreateTime: pulumi.Output; /** * Output only. The assignment revision ID A new revision is * committed whenever a rollout is triggered for a OS policy assignment */ readonly revisionId: pulumi.Output; /** * 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: - instanceFilter - osPolicies 3) OSPolicyAssignment * is deleted. Structure is documented below. */ readonly rollout: pulumi.Output; /** * Output only. OS policy assignment rollout state */ readonly rolloutState: pulumi.Output; /** * Set to true to skip awaiting rollout during resource creation and update. */ readonly skipAwaitRollout: pulumi.Output; /** * Output only. Server generated unique id for the OS policy assignment * resource. */ readonly uid: pulumi.Output; /** * Create a OsPolicyAssignment resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: OsPolicyAssignmentArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering OsPolicyAssignment resources. */ export interface OsPolicyAssignmentState { /** * 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. */ baseline?: pulumi.Input; /** * Output only. Indicates that this revision deletes the OS policy * assignment. */ deleted?: pulumi.Input; /** * OS policy assignment description. Length of the description is limited to 1024 characters. */ description?: pulumi.Input; /** * The etag for this OS policy assignment. If this is provided on * update, it must match the server's etag. */ etag?: pulumi.Input; /** * Filter to select VMs. Structure is * documented below. */ instanceFilter?: pulumi.Input; /** * The location for the resource */ location?: pulumi.Input; /** * Resource name. */ name?: pulumi.Input; /** * List of OS policies to be applied to the VMs. * Structure is documented below. */ osPolicies?: pulumi.Input[]>; /** * The project for the resource */ project?: pulumi.Input; /** * Output only. Indicates that reconciliation is in progress * for the revision. This value is `true` when the `rolloutState` is one of: */ reconciling?: pulumi.Input; /** * Output only. The timestamp that the revision was * created. */ revisionCreateTime?: pulumi.Input; /** * Output only. The assignment revision ID A new revision is * committed whenever a rollout is triggered for a OS policy assignment */ revisionId?: pulumi.Input; /** * 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: - instanceFilter - osPolicies 3) OSPolicyAssignment * is deleted. Structure is documented below. */ rollout?: pulumi.Input; /** * Output only. OS policy assignment rollout state */ rolloutState?: pulumi.Input; /** * Set to true to skip awaiting rollout during resource creation and update. */ skipAwaitRollout?: pulumi.Input; /** * Output only. Server generated unique id for the OS policy assignment * resource. */ uid?: pulumi.Input; } /** * The set of arguments for constructing a OsPolicyAssignment resource. */ export interface OsPolicyAssignmentArgs { /** * OS policy assignment description. Length of the description is limited to 1024 characters. */ description?: pulumi.Input; /** * Filter to select VMs. Structure is * documented below. */ instanceFilter: pulumi.Input; /** * The location for the resource */ location: pulumi.Input; /** * Resource name. */ name?: pulumi.Input; /** * List of OS policies to be applied to the VMs. * Structure is documented below. */ osPolicies: pulumi.Input[]>; /** * The project for the resource */ project?: pulumi.Input; /** * 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: - instanceFilter - osPolicies 3) OSPolicyAssignment * is deleted. Structure is documented below. */ rollout: pulumi.Input; /** * Set to true to skip awaiting rollout during resource creation and update. */ skipAwaitRollout?: pulumi.Input; }