@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
306 lines • 18.8 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.VpnConnection = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages a Site-to-Site VPN connection. A Site-to-Site VPN connection is an Internet Protocol security (IPsec) VPN connection between a VPC and an on-premises network.
* Any new Site-to-Site VPN connection that you create is an [AWS VPN connection](https://docs.aws.amazon.com/vpn/latest/s2svpn/vpn-categories.html).
*
* > **Note:** The CIDR blocks in the arguments `tunnel1InsideCidr` and `tunnel2InsideCidr` must have a prefix of /30 and be a part of a specific range.
* [Read more about this in the AWS documentation](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_VpnTunnelOptionsSpecification.html).
*
* ## Example Usage
*
* ### EC2 Transit Gateway
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.ec2transitgateway.TransitGateway("example", {});
* const exampleCustomerGateway = new aws.ec2.CustomerGateway("example", {
* bgpAsn: "65000",
* ipAddress: "172.0.0.1",
* type: "ipsec.1",
* });
* const exampleVpnConnection = new aws.ec2.VpnConnection("example", {
* customerGatewayId: exampleCustomerGateway.id,
* transitGatewayId: example.id,
* type: exampleCustomerGateway.type,
* });
* ```
*
* ### Virtual Private Gateway
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const vpc = new aws.ec2.Vpc("vpc", {cidrBlock: "10.0.0.0/16"});
* const vpnGateway = new aws.ec2.VpnGateway("vpn_gateway", {vpcId: vpc.id});
* const customerGateway = new aws.ec2.CustomerGateway("customer_gateway", {
* bgpAsn: "65000",
* ipAddress: "172.0.0.1",
* type: "ipsec.1",
* });
* const main = new aws.ec2.VpnConnection("main", {
* vpnGatewayId: vpnGateway.id,
* customerGatewayId: customerGateway.id,
* type: "ipsec.1",
* staticRoutesOnly: true,
* });
* ```
*
* ### AWS Site to Site Private VPN
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const exampleGateway = new aws.directconnect.Gateway("example", {
* name: "example_ipsec_vpn_example",
* amazonSideAsn: "64512",
* });
* const exampleTransitGateway = new aws.ec2transitgateway.TransitGateway("example", {
* amazonSideAsn: 64513,
* description: "example_ipsec_vpn_example",
* transitGatewayCidrBlocks: ["10.0.0.0/24"],
* });
* const exampleCustomerGateway = new aws.ec2.CustomerGateway("example", {
* bgpAsn: "64514",
* ipAddress: "10.0.0.1",
* type: "ipsec.1",
* tags: {
* Name: "example_ipsec_vpn_example",
* },
* });
* const exampleGatewayAssociation = new aws.directconnect.GatewayAssociation("example", {
* dxGatewayId: exampleGateway.id,
* associatedGatewayId: exampleTransitGateway.id,
* allowedPrefixes: ["10.0.0.0/8"],
* });
* const example = aws.ec2transitgateway.getDirectConnectGatewayAttachmentOutput({
* transitGatewayId: exampleTransitGateway.id,
* dxGatewayId: exampleGateway.id,
* });
* const exampleVpnConnection = new aws.ec2.VpnConnection("example", {
* customerGatewayId: exampleCustomerGateway.id,
* outsideIpAddressType: "PrivateIpv4",
* transitGatewayId: exampleTransitGateway.id,
* transportTransitGatewayAttachmentId: example.apply(example => example.id),
* type: "ipsec.1",
* tags: {
* Name: "example_ipsec_vpn_example",
* },
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import VPN Connections using the VPN connection `id`. For example:
*
* ```sh
* $ pulumi import aws:ec2/vpnConnection:VpnConnection testvpnconnection vpn-40f41529
* ```
*/
class VpnConnection extends pulumi.CustomResource {
/**
* Get an existing VpnConnection 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 VpnConnection(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of VpnConnection. 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'] === VpnConnection.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state?.arn;
resourceInputs["coreNetworkArn"] = state?.coreNetworkArn;
resourceInputs["coreNetworkAttachmentArn"] = state?.coreNetworkAttachmentArn;
resourceInputs["customerGatewayConfiguration"] = state?.customerGatewayConfiguration;
resourceInputs["customerGatewayId"] = state?.customerGatewayId;
resourceInputs["enableAcceleration"] = state?.enableAcceleration;
resourceInputs["localIpv4NetworkCidr"] = state?.localIpv4NetworkCidr;
resourceInputs["localIpv6NetworkCidr"] = state?.localIpv6NetworkCidr;
resourceInputs["outsideIpAddressType"] = state?.outsideIpAddressType;
resourceInputs["presharedKeyArn"] = state?.presharedKeyArn;
resourceInputs["presharedKeyStorage"] = state?.presharedKeyStorage;
resourceInputs["region"] = state?.region;
resourceInputs["remoteIpv4NetworkCidr"] = state?.remoteIpv4NetworkCidr;
resourceInputs["remoteIpv6NetworkCidr"] = state?.remoteIpv6NetworkCidr;
resourceInputs["routes"] = state?.routes;
resourceInputs["staticRoutesOnly"] = state?.staticRoutesOnly;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
resourceInputs["transitGatewayAttachmentId"] = state?.transitGatewayAttachmentId;
resourceInputs["transitGatewayId"] = state?.transitGatewayId;
resourceInputs["transportTransitGatewayAttachmentId"] = state?.transportTransitGatewayAttachmentId;
resourceInputs["tunnel1Address"] = state?.tunnel1Address;
resourceInputs["tunnel1BgpAsn"] = state?.tunnel1BgpAsn;
resourceInputs["tunnel1BgpHoldtime"] = state?.tunnel1BgpHoldtime;
resourceInputs["tunnel1CgwInsideAddress"] = state?.tunnel1CgwInsideAddress;
resourceInputs["tunnel1DpdTimeoutAction"] = state?.tunnel1DpdTimeoutAction;
resourceInputs["tunnel1DpdTimeoutSeconds"] = state?.tunnel1DpdTimeoutSeconds;
resourceInputs["tunnel1EnableTunnelLifecycleControl"] = state?.tunnel1EnableTunnelLifecycleControl;
resourceInputs["tunnel1IkeVersions"] = state?.tunnel1IkeVersions;
resourceInputs["tunnel1InsideCidr"] = state?.tunnel1InsideCidr;
resourceInputs["tunnel1InsideIpv6Cidr"] = state?.tunnel1InsideIpv6Cidr;
resourceInputs["tunnel1LogOptions"] = state?.tunnel1LogOptions;
resourceInputs["tunnel1Phase1DhGroupNumbers"] = state?.tunnel1Phase1DhGroupNumbers;
resourceInputs["tunnel1Phase1EncryptionAlgorithms"] = state?.tunnel1Phase1EncryptionAlgorithms;
resourceInputs["tunnel1Phase1IntegrityAlgorithms"] = state?.tunnel1Phase1IntegrityAlgorithms;
resourceInputs["tunnel1Phase1LifetimeSeconds"] = state?.tunnel1Phase1LifetimeSeconds;
resourceInputs["tunnel1Phase2DhGroupNumbers"] = state?.tunnel1Phase2DhGroupNumbers;
resourceInputs["tunnel1Phase2EncryptionAlgorithms"] = state?.tunnel1Phase2EncryptionAlgorithms;
resourceInputs["tunnel1Phase2IntegrityAlgorithms"] = state?.tunnel1Phase2IntegrityAlgorithms;
resourceInputs["tunnel1Phase2LifetimeSeconds"] = state?.tunnel1Phase2LifetimeSeconds;
resourceInputs["tunnel1PresharedKey"] = state?.tunnel1PresharedKey;
resourceInputs["tunnel1RekeyFuzzPercentage"] = state?.tunnel1RekeyFuzzPercentage;
resourceInputs["tunnel1RekeyMarginTimeSeconds"] = state?.tunnel1RekeyMarginTimeSeconds;
resourceInputs["tunnel1ReplayWindowSize"] = state?.tunnel1ReplayWindowSize;
resourceInputs["tunnel1StartupAction"] = state?.tunnel1StartupAction;
resourceInputs["tunnel1VgwInsideAddress"] = state?.tunnel1VgwInsideAddress;
resourceInputs["tunnel2Address"] = state?.tunnel2Address;
resourceInputs["tunnel2BgpAsn"] = state?.tunnel2BgpAsn;
resourceInputs["tunnel2BgpHoldtime"] = state?.tunnel2BgpHoldtime;
resourceInputs["tunnel2CgwInsideAddress"] = state?.tunnel2CgwInsideAddress;
resourceInputs["tunnel2DpdTimeoutAction"] = state?.tunnel2DpdTimeoutAction;
resourceInputs["tunnel2DpdTimeoutSeconds"] = state?.tunnel2DpdTimeoutSeconds;
resourceInputs["tunnel2EnableTunnelLifecycleControl"] = state?.tunnel2EnableTunnelLifecycleControl;
resourceInputs["tunnel2IkeVersions"] = state?.tunnel2IkeVersions;
resourceInputs["tunnel2InsideCidr"] = state?.tunnel2InsideCidr;
resourceInputs["tunnel2InsideIpv6Cidr"] = state?.tunnel2InsideIpv6Cidr;
resourceInputs["tunnel2LogOptions"] = state?.tunnel2LogOptions;
resourceInputs["tunnel2Phase1DhGroupNumbers"] = state?.tunnel2Phase1DhGroupNumbers;
resourceInputs["tunnel2Phase1EncryptionAlgorithms"] = state?.tunnel2Phase1EncryptionAlgorithms;
resourceInputs["tunnel2Phase1IntegrityAlgorithms"] = state?.tunnel2Phase1IntegrityAlgorithms;
resourceInputs["tunnel2Phase1LifetimeSeconds"] = state?.tunnel2Phase1LifetimeSeconds;
resourceInputs["tunnel2Phase2DhGroupNumbers"] = state?.tunnel2Phase2DhGroupNumbers;
resourceInputs["tunnel2Phase2EncryptionAlgorithms"] = state?.tunnel2Phase2EncryptionAlgorithms;
resourceInputs["tunnel2Phase2IntegrityAlgorithms"] = state?.tunnel2Phase2IntegrityAlgorithms;
resourceInputs["tunnel2Phase2LifetimeSeconds"] = state?.tunnel2Phase2LifetimeSeconds;
resourceInputs["tunnel2PresharedKey"] = state?.tunnel2PresharedKey;
resourceInputs["tunnel2RekeyFuzzPercentage"] = state?.tunnel2RekeyFuzzPercentage;
resourceInputs["tunnel2RekeyMarginTimeSeconds"] = state?.tunnel2RekeyMarginTimeSeconds;
resourceInputs["tunnel2ReplayWindowSize"] = state?.tunnel2ReplayWindowSize;
resourceInputs["tunnel2StartupAction"] = state?.tunnel2StartupAction;
resourceInputs["tunnel2VgwInsideAddress"] = state?.tunnel2VgwInsideAddress;
resourceInputs["tunnelInsideIpVersion"] = state?.tunnelInsideIpVersion;
resourceInputs["type"] = state?.type;
resourceInputs["vgwTelemetries"] = state?.vgwTelemetries;
resourceInputs["vpnGatewayId"] = state?.vpnGatewayId;
}
else {
const args = argsOrState;
if (args?.customerGatewayId === undefined && !opts.urn) {
throw new Error("Missing required property 'customerGatewayId'");
}
if (args?.type === undefined && !opts.urn) {
throw new Error("Missing required property 'type'");
}
resourceInputs["customerGatewayId"] = args?.customerGatewayId;
resourceInputs["enableAcceleration"] = args?.enableAcceleration;
resourceInputs["localIpv4NetworkCidr"] = args?.localIpv4NetworkCidr;
resourceInputs["localIpv6NetworkCidr"] = args?.localIpv6NetworkCidr;
resourceInputs["outsideIpAddressType"] = args?.outsideIpAddressType;
resourceInputs["presharedKeyStorage"] = args?.presharedKeyStorage;
resourceInputs["region"] = args?.region;
resourceInputs["remoteIpv4NetworkCidr"] = args?.remoteIpv4NetworkCidr;
resourceInputs["remoteIpv6NetworkCidr"] = args?.remoteIpv6NetworkCidr;
resourceInputs["staticRoutesOnly"] = args?.staticRoutesOnly;
resourceInputs["tags"] = args?.tags;
resourceInputs["transitGatewayId"] = args?.transitGatewayId;
resourceInputs["transportTransitGatewayAttachmentId"] = args?.transportTransitGatewayAttachmentId;
resourceInputs["tunnel1DpdTimeoutAction"] = args?.tunnel1DpdTimeoutAction;
resourceInputs["tunnel1DpdTimeoutSeconds"] = args?.tunnel1DpdTimeoutSeconds;
resourceInputs["tunnel1EnableTunnelLifecycleControl"] = args?.tunnel1EnableTunnelLifecycleControl;
resourceInputs["tunnel1IkeVersions"] = args?.tunnel1IkeVersions;
resourceInputs["tunnel1InsideCidr"] = args?.tunnel1InsideCidr;
resourceInputs["tunnel1InsideIpv6Cidr"] = args?.tunnel1InsideIpv6Cidr;
resourceInputs["tunnel1LogOptions"] = args?.tunnel1LogOptions;
resourceInputs["tunnel1Phase1DhGroupNumbers"] = args?.tunnel1Phase1DhGroupNumbers;
resourceInputs["tunnel1Phase1EncryptionAlgorithms"] = args?.tunnel1Phase1EncryptionAlgorithms;
resourceInputs["tunnel1Phase1IntegrityAlgorithms"] = args?.tunnel1Phase1IntegrityAlgorithms;
resourceInputs["tunnel1Phase1LifetimeSeconds"] = args?.tunnel1Phase1LifetimeSeconds;
resourceInputs["tunnel1Phase2DhGroupNumbers"] = args?.tunnel1Phase2DhGroupNumbers;
resourceInputs["tunnel1Phase2EncryptionAlgorithms"] = args?.tunnel1Phase2EncryptionAlgorithms;
resourceInputs["tunnel1Phase2IntegrityAlgorithms"] = args?.tunnel1Phase2IntegrityAlgorithms;
resourceInputs["tunnel1Phase2LifetimeSeconds"] = args?.tunnel1Phase2LifetimeSeconds;
resourceInputs["tunnel1PresharedKey"] = args?.tunnel1PresharedKey ? pulumi.secret(args.tunnel1PresharedKey) : undefined;
resourceInputs["tunnel1RekeyFuzzPercentage"] = args?.tunnel1RekeyFuzzPercentage;
resourceInputs["tunnel1RekeyMarginTimeSeconds"] = args?.tunnel1RekeyMarginTimeSeconds;
resourceInputs["tunnel1ReplayWindowSize"] = args?.tunnel1ReplayWindowSize;
resourceInputs["tunnel1StartupAction"] = args?.tunnel1StartupAction;
resourceInputs["tunnel2DpdTimeoutAction"] = args?.tunnel2DpdTimeoutAction;
resourceInputs["tunnel2DpdTimeoutSeconds"] = args?.tunnel2DpdTimeoutSeconds;
resourceInputs["tunnel2EnableTunnelLifecycleControl"] = args?.tunnel2EnableTunnelLifecycleControl;
resourceInputs["tunnel2IkeVersions"] = args?.tunnel2IkeVersions;
resourceInputs["tunnel2InsideCidr"] = args?.tunnel2InsideCidr;
resourceInputs["tunnel2InsideIpv6Cidr"] = args?.tunnel2InsideIpv6Cidr;
resourceInputs["tunnel2LogOptions"] = args?.tunnel2LogOptions;
resourceInputs["tunnel2Phase1DhGroupNumbers"] = args?.tunnel2Phase1DhGroupNumbers;
resourceInputs["tunnel2Phase1EncryptionAlgorithms"] = args?.tunnel2Phase1EncryptionAlgorithms;
resourceInputs["tunnel2Phase1IntegrityAlgorithms"] = args?.tunnel2Phase1IntegrityAlgorithms;
resourceInputs["tunnel2Phase1LifetimeSeconds"] = args?.tunnel2Phase1LifetimeSeconds;
resourceInputs["tunnel2Phase2DhGroupNumbers"] = args?.tunnel2Phase2DhGroupNumbers;
resourceInputs["tunnel2Phase2EncryptionAlgorithms"] = args?.tunnel2Phase2EncryptionAlgorithms;
resourceInputs["tunnel2Phase2IntegrityAlgorithms"] = args?.tunnel2Phase2IntegrityAlgorithms;
resourceInputs["tunnel2Phase2LifetimeSeconds"] = args?.tunnel2Phase2LifetimeSeconds;
resourceInputs["tunnel2PresharedKey"] = args?.tunnel2PresharedKey ? pulumi.secret(args.tunnel2PresharedKey) : undefined;
resourceInputs["tunnel2RekeyFuzzPercentage"] = args?.tunnel2RekeyFuzzPercentage;
resourceInputs["tunnel2RekeyMarginTimeSeconds"] = args?.tunnel2RekeyMarginTimeSeconds;
resourceInputs["tunnel2ReplayWindowSize"] = args?.tunnel2ReplayWindowSize;
resourceInputs["tunnel2StartupAction"] = args?.tunnel2StartupAction;
resourceInputs["tunnelInsideIpVersion"] = args?.tunnelInsideIpVersion;
resourceInputs["type"] = args?.type;
resourceInputs["vpnGatewayId"] = args?.vpnGatewayId;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["coreNetworkArn"] = undefined /*out*/;
resourceInputs["coreNetworkAttachmentArn"] = undefined /*out*/;
resourceInputs["customerGatewayConfiguration"] = undefined /*out*/;
resourceInputs["presharedKeyArn"] = undefined /*out*/;
resourceInputs["routes"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
resourceInputs["transitGatewayAttachmentId"] = undefined /*out*/;
resourceInputs["tunnel1Address"] = undefined /*out*/;
resourceInputs["tunnel1BgpAsn"] = undefined /*out*/;
resourceInputs["tunnel1BgpHoldtime"] = undefined /*out*/;
resourceInputs["tunnel1CgwInsideAddress"] = undefined /*out*/;
resourceInputs["tunnel1VgwInsideAddress"] = undefined /*out*/;
resourceInputs["tunnel2Address"] = undefined /*out*/;
resourceInputs["tunnel2BgpAsn"] = undefined /*out*/;
resourceInputs["tunnel2BgpHoldtime"] = undefined /*out*/;
resourceInputs["tunnel2CgwInsideAddress"] = undefined /*out*/;
resourceInputs["tunnel2VgwInsideAddress"] = undefined /*out*/;
resourceInputs["vgwTelemetries"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["customerGatewayConfiguration", "tunnel1PresharedKey", "tunnel2PresharedKey"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(VpnConnection.__pulumiType, name, resourceInputs, opts);
}
}
exports.VpnConnection = VpnConnection;
/** @internal */
VpnConnection.__pulumiType = 'aws:ec2/vpnConnection:VpnConnection';
//# sourceMappingURL=vpnConnection.js.map