@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
123 lines • 6.14 kB
JavaScript
;
// *** 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.ServicePerimeterDryRunResource = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Allows configuring a single GCP resource that should be inside of the `spec` block of a dry run service perimeter.
* This resource is intended to be used in cases where it is not possible to compile a full list
* of projects to include in a `gcp.accesscontextmanager.ServicePerimeter` resource,
* to enable them to be added separately.
* If your perimeter is NOT in dry-run mode use `gcp.accesscontextmanager.ServicePerimeterResource` instead.
*
* > **Note:** If this resource is used alongside a `gcp.accesscontextmanager.ServicePerimeter` resource,
* the service perimeter resource must have a `lifecycle` block with `ignoreChanges = [spec[0].resources]` so
* they don't fight over which resources should be in the policy.
*
* To get more information about ServicePerimeterDryRunResource, see:
*
* * [API documentation](https://cloud.google.com/access-context-manager/docs/reference/rest/v1/accessPolicies.servicePerimeters)
* * How-to Guides
* * [Service Perimeter Quickstart](https://cloud.google.com/vpc-service-controls/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 Service Perimeter Dry Run Resource 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 service_perimeter_dry_run_resourceServicePerimeter = new gcp.accesscontextmanager.ServicePerimeter("service-perimeter-dry-run-resource", {
* parent: pulumi.interpolate`accessPolicies/${access_policy.name}`,
* name: pulumi.interpolate`accessPolicies/${access_policy.name}/servicePerimeters/restrict_all`,
* title: "restrict_all",
* spec: {
* restrictedServices: ["storage.googleapis.com"],
* },
* useExplicitDryRunSpec: true,
* });
* const service_perimeter_dry_run_resource = new gcp.accesscontextmanager.ServicePerimeterDryRunResource("service-perimeter-dry-run-resource", {
* perimeterName: service_perimeter_dry_run_resourceServicePerimeter.name,
* resource: "projects/987654321",
* });
* ```
*
* ## Import
*
* ServicePerimeterDryRunResource can be imported using any of these accepted formats:
*
* * `{{perimeter_name}}/{{resource}}`
*
* When using the `pulumi import` command, ServicePerimeterDryRunResource can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:accesscontextmanager/servicePerimeterDryRunResource:ServicePerimeterDryRunResource default {{perimeter_name}}/{{resource}}
* ```
*/
class ServicePerimeterDryRunResource extends pulumi.CustomResource {
/**
* Get an existing ServicePerimeterDryRunResource 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 ServicePerimeterDryRunResource(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of ServicePerimeterDryRunResource. 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'] === ServicePerimeterDryRunResource.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["accessPolicyId"] = state ? state.accessPolicyId : undefined;
resourceInputs["etag"] = state ? state.etag : undefined;
resourceInputs["perimeterName"] = state ? state.perimeterName : undefined;
resourceInputs["resource"] = state ? state.resource : undefined;
}
else {
const args = argsOrState;
if ((!args || args.perimeterName === undefined) && !opts.urn) {
throw new Error("Missing required property 'perimeterName'");
}
if ((!args || args.resource === undefined) && !opts.urn) {
throw new Error("Missing required property 'resource'");
}
resourceInputs["perimeterName"] = args ? args.perimeterName : undefined;
resourceInputs["resource"] = args ? args.resource : undefined;
resourceInputs["accessPolicyId"] = undefined /*out*/;
resourceInputs["etag"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ServicePerimeterDryRunResource.__pulumiType, name, resourceInputs, opts);
}
}
exports.ServicePerimeterDryRunResource = ServicePerimeterDryRunResource;
/** @internal */
ServicePerimeterDryRunResource.__pulumiType = 'gcp:accesscontextmanager/servicePerimeterDryRunResource:ServicePerimeterDryRunResource';
//# sourceMappingURL=servicePerimeterDryRunResource.js.map