@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
243 lines (242 loc) • 10.2 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
/**
* Allows management of Organization Policies for a Google Cloud Organization.
*
* > **Warning:** This resource has been superseded by `gcp.orgpolicy.Policy`. `gcp.orgpolicy.Policy` uses Organization Policy API V2 instead of Cloud Resource Manager API V1 and it supports additional features such as tags and conditions.
*
* To get more information about Organization Policies, see:
*
* * [API documentation](https://cloud.google.com/resource-manager/reference/rest/v1/organizations/setOrgPolicy)
* * How-to Guides
* * [Introduction to the Organization Policy Service](https://cloud.google.com/resource-manager/docs/organization-policy/overview)
*
* ## Example Usage
*
* To set policy with a [boolean constraint](https://cloud.google.com/resource-manager/docs/organization-policy/quickstart-boolean-constraints):
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const serialPortPolicy = new gcp.organizations.Policy("serial_port_policy", {
* orgId: "123456789",
* constraint: "compute.disableSerialPortAccess",
* booleanPolicy: {
* enforced: true,
* },
* });
* ```
*
* To set a policy with a [list constraint](https://cloud.google.com/resource-manager/docs/organization-policy/quickstart-list-constraints):
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const servicesPolicy = new gcp.organizations.Policy("services_policy", {
* orgId: "123456789",
* constraint: "serviceuser.services",
* listPolicy: {
* allow: {
* all: true,
* },
* },
* });
* ```
*
* Or to deny some services, use the following instead:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const servicesPolicy = new gcp.organizations.Policy("services_policy", {
* orgId: "123456789",
* constraint: "serviceuser.services",
* listPolicy: {
* suggestedValue: "compute.googleapis.com",
* deny: {
* values: ["cloudresourcemanager.googleapis.com"],
* },
* },
* });
* ```
*
* To restore the default organization policy, use the following instead:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const servicesPolicy = new gcp.organizations.Policy("services_policy", {
* orgId: "123456789",
* constraint: "serviceuser.services",
* restorePolicy: {
* "default": true,
* },
* });
* ```
*
* ## Import
*
* Organization Policies can be imported using the `org_id` and the `constraint`, e.g.
*
* * `{{org_id}}/constraints/{{constraint}}`
*
* When using the `pulumi import` command, Organization Policies can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:organizations/policy:Policy default {{org_id}}/constraints/{{constraint}}
* ```
*
* It is all right if the constraint contains a slash, as in the example above.
*/
export declare class Policy extends pulumi.CustomResource {
/**
* Get an existing Policy 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?: PolicyState, opts?: pulumi.CustomResourceOptions): Policy;
/**
* Returns true if the given object is an instance of Policy. 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 Policy;
/**
* A boolean policy is a constraint that is either enforced or not. Structure is documented
* below.
*/
readonly booleanPolicy: pulumi.Output<outputs.organizations.PolicyBooleanPolicy | undefined>;
/**
* The name of the Constraint the Policy is configuring, for example, `serviceuser.services`. Check out the [complete list of available constraints](https://cloud.google.com/resource-manager/docs/organization-policy/understanding-constraints#available_constraints).
*
* - - -
*/
readonly constraint: pulumi.Output<string>;
/**
* (Computed) The etag of the organization policy. `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other.
*/
readonly etag: pulumi.Output<string>;
/**
* A policy that can define specific values that are allowed or denied for the given constraint. It can also be used to allow or deny all values. Structure is documented below.
*/
readonly listPolicy: pulumi.Output<outputs.organizations.PolicyListPolicy | undefined>;
/**
* The numeric ID of the organization to set the policy for.
*/
readonly orgId: pulumi.Output<string>;
/**
* A restore policy is a constraint to restore the default policy. Structure is documented below.
*
* > **Note:** If none of [`booleanPolicy`, `listPolicy`, `restorePolicy`] are defined the policy for a given constraint will
* effectively be unset. This is represented in the UI as the constraint being 'Inherited'.
*
* - - -
*/
readonly restorePolicy: pulumi.Output<outputs.organizations.PolicyRestorePolicy | undefined>;
/**
* (Computed) The timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds, representing when the variable was last updated. Example: "2016-10-09T12:33:37.578138407Z".
*/
readonly updateTime: pulumi.Output<string>;
/**
* Version of the Policy. Default version is 0.
*/
readonly version: pulumi.Output<number>;
/**
* Create a Policy 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: PolicyArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering Policy resources.
*/
export interface PolicyState {
/**
* A boolean policy is a constraint that is either enforced or not. Structure is documented
* below.
*/
booleanPolicy?: pulumi.Input<inputs.organizations.PolicyBooleanPolicy>;
/**
* The name of the Constraint the Policy is configuring, for example, `serviceuser.services`. Check out the [complete list of available constraints](https://cloud.google.com/resource-manager/docs/organization-policy/understanding-constraints#available_constraints).
*
* - - -
*/
constraint?: pulumi.Input<string>;
/**
* (Computed) The etag of the organization policy. `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other.
*/
etag?: pulumi.Input<string>;
/**
* A policy that can define specific values that are allowed or denied for the given constraint. It can also be used to allow or deny all values. Structure is documented below.
*/
listPolicy?: pulumi.Input<inputs.organizations.PolicyListPolicy>;
/**
* The numeric ID of the organization to set the policy for.
*/
orgId?: pulumi.Input<string>;
/**
* A restore policy is a constraint to restore the default policy. Structure is documented below.
*
* > **Note:** If none of [`booleanPolicy`, `listPolicy`, `restorePolicy`] are defined the policy for a given constraint will
* effectively be unset. This is represented in the UI as the constraint being 'Inherited'.
*
* - - -
*/
restorePolicy?: pulumi.Input<inputs.organizations.PolicyRestorePolicy>;
/**
* (Computed) The timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds, representing when the variable was last updated. Example: "2016-10-09T12:33:37.578138407Z".
*/
updateTime?: pulumi.Input<string>;
/**
* Version of the Policy. Default version is 0.
*/
version?: pulumi.Input<number>;
}
/**
* The set of arguments for constructing a Policy resource.
*/
export interface PolicyArgs {
/**
* A boolean policy is a constraint that is either enforced or not. Structure is documented
* below.
*/
booleanPolicy?: pulumi.Input<inputs.organizations.PolicyBooleanPolicy>;
/**
* The name of the Constraint the Policy is configuring, for example, `serviceuser.services`. Check out the [complete list of available constraints](https://cloud.google.com/resource-manager/docs/organization-policy/understanding-constraints#available_constraints).
*
* - - -
*/
constraint: pulumi.Input<string>;
/**
* A policy that can define specific values that are allowed or denied for the given constraint. It can also be used to allow or deny all values. Structure is documented below.
*/
listPolicy?: pulumi.Input<inputs.organizations.PolicyListPolicy>;
/**
* The numeric ID of the organization to set the policy for.
*/
orgId: pulumi.Input<string>;
/**
* A restore policy is a constraint to restore the default policy. Structure is documented below.
*
* > **Note:** If none of [`booleanPolicy`, `listPolicy`, `restorePolicy`] are defined the policy for a given constraint will
* effectively be unset. This is represented in the UI as the constraint being 'Inherited'.
*
* - - -
*/
restorePolicy?: pulumi.Input<inputs.organizations.PolicyRestorePolicy>;
/**
* Version of the Policy. Default version is 0.
*/
version?: pulumi.Input<number>;
}