UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

151 lines 6.96 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.AccessLevelCondition = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Allows configuring a single access level condition to be appended to an access level's conditions. * This resource is intended to be used in cases where it is not possible to compile a full list * of conditions to include in a `gcp.accesscontextmanager.AccessLevel` resource, * to enable them to be added separately. * * > **Note:** If this resource is used alongside a `gcp.accesscontextmanager.AccessLevel` resource, * the access level resource must have a `lifecycle` block with `ignoreChanges = [basic[0].conditions]` so * they don't fight over which service accounts should be included. * * To get more information about AccessLevelCondition, see: * * * [API documentation](https://cloud.google.com/access-context-manager/docs/reference/rest/v1/accessPolicies.accessLevels) * * How-to Guides * * [Access Policy Quickstart](https://cloud.google.com/access-context-manager/docs/quickstart) * * > **Warning:** If you are using User ADCs (Application Default Credentials) with this resource, * you must specify a `billingProject` and set `userProjectOverride` to true * in the provider configuration. Otherwise the ACM API will return a 403 error. * Your account must have the `serviceusage.services.use` permission on the * `billingProject` you defined. * * ## Example Usage * * ### Access Context Manager Access Level Condition Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const access_policy = new gcp.accesscontextmanager.AccessPolicy("access-policy", { * parent: "organizations/123456789", * title: "my policy", * }); * const access_level_service_account = new gcp.accesscontextmanager.AccessLevel("access-level-service-account", { * parent: pulumi.interpolate`accessPolicies/${access_policy.name}`, * name: pulumi.interpolate`accessPolicies/${access_policy.name}/accessLevels/chromeos_no_lock`, * title: "chromeos_no_lock", * basic: { * conditions: [{ * devicePolicy: { * requireScreenLock: true, * osConstraints: [{ * osType: "DESKTOP_CHROME_OS", * }], * }, * regions: [ * "CH", * "IT", * "US", * ], * }], * }, * }); * const created_later = new gcp.serviceaccount.Account("created-later", {accountId: "my-account-id"}); * const access_level_conditions = new gcp.accesscontextmanager.AccessLevelCondition("access-level-conditions", { * accessLevel: access_level_service_account.name, * ipSubnetworks: ["192.0.4.0/24"], * members: [ * "user:test@google.com", * "user:test2@google.com", * pulumi.interpolate`serviceAccount:${created_later.email}`, * ], * negate: false, * devicePolicy: { * requireScreenLock: false, * requireAdminApproval: false, * requireCorpOwned: true, * osConstraints: [{ * osType: "DESKTOP_CHROME_OS", * }], * }, * regions: [ * "IT", * "US", * ], * }); * ``` * * ## Import * * This resource does not support import. */ class AccessLevelCondition extends pulumi.CustomResource { /** * Get an existing AccessLevelCondition 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, id, state, opts) { return new AccessLevelCondition(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of AccessLevelCondition. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === AccessLevelCondition.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["accessLevel"] = state ? state.accessLevel : undefined; resourceInputs["accessPolicyId"] = state ? state.accessPolicyId : undefined; resourceInputs["devicePolicy"] = state ? state.devicePolicy : undefined; resourceInputs["ipSubnetworks"] = state ? state.ipSubnetworks : undefined; resourceInputs["members"] = state ? state.members : undefined; resourceInputs["negate"] = state ? state.negate : undefined; resourceInputs["regions"] = state ? state.regions : undefined; resourceInputs["requiredAccessLevels"] = state ? state.requiredAccessLevels : undefined; resourceInputs["vpcNetworkSources"] = state ? state.vpcNetworkSources : undefined; } else { const args = argsOrState; if ((!args || args.accessLevel === undefined) && !opts.urn) { throw new Error("Missing required property 'accessLevel'"); } resourceInputs["accessLevel"] = args ? args.accessLevel : undefined; resourceInputs["devicePolicy"] = args ? args.devicePolicy : undefined; resourceInputs["ipSubnetworks"] = args ? args.ipSubnetworks : undefined; resourceInputs["members"] = args ? args.members : undefined; resourceInputs["negate"] = args ? args.negate : undefined; resourceInputs["regions"] = args ? args.regions : undefined; resourceInputs["requiredAccessLevels"] = args ? args.requiredAccessLevels : undefined; resourceInputs["vpcNetworkSources"] = args ? args.vpcNetworkSources : undefined; resourceInputs["accessPolicyId"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(AccessLevelCondition.__pulumiType, name, resourceInputs, opts); } } exports.AccessLevelCondition = AccessLevelCondition; /** @internal */ AccessLevelCondition.__pulumiType = 'gcp:accesscontextmanager/accessLevelCondition:AccessLevelCondition'; //# sourceMappingURL=accessLevelCondition.js.map