VpnGatewayAttachment

Provides a Virtual Private Gateway attachment resource, allowing for an existing hardware VPN gateway to be attached and/or detached from a VPC.

Note: The aws.ec2.VpnGateway resource can also automatically attach the Virtual Private Gateway it creates to an existing VPC by setting the vpc_id attribute accordingly.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var network = new Aws.Ec2.Vpc("network", new Aws.Ec2.VpcArgs
        {
            CidrBlock = "10.0.0.0/16",
        });
        var vpn = new Aws.Ec2.VpnGateway("vpn", new Aws.Ec2.VpnGatewayArgs
        {
            Tags = 
            {
                { "Name", "example-vpn-gateway" },
            },
        });
        var vpnAttachment = new Aws.Ec2.VpnGatewayAttachment("vpnAttachment", new Aws.Ec2.VpnGatewayAttachmentArgs
        {
            VpcId = network.Id,
            VpnGatewayId = vpn.Id,
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		network, err := ec2.NewVpc(ctx, "network", &ec2.VpcArgs{
			CidrBlock: pulumi.String("10.0.0.0/16"),
		})
		if err != nil {
			return err
		}
		vpn, err := ec2.NewVpnGateway(ctx, "vpn", &ec2.VpnGatewayArgs{
			Tags: pulumi.StringMap{
				"Name": pulumi.String("example-vpn-gateway"),
			},
		})
		if err != nil {
			return err
		}
		_, err = ec2.NewVpnGatewayAttachment(ctx, "vpnAttachment", &ec2.VpnGatewayAttachmentArgs{
			VpcId:        network.ID(),
			VpnGatewayId: vpn.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_aws as aws

network = aws.ec2.Vpc("network", cidr_block="10.0.0.0/16")
vpn = aws.ec2.VpnGateway("vpn", tags={
    "Name": "example-vpn-gateway",
})
vpn_attachment = aws.ec2.VpnGatewayAttachment("vpnAttachment",
    vpc_id=network.id,
    vpn_gateway_id=vpn.id)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const network = new aws.ec2.Vpc("network", {cidrBlock: "10.0.0.0/16"});
const vpn = new aws.ec2.VpnGateway("vpn", {tags: {
    Name: "example-vpn-gateway",
}});
const vpnAttachment = new aws.ec2.VpnGatewayAttachment("vpnAttachment", {
    vpcId: network.id,
    vpnGatewayId: vpn.id,
});

Create a VpnGatewayAttachment Resource

new VpnGatewayAttachment(name: string, args: VpnGatewayAttachmentArgs, opts?: CustomResourceOptions);
@overload
def VpnGatewayAttachment(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         vpc_id: Optional[str] = None,
                         vpn_gateway_id: Optional[str] = None)
@overload
def VpnGatewayAttachment(resource_name: str,
                         args: VpnGatewayAttachmentArgs,
                         opts: Optional[ResourceOptions] = None)
func NewVpnGatewayAttachment(ctx *Context, name string, args VpnGatewayAttachmentArgs, opts ...ResourceOption) (*VpnGatewayAttachment, error)
public VpnGatewayAttachment(string name, VpnGatewayAttachmentArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args VpnGatewayAttachmentArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args VpnGatewayAttachmentArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args VpnGatewayAttachmentArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args VpnGatewayAttachmentArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

VpnGatewayAttachment Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The VpnGatewayAttachment resource accepts the following input properties:

VpcId string
The ID of the VPC.
VpnGatewayId string
The ID of the Virtual Private Gateway.
VpcId string
The ID of the VPC.
VpnGatewayId string
The ID of the Virtual Private Gateway.
vpcId string
The ID of the VPC.
vpnGatewayId string
The ID of the Virtual Private Gateway.
vpc_id str
The ID of the VPC.
vpn_gateway_id str
The ID of the Virtual Private Gateway.

Outputs

All input properties are implicitly available as output properties. Additionally, the VpnGatewayAttachment resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing VpnGatewayAttachment Resource

Get an existing VpnGatewayAttachment resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: VpnGatewayAttachmentState, opts?: CustomResourceOptions): VpnGatewayAttachment
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        vpc_id: Optional[str] = None,
        vpn_gateway_id: Optional[str] = None) -> VpnGatewayAttachment
func GetVpnGatewayAttachment(ctx *Context, name string, id IDInput, state *VpnGatewayAttachmentState, opts ...ResourceOption) (*VpnGatewayAttachment, error)
public static VpnGatewayAttachment Get(string name, Input<string> id, VpnGatewayAttachmentState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

VpcId string
The ID of the VPC.
VpnGatewayId string
The ID of the Virtual Private Gateway.
VpcId string
The ID of the VPC.
VpnGatewayId string
The ID of the Virtual Private Gateway.
vpcId string
The ID of the VPC.
vpnGatewayId string
The ID of the Virtual Private Gateway.
vpc_id str
The ID of the VPC.
vpn_gateway_id str
The ID of the Virtual Private Gateway.

Import

This resource does not support importing.

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.