import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * An OS Config resource representing a guest configuration policy. These policies represent * the desired state for VM instance guest environments including packages to install or remove, * package repository configurations, and software to install. * * > **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider. * See Provider Versions for more details on beta resources. * * To get more information about GuestPolicies, see: * * * [API documentation](https://cloud.google.com/compute/docs/osconfig/rest) * * How-to Guides * * [Official Documentation](https://cloud.google.com/compute/docs/os-config-management) * * ## Example Usage * * ### Os Config Guest Policies Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const myImage = gcp.compute.getImage({ * family: "debian-11", * project: "debian-cloud", * }); * const foobar = new gcp.compute.Instance("foobar", { * name: "guest-policy-inst", * machineType: "e2-medium", * zone: "us-central1-a", * canIpForward: false, * tags: [ * "foo", * "bar", * ], * bootDisk: { * initializeParams: { * image: myImage.then(myImage => myImage.selfLink), * }, * }, * networkInterfaces: [{ * network: "default", * }], * metadata: { * foo: "bar", * }, * }); * const guestPolicies = new gcp.osconfig.GuestPolicies("guest_policies", { * guestPolicyId: "guest-policy", * assignment: { * instances: [foobar.id], * }, * packages: [{ * name: "my-package", * desiredState: "UPDATED", * }], * }); * ``` * ### Os Config Guest Policies Packages * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const guestPolicies = new gcp.osconfig.GuestPolicies("guest_policies", { * guestPolicyId: "guest-policy", * assignment: { * groupLabels: [ * { * labels: { * color: "red", * env: "test", * }, * }, * { * labels: { * color: "blue", * env: "test", * }, * }, * ], * }, * packages: [ * { * name: "my-package", * desiredState: "INSTALLED", * }, * { * name: "bad-package-1", * desiredState: "REMOVED", * }, * { * name: "bad-package-2", * desiredState: "REMOVED", * manager: "APT", * }, * ], * packageRepositories: [ * { * apt: { * uri: "https://packages.cloud.google.com/apt", * archiveType: "DEB", * distribution: "cloud-sdk-stretch", * components: ["main"], * }, * }, * { * yum: { * id: "google-cloud-sdk", * displayName: "Google Cloud SDK", * baseUrl: "https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64", * gpgKeys: [ * "https://packages.cloud.google.com/yum/doc/yum-key.gpg", * "https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg", * ], * }, * }, * ], * }); * ``` * ### Os Config Guest Policies Recipes * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const guestPolicies = new gcp.osconfig.GuestPolicies("guest_policies", { * guestPolicyId: "guest-policy", * assignment: { * zones: [ * "us-east1-b", * "us-east1-d", * ], * }, * recipes: [{ * name: "guest-policy-recipe", * desiredState: "INSTALLED", * artifacts: [{ * id: "guest-policy-artifact-id", * gcs: { * bucket: "my-bucket", * object: "executable.msi", * generation: 1546030865175603, * }, * }], * installSteps: [{ * msiInstallation: { * artifactId: "guest-policy-artifact-id", * }, * }], * }], * }); * ``` * * ## Import * * GuestPolicies can be imported using any of these accepted formats: * * * `projects/{{project}}/guestPolicies/{{guest_policy_id}}` * * `{{project}}/{{guest_policy_id}}` * * `{{guest_policy_id}}` * * When using the `pulumi import` command, GuestPolicies can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:osconfig/guestPolicies:GuestPolicies default projects/{{project}}/guestPolicies/{{guest_policy_id}} * $ pulumi import gcp:osconfig/guestPolicies:GuestPolicies default {{project}}/{{guest_policy_id}} * $ pulumi import gcp:osconfig/guestPolicies:GuestPolicies default {{guest_policy_id}} * ``` */ export declare class GuestPolicies extends pulumi.CustomResource { /** * Get an existing GuestPolicies 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?: GuestPoliciesState, opts?: pulumi.CustomResourceOptions): GuestPolicies; /** * Returns true if the given object is an instance of GuestPolicies. 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 GuestPolicies; /** * Specifies the VM instances that are assigned to this policy. This allows you to target sets * or groups of VM instances by different parameters such as labels, names, OS, or zones. * If left empty, all VM instances underneath this policy are targeted. * At the same level in the resource hierarchy (that is within a project), the service prevents * the creation of multiple policies that conflict with each other. * For more information, see how the service * [handles assignment conflicts](https://cloud.google.com/compute/docs/os-config-management/create-guest-policy#handle-conflicts). * Structure is documented below. */ readonly assignment: pulumi.Output; /** * Time this guest policy was created. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. * Example: "2014-10-02T15:01:23.045123456Z". */ readonly createTime: pulumi.Output; /** * Description of the guest policy. Length of the description is limited to 1024 characters. */ readonly description: pulumi.Output; /** * The etag for this guest policy. If this is provided on update, it must match the server's etag. */ readonly etag: pulumi.Output; /** * The logical name of the guest policy in the project with the following restrictions: * * Must contain only lowercase letters, numbers, and hyphens. * * Must start with a letter. * * Must be between 1-63 characters. * * Must end with a number or a letter. * * Must be unique within the project. */ readonly guestPolicyId: pulumi.Output; /** * Unique name of the resource in this project using one of the following forms: projects/{project_number}/guestPolicies/{guestPolicyId}. */ readonly name: pulumi.Output; /** * A list of package repositories to configure on the VM instance. * This is done before any other configs are applied so they can use these repos. * Package repositories are only configured if the corresponding package manager(s) are available. * Structure is documented below. */ readonly packageRepositories: pulumi.Output; /** * The software packages to be managed by this policy. * Structure is documented below. */ readonly packages: pulumi.Output; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ readonly project: pulumi.Output; /** * A list of Recipes to install on the VM instance. * Structure is documented below. */ readonly recipes: pulumi.Output; /** * Last time this guest policy was updated. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. * Example: "2014-10-02T15:01:23.045123456Z". */ readonly updateTime: pulumi.Output; /** * Create a GuestPolicies 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: GuestPoliciesArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering GuestPolicies resources. */ export interface GuestPoliciesState { /** * Specifies the VM instances that are assigned to this policy. This allows you to target sets * or groups of VM instances by different parameters such as labels, names, OS, or zones. * If left empty, all VM instances underneath this policy are targeted. * At the same level in the resource hierarchy (that is within a project), the service prevents * the creation of multiple policies that conflict with each other. * For more information, see how the service * [handles assignment conflicts](https://cloud.google.com/compute/docs/os-config-management/create-guest-policy#handle-conflicts). * Structure is documented below. */ assignment?: pulumi.Input; /** * Time this guest policy was created. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. * Example: "2014-10-02T15:01:23.045123456Z". */ createTime?: pulumi.Input; /** * Description of the guest policy. Length of the description is limited to 1024 characters. */ description?: pulumi.Input; /** * The etag for this guest policy. If this is provided on update, it must match the server's etag. */ etag?: pulumi.Input; /** * The logical name of the guest policy in the project with the following restrictions: * * Must contain only lowercase letters, numbers, and hyphens. * * Must start with a letter. * * Must be between 1-63 characters. * * Must end with a number or a letter. * * Must be unique within the project. */ guestPolicyId?: pulumi.Input; /** * Unique name of the resource in this project using one of the following forms: projects/{project_number}/guestPolicies/{guestPolicyId}. */ name?: pulumi.Input; /** * A list of package repositories to configure on the VM instance. * This is done before any other configs are applied so they can use these repos. * Package repositories are only configured if the corresponding package manager(s) are available. * Structure is documented below. */ packageRepositories?: pulumi.Input[]>; /** * The software packages to be managed by this policy. * Structure is documented below. */ packages?: pulumi.Input[]>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input; /** * A list of Recipes to install on the VM instance. * Structure is documented below. */ recipes?: pulumi.Input[]>; /** * Last time this guest policy was updated. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. * Example: "2014-10-02T15:01:23.045123456Z". */ updateTime?: pulumi.Input; } /** * The set of arguments for constructing a GuestPolicies resource. */ export interface GuestPoliciesArgs { /** * Specifies the VM instances that are assigned to this policy. This allows you to target sets * or groups of VM instances by different parameters such as labels, names, OS, or zones. * If left empty, all VM instances underneath this policy are targeted. * At the same level in the resource hierarchy (that is within a project), the service prevents * the creation of multiple policies that conflict with each other. * For more information, see how the service * [handles assignment conflicts](https://cloud.google.com/compute/docs/os-config-management/create-guest-policy#handle-conflicts). * Structure is documented below. */ assignment: pulumi.Input; /** * Description of the guest policy. Length of the description is limited to 1024 characters. */ description?: pulumi.Input; /** * The etag for this guest policy. If this is provided on update, it must match the server's etag. */ etag?: pulumi.Input; /** * The logical name of the guest policy in the project with the following restrictions: * * Must contain only lowercase letters, numbers, and hyphens. * * Must start with a letter. * * Must be between 1-63 characters. * * Must end with a number or a letter. * * Must be unique within the project. */ guestPolicyId: pulumi.Input; /** * A list of package repositories to configure on the VM instance. * This is done before any other configs are applied so they can use these repos. * Package repositories are only configured if the corresponding package manager(s) are available. * Structure is documented below. */ packageRepositories?: pulumi.Input[]>; /** * The software packages to be managed by this policy. * Structure is documented below. */ packages?: pulumi.Input[]>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input; /** * A list of Recipes to install on the VM instance. * Structure is documented below. */ recipes?: pulumi.Input[]>; }