UNPKG

@pulumi/gcp

Version:

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

222 lines • 10.2 kB
"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.Posture = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * A Posture represents a collection of policy set including its name, state, description * and policy sets. A policy set includes set of policies along with their definition. * A posture can be created at the organization level. * Every update to a deployed posture creates a new posture revision with an updated revision_id. * * To get more information about Posture, see: * * * [API documentation](https://cloud.google.com/security-command-center/docs/reference/securityposture/rest/v1/Posture) * * How-to Guides * * [Create and deploy a posture](https://cloud.google.com/security-command-center/docs/how-to-use-security-posture) * * ## Example Usage * * ### Securityposture Posture Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const posture1 = new gcp.securityposture.Posture("posture1", { * postureId: "posture_example", * parent: "organizations/123456789", * location: "global", * state: "ACTIVE", * description: "a new posture", * policySets: [ * { * policySetId: "org_policy_set", * description: "set of org policies", * policies: [ * { * policyId: "canned_org_policy", * constraint: { * orgPolicyConstraint: { * cannedConstraintId: "storage.uniformBucketLevelAccess", * policyRules: [{ * enforce: true, * condition: { * description: "condition description", * expression: "resource.matchTag('org_id/tag_key_short_name,'tag_value_short_name')", * title: "a CEL condition", * }, * }], * }, * }, * }, * { * policyId: "custom_org_policy", * constraint: { * orgPolicyConstraintCustom: { * customConstraint: { * name: "organizations/123456789/customConstraints/custom.disableGkeAutoUpgrade", * displayName: "Disable GKE auto upgrade", * description: "Only allow GKE NodePool resource to be created or updated if AutoUpgrade is not enabled where this custom constraint is enforced.", * actionType: "ALLOW", * condition: "resource.management.autoUpgrade == false", * methodTypes: [ * "CREATE", * "UPDATE", * ], * resourceTypes: ["container.googleapis.com/NodePool"], * }, * policyRules: [{ * enforce: true, * condition: { * description: "condition description", * expression: "resource.matchTagId('tagKeys/key_id','tagValues/value_id')", * title: "a CEL condition", * }, * }], * }, * }, * }, * ], * }, * { * policySetId: "sha_policy_set", * description: "set of sha policies", * policies: [ * { * policyId: "sha_builtin_module", * constraint: { * securityHealthAnalyticsModule: { * moduleName: "BIGQUERY_TABLE_CMEK_DISABLED", * moduleEnablementState: "ENABLED", * }, * }, * description: "enable BIGQUERY_TABLE_CMEK_DISABLED", * }, * { * policyId: "sha_custom_module", * constraint: { * securityHealthAnalyticsCustomModule: { * displayName: "custom_SHA_policy", * config: { * predicate: { * expression: "resource.rotationPeriod > duration('2592000s')", * }, * customOutput: { * properties: [{ * name: "duration", * valueExpression: { * expression: "resource.rotationPeriod", * }, * }], * }, * resourceSelector: { * resourceTypes: ["cloudkms.googleapis.com/CryptoKey"], * }, * severity: "LOW", * description: "Custom Module", * recommendation: "Testing custom modules", * }, * moduleEnablementState: "ENABLED", * }, * }, * }, * ], * }, * ], * }); * ``` * * ## Import * * Posture can be imported using any of these accepted formats: * * * `{{parent}}/locations/{{location}}/postures/{{posture_id}}` * * When using the `pulumi import` command, Posture can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:securityposture/posture:Posture default {{parent}}/locations/{{location}}/postures/{{posture_id}} * ``` */ class Posture extends pulumi.CustomResource { /** * Get an existing Posture 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 Posture(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of Posture. 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'] === Posture.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["createTime"] = state?.createTime; resourceInputs["description"] = state?.description; resourceInputs["etag"] = state?.etag; resourceInputs["location"] = state?.location; resourceInputs["name"] = state?.name; resourceInputs["parent"] = state?.parent; resourceInputs["policySets"] = state?.policySets; resourceInputs["postureId"] = state?.postureId; resourceInputs["reconciling"] = state?.reconciling; resourceInputs["revisionId"] = state?.revisionId; resourceInputs["state"] = state?.state; resourceInputs["updateTime"] = state?.updateTime; } else { const args = argsOrState; if (args?.location === undefined && !opts.urn) { throw new Error("Missing required property 'location'"); } if (args?.parent === undefined && !opts.urn) { throw new Error("Missing required property 'parent'"); } if (args?.policySets === undefined && !opts.urn) { throw new Error("Missing required property 'policySets'"); } if (args?.postureId === undefined && !opts.urn) { throw new Error("Missing required property 'postureId'"); } if (args?.state === undefined && !opts.urn) { throw new Error("Missing required property 'state'"); } resourceInputs["description"] = args?.description; resourceInputs["location"] = args?.location; resourceInputs["parent"] = args?.parent; resourceInputs["policySets"] = args?.policySets; resourceInputs["postureId"] = args?.postureId; resourceInputs["state"] = args?.state; resourceInputs["createTime"] = undefined /*out*/; resourceInputs["etag"] = undefined /*out*/; resourceInputs["name"] = undefined /*out*/; resourceInputs["reconciling"] = undefined /*out*/; resourceInputs["revisionId"] = undefined /*out*/; resourceInputs["updateTime"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Posture.__pulumiType, name, resourceInputs, opts); } } exports.Posture = Posture; /** @internal */ Posture.__pulumiType = 'gcp:securityposture/posture:Posture'; //# sourceMappingURL=posture.js.map