@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
371 lines (370 loc) • 14.6 kB
TypeScript
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.
*
* 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}}
* ```
*
* ```sh
* $ pulumi import gcp:osconfig/guestPolicies:GuestPolicies default {{project}}/{{guest_policy_id}}
* ```
*
* ```sh
* $ 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<pulumi.ID>, 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<outputs.osconfig.GuestPoliciesAssignment>;
/**
* 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<string>;
/**
* Description of the guest policy. Length of the description is limited to 1024 characters.
*/
readonly description: pulumi.Output<string | undefined>;
/**
* The etag for this guest policy. If this is provided on update, it must match the server's etag.
*/
readonly etag: pulumi.Output<string>;
/**
* 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<string>;
/**
* Unique name of the resource in this project using one of the following forms: projects/{project_number}/guestPolicies/{guestPolicyId}.
*/
readonly name: pulumi.Output<string>;
/**
* 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.
*/
readonly packageRepositories: pulumi.Output<outputs.osconfig.GuestPoliciesPackageRepository[] | undefined>;
/**
* The software packages to be managed by this policy.
*/
readonly packages: pulumi.Output<outputs.osconfig.GuestPoliciesPackage[] | undefined>;
readonly project: pulumi.Output<string>;
/**
* A list of Recipes to install on the VM instance.
*/
readonly recipes: pulumi.Output<outputs.osconfig.GuestPoliciesRecipe[] | undefined>;
/**
* 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<string>;
/**
* 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<inputs.osconfig.GuestPoliciesAssignment>;
/**
* 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<string>;
/**
* Description of the guest policy. Length of the description is limited to 1024 characters.
*/
description?: pulumi.Input<string>;
/**
* The etag for this guest policy. If this is provided on update, it must match the server's etag.
*/
etag?: pulumi.Input<string>;
/**
* 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<string>;
/**
* Unique name of the resource in this project using one of the following forms: projects/{project_number}/guestPolicies/{guestPolicyId}.
*/
name?: pulumi.Input<string>;
/**
* 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.
*/
packageRepositories?: pulumi.Input<pulumi.Input<inputs.osconfig.GuestPoliciesPackageRepository>[]>;
/**
* The software packages to be managed by this policy.
*/
packages?: pulumi.Input<pulumi.Input<inputs.osconfig.GuestPoliciesPackage>[]>;
project?: pulumi.Input<string>;
/**
* A list of Recipes to install on the VM instance.
*/
recipes?: pulumi.Input<pulumi.Input<inputs.osconfig.GuestPoliciesRecipe>[]>;
/**
* 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<string>;
}
/**
* 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<inputs.osconfig.GuestPoliciesAssignment>;
/**
* Description of the guest policy. Length of the description is limited to 1024 characters.
*/
description?: pulumi.Input<string>;
/**
* The etag for this guest policy. If this is provided on update, it must match the server's etag.
*/
etag?: pulumi.Input<string>;
/**
* 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<string>;
/**
* 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.
*/
packageRepositories?: pulumi.Input<pulumi.Input<inputs.osconfig.GuestPoliciesPackageRepository>[]>;
/**
* The software packages to be managed by this policy.
*/
packages?: pulumi.Input<pulumi.Input<inputs.osconfig.GuestPoliciesPackage>[]>;
project?: pulumi.Input<string>;
/**
* A list of Recipes to install on the VM instance.
*/
recipes?: pulumi.Input<pulumi.Input<inputs.osconfig.GuestPoliciesRecipe>[]>;
}