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.VpnGatewayresource can also automatically attach the Virtual Private Gateway it creates to an existing VPC by setting thevpc_idattribute 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/v2/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v2/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("vpn_attachment", {
vpcId: network.id,
vpnGatewayId: vpn.id,
});Create a VpnGatewayAttachment Resource
new VpnGatewayAttachment(name: string, args: VpnGatewayAttachmentArgs, opts?: CustomResourceOptions);def VpnGatewayAttachment(resource_name, opts=None, vpc_id=None, vpn_gateway_id=None, __props__=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.
- opts ResourceOptions
- A bag of options that control this 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:
- Vpc
Id string The ID of the VPC.
- Vpn
Gateway stringId The ID of the Virtual Private Gateway.
- Vpc
Id string The ID of the VPC.
- Vpn
Gateway stringId The ID of the Virtual Private Gateway.
- vpc
Id string The ID of the VPC.
- vpn
Gateway stringId The ID of the Virtual Private Gateway.
- vpc_
id str The ID of the VPC.
- vpn_
gateway_ strid 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:
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): VpnGatewayAttachmentstatic get(resource_name, id, opts=None, vpc_id=None, vpn_gateway_id=None, __props__=None);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:
- Vpc
Id string The ID of the VPC.
- Vpn
Gateway stringId The ID of the Virtual Private Gateway.
- Vpc
Id string The ID of the VPC.
- Vpn
Gateway stringId The ID of the Virtual Private Gateway.
- vpc
Id string The ID of the VPC.
- vpn
Gateway stringId The ID of the Virtual Private Gateway.
- vpc_
id str The ID of the VPC.
- vpn_
gateway_ strid The ID of the Virtual Private Gateway.
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.