github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2/vpnGatewayAttachment.go (about) 1 // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package ec2 5 6 import ( 7 "context" 8 "reflect" 9 10 "errors" 11 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // Provides a Virtual Private Gateway attachment resource, allowing for an existing 16 // hardware VPN gateway to be attached and/or detached from a VPC. 17 // 18 // > **Note:** The `ec2.VpnGateway` 19 // resource can also automatically attach the Virtual Private Gateway it creates 20 // to an existing VPC by setting the `vpcId` attribute accordingly. 21 // 22 // ## Example Usage 23 // 24 // <!--Start PulumiCodeChooser --> 25 // ```go 26 // package main 27 // 28 // import ( 29 // 30 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2" 31 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 32 // 33 // ) 34 // 35 // func main() { 36 // pulumi.Run(func(ctx *pulumi.Context) error { 37 // network, err := ec2.NewVpc(ctx, "network", &ec2.VpcArgs{ 38 // CidrBlock: pulumi.String("10.0.0.0/16"), 39 // }) 40 // if err != nil { 41 // return err 42 // } 43 // vpn, err := ec2.NewVpnGateway(ctx, "vpn", &ec2.VpnGatewayArgs{ 44 // Tags: pulumi.StringMap{ 45 // "Name": pulumi.String("example-vpn-gateway"), 46 // }, 47 // }) 48 // if err != nil { 49 // return err 50 // } 51 // _, err = ec2.NewVpnGatewayAttachment(ctx, "vpn_attachment", &ec2.VpnGatewayAttachmentArgs{ 52 // VpcId: network.ID(), 53 // VpnGatewayId: vpn.ID(), 54 // }) 55 // if err != nil { 56 // return err 57 // } 58 // return nil 59 // }) 60 // } 61 // 62 // ``` 63 // <!--End PulumiCodeChooser --> 64 // 65 // See [Virtual Private Cloud](http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Introduction.html) 66 // and [Virtual Private Gateway](http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html) user 67 // guides for more information. 68 // 69 // ## Import 70 // 71 // You cannot import this resource. 72 type VpnGatewayAttachment struct { 73 pulumi.CustomResourceState 74 75 // The ID of the VPC. 76 VpcId pulumi.StringOutput `pulumi:"vpcId"` 77 // The ID of the Virtual Private Gateway. 78 VpnGatewayId pulumi.StringOutput `pulumi:"vpnGatewayId"` 79 } 80 81 // NewVpnGatewayAttachment registers a new resource with the given unique name, arguments, and options. 82 func NewVpnGatewayAttachment(ctx *pulumi.Context, 83 name string, args *VpnGatewayAttachmentArgs, opts ...pulumi.ResourceOption) (*VpnGatewayAttachment, error) { 84 if args == nil { 85 return nil, errors.New("missing one or more required arguments") 86 } 87 88 if args.VpcId == nil { 89 return nil, errors.New("invalid value for required argument 'VpcId'") 90 } 91 if args.VpnGatewayId == nil { 92 return nil, errors.New("invalid value for required argument 'VpnGatewayId'") 93 } 94 opts = internal.PkgResourceDefaultOpts(opts) 95 var resource VpnGatewayAttachment 96 err := ctx.RegisterResource("aws:ec2/vpnGatewayAttachment:VpnGatewayAttachment", name, args, &resource, opts...) 97 if err != nil { 98 return nil, err 99 } 100 return &resource, nil 101 } 102 103 // GetVpnGatewayAttachment gets an existing VpnGatewayAttachment resource's state with the given name, ID, and optional 104 // state properties that are used to uniquely qualify the lookup (nil if not required). 105 func GetVpnGatewayAttachment(ctx *pulumi.Context, 106 name string, id pulumi.IDInput, state *VpnGatewayAttachmentState, opts ...pulumi.ResourceOption) (*VpnGatewayAttachment, error) { 107 var resource VpnGatewayAttachment 108 err := ctx.ReadResource("aws:ec2/vpnGatewayAttachment:VpnGatewayAttachment", name, id, state, &resource, opts...) 109 if err != nil { 110 return nil, err 111 } 112 return &resource, nil 113 } 114 115 // Input properties used for looking up and filtering VpnGatewayAttachment resources. 116 type vpnGatewayAttachmentState struct { 117 // The ID of the VPC. 118 VpcId *string `pulumi:"vpcId"` 119 // The ID of the Virtual Private Gateway. 120 VpnGatewayId *string `pulumi:"vpnGatewayId"` 121 } 122 123 type VpnGatewayAttachmentState struct { 124 // The ID of the VPC. 125 VpcId pulumi.StringPtrInput 126 // The ID of the Virtual Private Gateway. 127 VpnGatewayId pulumi.StringPtrInput 128 } 129 130 func (VpnGatewayAttachmentState) ElementType() reflect.Type { 131 return reflect.TypeOf((*vpnGatewayAttachmentState)(nil)).Elem() 132 } 133 134 type vpnGatewayAttachmentArgs struct { 135 // The ID of the VPC. 136 VpcId string `pulumi:"vpcId"` 137 // The ID of the Virtual Private Gateway. 138 VpnGatewayId string `pulumi:"vpnGatewayId"` 139 } 140 141 // The set of arguments for constructing a VpnGatewayAttachment resource. 142 type VpnGatewayAttachmentArgs struct { 143 // The ID of the VPC. 144 VpcId pulumi.StringInput 145 // The ID of the Virtual Private Gateway. 146 VpnGatewayId pulumi.StringInput 147 } 148 149 func (VpnGatewayAttachmentArgs) ElementType() reflect.Type { 150 return reflect.TypeOf((*vpnGatewayAttachmentArgs)(nil)).Elem() 151 } 152 153 type VpnGatewayAttachmentInput interface { 154 pulumi.Input 155 156 ToVpnGatewayAttachmentOutput() VpnGatewayAttachmentOutput 157 ToVpnGatewayAttachmentOutputWithContext(ctx context.Context) VpnGatewayAttachmentOutput 158 } 159 160 func (*VpnGatewayAttachment) ElementType() reflect.Type { 161 return reflect.TypeOf((**VpnGatewayAttachment)(nil)).Elem() 162 } 163 164 func (i *VpnGatewayAttachment) ToVpnGatewayAttachmentOutput() VpnGatewayAttachmentOutput { 165 return i.ToVpnGatewayAttachmentOutputWithContext(context.Background()) 166 } 167 168 func (i *VpnGatewayAttachment) ToVpnGatewayAttachmentOutputWithContext(ctx context.Context) VpnGatewayAttachmentOutput { 169 return pulumi.ToOutputWithContext(ctx, i).(VpnGatewayAttachmentOutput) 170 } 171 172 // VpnGatewayAttachmentArrayInput is an input type that accepts VpnGatewayAttachmentArray and VpnGatewayAttachmentArrayOutput values. 173 // You can construct a concrete instance of `VpnGatewayAttachmentArrayInput` via: 174 // 175 // VpnGatewayAttachmentArray{ VpnGatewayAttachmentArgs{...} } 176 type VpnGatewayAttachmentArrayInput interface { 177 pulumi.Input 178 179 ToVpnGatewayAttachmentArrayOutput() VpnGatewayAttachmentArrayOutput 180 ToVpnGatewayAttachmentArrayOutputWithContext(context.Context) VpnGatewayAttachmentArrayOutput 181 } 182 183 type VpnGatewayAttachmentArray []VpnGatewayAttachmentInput 184 185 func (VpnGatewayAttachmentArray) ElementType() reflect.Type { 186 return reflect.TypeOf((*[]*VpnGatewayAttachment)(nil)).Elem() 187 } 188 189 func (i VpnGatewayAttachmentArray) ToVpnGatewayAttachmentArrayOutput() VpnGatewayAttachmentArrayOutput { 190 return i.ToVpnGatewayAttachmentArrayOutputWithContext(context.Background()) 191 } 192 193 func (i VpnGatewayAttachmentArray) ToVpnGatewayAttachmentArrayOutputWithContext(ctx context.Context) VpnGatewayAttachmentArrayOutput { 194 return pulumi.ToOutputWithContext(ctx, i).(VpnGatewayAttachmentArrayOutput) 195 } 196 197 // VpnGatewayAttachmentMapInput is an input type that accepts VpnGatewayAttachmentMap and VpnGatewayAttachmentMapOutput values. 198 // You can construct a concrete instance of `VpnGatewayAttachmentMapInput` via: 199 // 200 // VpnGatewayAttachmentMap{ "key": VpnGatewayAttachmentArgs{...} } 201 type VpnGatewayAttachmentMapInput interface { 202 pulumi.Input 203 204 ToVpnGatewayAttachmentMapOutput() VpnGatewayAttachmentMapOutput 205 ToVpnGatewayAttachmentMapOutputWithContext(context.Context) VpnGatewayAttachmentMapOutput 206 } 207 208 type VpnGatewayAttachmentMap map[string]VpnGatewayAttachmentInput 209 210 func (VpnGatewayAttachmentMap) ElementType() reflect.Type { 211 return reflect.TypeOf((*map[string]*VpnGatewayAttachment)(nil)).Elem() 212 } 213 214 func (i VpnGatewayAttachmentMap) ToVpnGatewayAttachmentMapOutput() VpnGatewayAttachmentMapOutput { 215 return i.ToVpnGatewayAttachmentMapOutputWithContext(context.Background()) 216 } 217 218 func (i VpnGatewayAttachmentMap) ToVpnGatewayAttachmentMapOutputWithContext(ctx context.Context) VpnGatewayAttachmentMapOutput { 219 return pulumi.ToOutputWithContext(ctx, i).(VpnGatewayAttachmentMapOutput) 220 } 221 222 type VpnGatewayAttachmentOutput struct{ *pulumi.OutputState } 223 224 func (VpnGatewayAttachmentOutput) ElementType() reflect.Type { 225 return reflect.TypeOf((**VpnGatewayAttachment)(nil)).Elem() 226 } 227 228 func (o VpnGatewayAttachmentOutput) ToVpnGatewayAttachmentOutput() VpnGatewayAttachmentOutput { 229 return o 230 } 231 232 func (o VpnGatewayAttachmentOutput) ToVpnGatewayAttachmentOutputWithContext(ctx context.Context) VpnGatewayAttachmentOutput { 233 return o 234 } 235 236 // The ID of the VPC. 237 func (o VpnGatewayAttachmentOutput) VpcId() pulumi.StringOutput { 238 return o.ApplyT(func(v *VpnGatewayAttachment) pulumi.StringOutput { return v.VpcId }).(pulumi.StringOutput) 239 } 240 241 // The ID of the Virtual Private Gateway. 242 func (o VpnGatewayAttachmentOutput) VpnGatewayId() pulumi.StringOutput { 243 return o.ApplyT(func(v *VpnGatewayAttachment) pulumi.StringOutput { return v.VpnGatewayId }).(pulumi.StringOutput) 244 } 245 246 type VpnGatewayAttachmentArrayOutput struct{ *pulumi.OutputState } 247 248 func (VpnGatewayAttachmentArrayOutput) ElementType() reflect.Type { 249 return reflect.TypeOf((*[]*VpnGatewayAttachment)(nil)).Elem() 250 } 251 252 func (o VpnGatewayAttachmentArrayOutput) ToVpnGatewayAttachmentArrayOutput() VpnGatewayAttachmentArrayOutput { 253 return o 254 } 255 256 func (o VpnGatewayAttachmentArrayOutput) ToVpnGatewayAttachmentArrayOutputWithContext(ctx context.Context) VpnGatewayAttachmentArrayOutput { 257 return o 258 } 259 260 func (o VpnGatewayAttachmentArrayOutput) Index(i pulumi.IntInput) VpnGatewayAttachmentOutput { 261 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *VpnGatewayAttachment { 262 return vs[0].([]*VpnGatewayAttachment)[vs[1].(int)] 263 }).(VpnGatewayAttachmentOutput) 264 } 265 266 type VpnGatewayAttachmentMapOutput struct{ *pulumi.OutputState } 267 268 func (VpnGatewayAttachmentMapOutput) ElementType() reflect.Type { 269 return reflect.TypeOf((*map[string]*VpnGatewayAttachment)(nil)).Elem() 270 } 271 272 func (o VpnGatewayAttachmentMapOutput) ToVpnGatewayAttachmentMapOutput() VpnGatewayAttachmentMapOutput { 273 return o 274 } 275 276 func (o VpnGatewayAttachmentMapOutput) ToVpnGatewayAttachmentMapOutputWithContext(ctx context.Context) VpnGatewayAttachmentMapOutput { 277 return o 278 } 279 280 func (o VpnGatewayAttachmentMapOutput) MapIndex(k pulumi.StringInput) VpnGatewayAttachmentOutput { 281 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *VpnGatewayAttachment { 282 return vs[0].(map[string]*VpnGatewayAttachment)[vs[1].(string)] 283 }).(VpnGatewayAttachmentOutput) 284 } 285 286 func init() { 287 pulumi.RegisterInputType(reflect.TypeOf((*VpnGatewayAttachmentInput)(nil)).Elem(), &VpnGatewayAttachment{}) 288 pulumi.RegisterInputType(reflect.TypeOf((*VpnGatewayAttachmentArrayInput)(nil)).Elem(), VpnGatewayAttachmentArray{}) 289 pulumi.RegisterInputType(reflect.TypeOf((*VpnGatewayAttachmentMapInput)(nil)).Elem(), VpnGatewayAttachmentMap{}) 290 pulumi.RegisterOutputType(VpnGatewayAttachmentOutput{}) 291 pulumi.RegisterOutputType(VpnGatewayAttachmentArrayOutput{}) 292 pulumi.RegisterOutputType(VpnGatewayAttachmentMapOutput{}) 293 }