@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
282 lines • 10.7 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.VpcEndpoint = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a VPC Endpoint resource.
*
* > **NOTE on VPC Endpoints and VPC Endpoint Associations:** The provider provides both standalone VPC Endpoint Associations for
* Route Tables - (an association between a VPC endpoint and a single `routeTableId`),
* Security Groups - (an association between a VPC endpoint and a single `securityGroupId`),
* and Subnets - (an association between a VPC endpoint and a single `subnetId`) and
* a VPC Endpoint resource with `routeTableIds` and `subnetIds` attributes.
* Do not use the same resource ID in both a VPC Endpoint resource and a VPC Endpoint Association resource.
* Doing so will cause a conflict of associations and will overwrite the association.
*
* ## Example Usage
*
* ### Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const s3 = new aws.ec2.VpcEndpoint("s3", {
* vpcId: main.id,
* serviceName: "com.amazonaws.us-west-2.s3",
* });
* ```
*
* ### Basic w/ Tags
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const s3 = new aws.ec2.VpcEndpoint("s3", {
* vpcId: main.id,
* serviceName: "com.amazonaws.us-west-2.s3",
* tags: {
* Environment: "test",
* },
* });
* ```
*
* ### Interface Endpoint Type
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const ec2 = new aws.ec2.VpcEndpoint("ec2", {
* vpcId: main.id,
* serviceName: "com.amazonaws.us-west-2.ec2",
* vpcEndpointType: "Interface",
* securityGroupIds: [sg1.id],
* privateDnsEnabled: true,
* });
* ```
*
* ### Interface Endpoint Type with User-Defined IP Address
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const ec2 = new aws.ec2.VpcEndpoint("ec2", {
* vpcId: example.id,
* serviceName: "com.amazonaws.us-west-2.ec2",
* vpcEndpointType: "Interface",
* subnetConfigurations: [
* {
* ipv4: "10.0.1.10",
* subnetId: example1.id,
* },
* {
* ipv4: "10.0.2.10",
* subnetId: example2.id,
* },
* ],
* subnetIds: [
* example1.id,
* example2.id,
* ],
* });
* ```
*
* ### Gateway Load Balancer Endpoint Type
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const current = aws.getCallerIdentity({});
* const example = new aws.ec2.VpcEndpointService("example", {
* acceptanceRequired: false,
* allowedPrincipals: [current.then(current => current.arn)],
* gatewayLoadBalancerArns: [exampleAwsLb.arn],
* });
* const exampleVpcEndpoint = new aws.ec2.VpcEndpoint("example", {
* serviceName: example.serviceName,
* subnetIds: [exampleAwsSubnet.id],
* vpcEndpointType: example.serviceType,
* vpcId: exampleAwsVpc.id,
* });
* ```
*
* ### VPC Lattice Resource Configuration Endpoint Type
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.ec2.VpcEndpoint("example", {
* resourceConfigurationArn: exampleAwsVpclatticeResourceConfiguration.arn,
* subnetIds: [exampleAwsSubnet.id],
* vpcEndpointType: "Resource",
* vpcId: exampleAwsVpc.id,
* });
* ```
*
* ### VPC Lattice Service Network Endpoint Type
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.ec2.VpcEndpoint("example", {
* serviceNetworkArn: exampleAwsVpclatticeServiceNetwork.arn,
* subnetIds: [exampleAwsSubnet.id],
* vpcEndpointType: "ServiceNetwork",
* vpcId: exampleAwsVpc.id,
* });
* ```
*
* ### Non-AWS Service
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const ptfeService = new aws.ec2.VpcEndpoint("ptfe_service", {
* vpcId: vpcId,
* serviceName: ptfeServiceConfig,
* vpcEndpointType: "Interface",
* securityGroupIds: [ptfeServiceAwsSecurityGroup.id],
* subnetIds: [subnetIds],
* privateDnsEnabled: false,
* });
* const internal = aws.route53.getZone({
* name: "vpc.internal.",
* privateZone: true,
* vpcId: vpcId,
* });
* const ptfeServiceRecord = new aws.route53.Record("ptfe_service", {
* zoneId: internal.then(internal => internal.zoneId),
* name: internal.then(internal => `ptfe.${internal.name}`),
* type: aws.route53.RecordType.CNAME,
* ttl: 300,
* records: [ptfeService.dnsEntries[0].dns_name],
* });
* ```
*
* > **NOTE The `dnsEntry` output is a list of maps:** This provider interpolation support for lists of maps requires the `lookup` and `[]` until full support of lists of maps is available
*
* ## Import
*
* ### Identity Schema
*
* #### Required
*
* * `id` - (String) ID of the VPC endpoint.
*
* #### Optional
*
* * `account_id` (String) AWS Account where this resource is managed.
*
* * `region` (String) Region where this resource is managed.
*
* Using `pulumi import`, import VPC Endpoints using the VPC endpoint `id`. For example:
*
* console
*
* % pulumi import aws_vpc_endpoint.example vpce-3ecf2a57
*/
class VpcEndpoint extends pulumi.CustomResource {
/**
* Get an existing VpcEndpoint 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 VpcEndpoint(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of VpcEndpoint. 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'] === VpcEndpoint.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state?.arn;
resourceInputs["autoAccept"] = state?.autoAccept;
resourceInputs["cidrBlocks"] = state?.cidrBlocks;
resourceInputs["dnsEntries"] = state?.dnsEntries;
resourceInputs["dnsOptions"] = state?.dnsOptions;
resourceInputs["ipAddressType"] = state?.ipAddressType;
resourceInputs["networkInterfaceIds"] = state?.networkInterfaceIds;
resourceInputs["ownerId"] = state?.ownerId;
resourceInputs["policy"] = state?.policy;
resourceInputs["prefixListId"] = state?.prefixListId;
resourceInputs["privateDnsEnabled"] = state?.privateDnsEnabled;
resourceInputs["region"] = state?.region;
resourceInputs["requesterManaged"] = state?.requesterManaged;
resourceInputs["resourceConfigurationArn"] = state?.resourceConfigurationArn;
resourceInputs["routeTableIds"] = state?.routeTableIds;
resourceInputs["securityGroupIds"] = state?.securityGroupIds;
resourceInputs["serviceName"] = state?.serviceName;
resourceInputs["serviceNetworkArn"] = state?.serviceNetworkArn;
resourceInputs["serviceRegion"] = state?.serviceRegion;
resourceInputs["state"] = state?.state;
resourceInputs["subnetConfigurations"] = state?.subnetConfigurations;
resourceInputs["subnetIds"] = state?.subnetIds;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
resourceInputs["vpcEndpointType"] = state?.vpcEndpointType;
resourceInputs["vpcId"] = state?.vpcId;
}
else {
const args = argsOrState;
if (args?.vpcId === undefined && !opts.urn) {
throw new Error("Missing required property 'vpcId'");
}
resourceInputs["autoAccept"] = args?.autoAccept;
resourceInputs["dnsOptions"] = args?.dnsOptions;
resourceInputs["ipAddressType"] = args?.ipAddressType;
resourceInputs["policy"] = args?.policy;
resourceInputs["privateDnsEnabled"] = args?.privateDnsEnabled;
resourceInputs["region"] = args?.region;
resourceInputs["resourceConfigurationArn"] = args?.resourceConfigurationArn;
resourceInputs["routeTableIds"] = args?.routeTableIds;
resourceInputs["securityGroupIds"] = args?.securityGroupIds;
resourceInputs["serviceName"] = args?.serviceName;
resourceInputs["serviceNetworkArn"] = args?.serviceNetworkArn;
resourceInputs["serviceRegion"] = args?.serviceRegion;
resourceInputs["subnetConfigurations"] = args?.subnetConfigurations;
resourceInputs["subnetIds"] = args?.subnetIds;
resourceInputs["tags"] = args?.tags;
resourceInputs["vpcEndpointType"] = args?.vpcEndpointType;
resourceInputs["vpcId"] = args?.vpcId;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["cidrBlocks"] = undefined /*out*/;
resourceInputs["dnsEntries"] = undefined /*out*/;
resourceInputs["networkInterfaceIds"] = undefined /*out*/;
resourceInputs["ownerId"] = undefined /*out*/;
resourceInputs["prefixListId"] = undefined /*out*/;
resourceInputs["requesterManaged"] = undefined /*out*/;
resourceInputs["state"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(VpcEndpoint.__pulumiType, name, resourceInputs, opts);
}
}
exports.VpcEndpoint = VpcEndpoint;
/** @internal */
VpcEndpoint.__pulumiType = 'aws:ec2/vpcEndpoint:VpcEndpoint';
//# sourceMappingURL=vpcEndpoint.js.map