UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

92 lines 4.16 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.SecurityGroupAssociation = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a resource to create an association between a VPC endpoint and a security group. * * > **NOTE on VPC Endpoints and VPC Endpoint Security Group Associations:** The provider provides * both a standalone VPC Endpoint Security Group Association (an association between a VPC endpoint * and a single `securityGroupId`) and a VPC Endpoint resource with a `securityGroupIds` * attribute. Do not use the same security group ID in both a VPC Endpoint resource and a VPC Endpoint Security * Group Association resource. Doing so will cause a conflict of associations and will overwrite the association. * * ## Example Usage * * Basic usage: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const sgEc2 = new aws.ec2.SecurityGroupAssociation("sg_ec2", { * vpcEndpointId: ec2.id, * securityGroupId: sg.id, * }); * ``` * * ## Import * * Using `pulumi import`, import VPC Endpoint Security Group Associations using `vpc_endpoint_id` together with `security_group_id`. For example: * * ```sh * $ pulumi import aws:ec2/securityGroupAssociation:SecurityGroupAssociation example vpce-aaaaaaaa/sg-bbbbbbbbbbbbbbbbb * ``` */ class SecurityGroupAssociation extends pulumi.CustomResource { /** * Get an existing SecurityGroupAssociation 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 SecurityGroupAssociation(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of SecurityGroupAssociation. 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'] === SecurityGroupAssociation.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["region"] = state?.region; resourceInputs["replaceDefaultAssociation"] = state?.replaceDefaultAssociation; resourceInputs["securityGroupId"] = state?.securityGroupId; resourceInputs["vpcEndpointId"] = state?.vpcEndpointId; } else { const args = argsOrState; if (args?.securityGroupId === undefined && !opts.urn) { throw new Error("Missing required property 'securityGroupId'"); } if (args?.vpcEndpointId === undefined && !opts.urn) { throw new Error("Missing required property 'vpcEndpointId'"); } resourceInputs["region"] = args?.region; resourceInputs["replaceDefaultAssociation"] = args?.replaceDefaultAssociation; resourceInputs["securityGroupId"] = args?.securityGroupId; resourceInputs["vpcEndpointId"] = args?.vpcEndpointId; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(SecurityGroupAssociation.__pulumiType, name, resourceInputs, opts); } } exports.SecurityGroupAssociation = SecurityGroupAssociation; /** @internal */ SecurityGroupAssociation.__pulumiType = 'aws:ec2/securityGroupAssociation:SecurityGroupAssociation'; //# sourceMappingURL=securityGroupAssociation.js.map