"use strict";
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.DefaultServiceAccounts = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = 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://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 });
    }
    /**
     * 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;
/** @internal */
DefaultServiceAccounts.__pulumiType = 'gcp:projects/defaultServiceAccounts:DefaultServiceAccounts';
//# sourceMappingURL=defaultServiceAccounts.js.map