@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
236 lines • 8.61 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! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.ServerlessSecurityPolicy = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Resource for managing an AWS OpenSearch Serverless Security Policy. See AWS documentation for [encryption policies](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/serverless-encryption.html#serverless-encryption-policies) and [network policies](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/serverless-network.html#serverless-network-policies).
*
* ## Example Usage
*
* ### Encryption Security Policy
*
* ### Applies to a single collection
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.opensearch.ServerlessSecurityPolicy("example", {
* name: "example",
* type: "encryption",
* description: "encryption security policy for example-collection",
* policy: JSON.stringify({
* Rules: [{
* Resource: ["collection/example-collection"],
* ResourceType: "collection",
* }],
* AWSOwnedKey: true,
* }),
* });
* ```
*
* ### Applies to multiple collections
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.opensearch.ServerlessSecurityPolicy("example", {
* name: "example",
* type: "encryption",
* description: "encryption security policy for collections that begin with \"example\"",
* policy: JSON.stringify({
* Rules: [{
* Resource: ["collection/example*"],
* ResourceType: "collection",
* }],
* AWSOwnedKey: true,
* }),
* });
* ```
*
* ### Using a customer managed key
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.opensearch.ServerlessSecurityPolicy("example", {
* name: "example",
* type: "encryption",
* description: "encryption security policy using customer KMS key",
* policy: JSON.stringify({
* Rules: [{
* Resource: ["collection/customer-managed-key-collection"],
* ResourceType: "collection",
* }],
* AWSOwnedKey: false,
* KmsARN: "arn:aws:kms:us-east-1:123456789012:key/93fd6da4-a317-4c17-bfe9-382b5d988b36",
* }),
* });
* ```
*
* ### Network Security Policy
*
* ### Allow public access to the collection endpoint and the Dashboards endpoint
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.opensearch.ServerlessSecurityPolicy("example", {
* name: "example",
* type: "network",
* description: "Public access",
* policy: JSON.stringify([{
* Description: "Public access to collection and Dashboards endpoint for example collection",
* Rules: [
* {
* ResourceType: "collection",
* Resource: ["collection/example-collection"],
* },
* {
* ResourceType: "dashboard",
* Resource: ["collection/example-collection"],
* },
* ],
* AllowFromPublic: true,
* }]),
* });
* ```
*
* ### Allow VPC access to the collection endpoint and the Dashboards endpoint
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.opensearch.ServerlessSecurityPolicy("example", {
* name: "example",
* type: "network",
* description: "VPC access",
* policy: JSON.stringify([{
* Description: "VPC access to collection and Dashboards endpoint for example collection",
* Rules: [
* {
* ResourceType: "collection",
* Resource: ["collection/example-collection"],
* },
* {
* ResourceType: "dashboard",
* Resource: ["collection/example-collection"],
* },
* ],
* AllowFromPublic: false,
* SourceVPCEs: ["vpce-050f79086ee71ac05"],
* }]),
* });
* ```
*
* ### Mixed access for different collections
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.opensearch.ServerlessSecurityPolicy("example", {
* name: "example",
* type: "network",
* description: "Mixed access for marketing and sales",
* policy: JSON.stringify([
* {
* Description: "Marketing access",
* Rules: [
* {
* ResourceType: "collection",
* Resource: ["collection/marketing*"],
* },
* {
* ResourceType: "dashboard",
* Resource: ["collection/marketing*"],
* },
* ],
* AllowFromPublic: false,
* SourceVPCEs: ["vpce-050f79086ee71ac05"],
* },
* {
* Description: "Sales access",
* Rules: [{
* ResourceType: "collection",
* Resource: ["collection/finance"],
* }],
* AllowFromPublic: true,
* },
* ]),
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import OpenSearchServerless Security Policy using the `name` and `type` arguments separated by a slash (`/`). For example:
*
* ```sh
* $ pulumi import aws:opensearch/serverlessSecurityPolicy:ServerlessSecurityPolicy example example/encryption
* ```
*/
class ServerlessSecurityPolicy extends pulumi.CustomResource {
/**
* Get an existing ServerlessSecurityPolicy 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 ServerlessSecurityPolicy(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of ServerlessSecurityPolicy. 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'] === ServerlessSecurityPolicy.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["description"] = state?.description;
resourceInputs["name"] = state?.name;
resourceInputs["policy"] = state?.policy;
resourceInputs["policyVersion"] = state?.policyVersion;
resourceInputs["region"] = state?.region;
resourceInputs["type"] = state?.type;
}
else {
const args = argsOrState;
if (args?.policy === undefined && !opts.urn) {
throw new Error("Missing required property 'policy'");
}
if (args?.type === undefined && !opts.urn) {
throw new Error("Missing required property 'type'");
}
resourceInputs["description"] = args?.description;
resourceInputs["name"] = args?.name;
resourceInputs["policy"] = args?.policy;
resourceInputs["region"] = args?.region;
resourceInputs["type"] = args?.type;
resourceInputs["policyVersion"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ServerlessSecurityPolicy.__pulumiType, name, resourceInputs, opts);
}
}
exports.ServerlessSecurityPolicy = ServerlessSecurityPolicy;
/** @internal */
ServerlessSecurityPolicy.__pulumiType = 'aws:opensearch/serverlessSecurityPolicy:ServerlessSecurityPolicy';
//# sourceMappingURL=serverlessSecurityPolicy.js.map