@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
129 lines • 5.84 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DefaultServiceAccounts = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* Allows management of Google Cloud Platform project default service accounts.
*
* When certain service APIs are enabled, Google Cloud Platform automatically creates service accounts to help get started, but
* this is not recommended for production environments as per [Google's documentation](https://cloud.google.com/iam/docs/service-accounts#default).
* See the [Organization documentation](https://docs.cloud.google.com/resource-manager/docs/quickstarts) for more details.
*
* > **WARNING** Some Google Cloud products do not work if the default service accounts are deleted so it is better to `DEPRIVILEGE` as
* Google **CAN NOT** recover service accounts that have been deleted for more than 30 days.
* Also Google recommends using the `constraints/iam.automaticIamGrantsForDefaultServiceAccounts` [constraint](https://www.terraform.io/docs/providers/google/r/google_organization_policy.html)
* to disable automatic IAM Grants to default service accounts.
*
* > This resource works on a best-effort basis, as no API formally describes the default service accounts
* and it is for users who are unable to use constraints. If the default service accounts change their name
* or additional service accounts are added, this resource will need to be updated.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const myProject = new gcp.projects.DefaultServiceAccounts("my_project", {
* project: "my-project-id",
* action: "DELETE",
* });
* ```
*
* To enable the default service accounts on the resource destroy:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const myProject = new gcp.projects.DefaultServiceAccounts("my_project", {
* project: "my-project-id",
* action: "DISABLE",
* restorePolicy: "REVERT",
* });
* ```
*
* ## Import
*
* This resource does not support import
*/
class DefaultServiceAccounts extends pulumi.CustomResource {
/**
* Get an existing DefaultServiceAccounts 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 DefaultServiceAccounts(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:projects/defaultServiceAccounts:DefaultServiceAccounts';
/**
* Returns true if the given object is an instance of DefaultServiceAccounts. 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'] === DefaultServiceAccounts.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["action"] = state?.action;
resourceInputs["project"] = state?.project;
resourceInputs["restorePolicy"] = state?.restorePolicy;
resourceInputs["serviceAccounts"] = state?.serviceAccounts;
}
else {
const args = argsOrState;
if (args?.action === undefined && !opts.urn) {
throw new Error("Missing required property 'action'");
}
if (args?.project === undefined && !opts.urn) {
throw new Error("Missing required property 'project'");
}
resourceInputs["action"] = args?.action;
resourceInputs["project"] = args?.project;
resourceInputs["restorePolicy"] = args?.restorePolicy;
resourceInputs["serviceAccounts"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(DefaultServiceAccounts.__pulumiType, name, resourceInputs, opts);
}
}
exports.DefaultServiceAccounts = DefaultServiceAccounts;
//# sourceMappingURL=defaultServiceAccounts.js.map