github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2/internetGateway.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 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 11 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 12 ) 13 14 // Provides a resource to create a VPC Internet Gateway. 15 // 16 // ## Example Usage 17 // 18 // <!--Start PulumiCodeChooser --> 19 // ```go 20 // package main 21 // 22 // import ( 23 // 24 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2" 25 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 26 // 27 // ) 28 // 29 // func main() { 30 // pulumi.Run(func(ctx *pulumi.Context) error { 31 // _, err := ec2.NewInternetGateway(ctx, "gw", &ec2.InternetGatewayArgs{ 32 // VpcId: pulumi.Any(main.Id), 33 // Tags: pulumi.StringMap{ 34 // "Name": pulumi.String("main"), 35 // }, 36 // }) 37 // if err != nil { 38 // return err 39 // } 40 // return nil 41 // }) 42 // } 43 // 44 // ``` 45 // <!--End PulumiCodeChooser --> 46 // 47 // ## Import 48 // 49 // Using `pulumi import`, import Internet Gateways using the `id`. For example: 50 // 51 // ```sh 52 // $ pulumi import aws:ec2/internetGateway:InternetGateway gw igw-c0a643a9 53 // ``` 54 type InternetGateway struct { 55 pulumi.CustomResourceState 56 57 // The ARN of the Internet Gateway. 58 Arn pulumi.StringOutput `pulumi:"arn"` 59 // The ID of the AWS account that owns the internet gateway. 60 OwnerId pulumi.StringOutput `pulumi:"ownerId"` 61 // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 62 // 63 // > **Note:** It's recommended to denote that the AWS Instance or Elastic IP depends on the Internet Gateway. For example: 64 // 65 // <!--Start PulumiCodeChooser --> 66 // ```go 67 // package main 68 // 69 // import ( 70 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2" 71 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 72 // ) 73 // 74 // func main() { 75 // pulumi.Run(func(ctx *pulumi.Context) error { 76 // gw, err := ec2.NewInternetGateway(ctx, "gw", &ec2.InternetGatewayArgs{ 77 // VpcId: pulumi.Any(main.Id), 78 // }) 79 // if err != nil { 80 // return err 81 // } 82 // _, err = ec2.NewInstance(ctx, "foo", nil, pulumi.DependsOn([]pulumi.Resource{ 83 // gw, 84 // })) 85 // if err != nil { 86 // return err 87 // } 88 // return nil 89 // }) 90 // } 91 // ``` 92 // <!--End PulumiCodeChooser --> 93 Tags pulumi.StringMapOutput `pulumi:"tags"` 94 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 95 // 96 // Deprecated: Please use `tags` instead. 97 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 98 // The VPC ID to create in. See the ec2.InternetGatewayAttachment resource for an alternate way to attach an Internet Gateway to a VPC. 99 VpcId pulumi.StringOutput `pulumi:"vpcId"` 100 } 101 102 // NewInternetGateway registers a new resource with the given unique name, arguments, and options. 103 func NewInternetGateway(ctx *pulumi.Context, 104 name string, args *InternetGatewayArgs, opts ...pulumi.ResourceOption) (*InternetGateway, error) { 105 if args == nil { 106 args = &InternetGatewayArgs{} 107 } 108 109 opts = internal.PkgResourceDefaultOpts(opts) 110 var resource InternetGateway 111 err := ctx.RegisterResource("aws:ec2/internetGateway:InternetGateway", name, args, &resource, opts...) 112 if err != nil { 113 return nil, err 114 } 115 return &resource, nil 116 } 117 118 // GetInternetGateway gets an existing InternetGateway resource's state with the given name, ID, and optional 119 // state properties that are used to uniquely qualify the lookup (nil if not required). 120 func GetInternetGateway(ctx *pulumi.Context, 121 name string, id pulumi.IDInput, state *InternetGatewayState, opts ...pulumi.ResourceOption) (*InternetGateway, error) { 122 var resource InternetGateway 123 err := ctx.ReadResource("aws:ec2/internetGateway:InternetGateway", name, id, state, &resource, opts...) 124 if err != nil { 125 return nil, err 126 } 127 return &resource, nil 128 } 129 130 // Input properties used for looking up and filtering InternetGateway resources. 131 type internetGatewayState struct { 132 // The ARN of the Internet Gateway. 133 Arn *string `pulumi:"arn"` 134 // The ID of the AWS account that owns the internet gateway. 135 OwnerId *string `pulumi:"ownerId"` 136 // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 137 // 138 // > **Note:** It's recommended to denote that the AWS Instance or Elastic IP depends on the Internet Gateway. For example: 139 // 140 // <!--Start PulumiCodeChooser --> 141 // ```go 142 // package main 143 // 144 // import ( 145 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2" 146 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 147 // ) 148 // 149 // func main() { 150 // pulumi.Run(func(ctx *pulumi.Context) error { 151 // gw, err := ec2.NewInternetGateway(ctx, "gw", &ec2.InternetGatewayArgs{ 152 // VpcId: pulumi.Any(main.Id), 153 // }) 154 // if err != nil { 155 // return err 156 // } 157 // _, err = ec2.NewInstance(ctx, "foo", nil, pulumi.DependsOn([]pulumi.Resource{ 158 // gw, 159 // })) 160 // if err != nil { 161 // return err 162 // } 163 // return nil 164 // }) 165 // } 166 // ``` 167 // <!--End PulumiCodeChooser --> 168 Tags map[string]string `pulumi:"tags"` 169 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 170 // 171 // Deprecated: Please use `tags` instead. 172 TagsAll map[string]string `pulumi:"tagsAll"` 173 // The VPC ID to create in. See the ec2.InternetGatewayAttachment resource for an alternate way to attach an Internet Gateway to a VPC. 174 VpcId *string `pulumi:"vpcId"` 175 } 176 177 type InternetGatewayState struct { 178 // The ARN of the Internet Gateway. 179 Arn pulumi.StringPtrInput 180 // The ID of the AWS account that owns the internet gateway. 181 OwnerId pulumi.StringPtrInput 182 // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 183 // 184 // > **Note:** It's recommended to denote that the AWS Instance or Elastic IP depends on the Internet Gateway. For example: 185 // 186 // <!--Start PulumiCodeChooser --> 187 // ```go 188 // package main 189 // 190 // import ( 191 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2" 192 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 193 // ) 194 // 195 // func main() { 196 // pulumi.Run(func(ctx *pulumi.Context) error { 197 // gw, err := ec2.NewInternetGateway(ctx, "gw", &ec2.InternetGatewayArgs{ 198 // VpcId: pulumi.Any(main.Id), 199 // }) 200 // if err != nil { 201 // return err 202 // } 203 // _, err = ec2.NewInstance(ctx, "foo", nil, pulumi.DependsOn([]pulumi.Resource{ 204 // gw, 205 // })) 206 // if err != nil { 207 // return err 208 // } 209 // return nil 210 // }) 211 // } 212 // ``` 213 // <!--End PulumiCodeChooser --> 214 Tags pulumi.StringMapInput 215 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 216 // 217 // Deprecated: Please use `tags` instead. 218 TagsAll pulumi.StringMapInput 219 // The VPC ID to create in. See the ec2.InternetGatewayAttachment resource for an alternate way to attach an Internet Gateway to a VPC. 220 VpcId pulumi.StringPtrInput 221 } 222 223 func (InternetGatewayState) ElementType() reflect.Type { 224 return reflect.TypeOf((*internetGatewayState)(nil)).Elem() 225 } 226 227 type internetGatewayArgs struct { 228 // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 229 // 230 // > **Note:** It's recommended to denote that the AWS Instance or Elastic IP depends on the Internet Gateway. For example: 231 // 232 // <!--Start PulumiCodeChooser --> 233 // ```go 234 // package main 235 // 236 // import ( 237 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2" 238 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 239 // ) 240 // 241 // func main() { 242 // pulumi.Run(func(ctx *pulumi.Context) error { 243 // gw, err := ec2.NewInternetGateway(ctx, "gw", &ec2.InternetGatewayArgs{ 244 // VpcId: pulumi.Any(main.Id), 245 // }) 246 // if err != nil { 247 // return err 248 // } 249 // _, err = ec2.NewInstance(ctx, "foo", nil, pulumi.DependsOn([]pulumi.Resource{ 250 // gw, 251 // })) 252 // if err != nil { 253 // return err 254 // } 255 // return nil 256 // }) 257 // } 258 // ``` 259 // <!--End PulumiCodeChooser --> 260 Tags map[string]string `pulumi:"tags"` 261 // The VPC ID to create in. See the ec2.InternetGatewayAttachment resource for an alternate way to attach an Internet Gateway to a VPC. 262 VpcId *string `pulumi:"vpcId"` 263 } 264 265 // The set of arguments for constructing a InternetGateway resource. 266 type InternetGatewayArgs struct { 267 // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 268 // 269 // > **Note:** It's recommended to denote that the AWS Instance or Elastic IP depends on the Internet Gateway. For example: 270 // 271 // <!--Start PulumiCodeChooser --> 272 // ```go 273 // package main 274 // 275 // import ( 276 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2" 277 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 278 // ) 279 // 280 // func main() { 281 // pulumi.Run(func(ctx *pulumi.Context) error { 282 // gw, err := ec2.NewInternetGateway(ctx, "gw", &ec2.InternetGatewayArgs{ 283 // VpcId: pulumi.Any(main.Id), 284 // }) 285 // if err != nil { 286 // return err 287 // } 288 // _, err = ec2.NewInstance(ctx, "foo", nil, pulumi.DependsOn([]pulumi.Resource{ 289 // gw, 290 // })) 291 // if err != nil { 292 // return err 293 // } 294 // return nil 295 // }) 296 // } 297 // ``` 298 // <!--End PulumiCodeChooser --> 299 Tags pulumi.StringMapInput 300 // The VPC ID to create in. See the ec2.InternetGatewayAttachment resource for an alternate way to attach an Internet Gateway to a VPC. 301 VpcId pulumi.StringPtrInput 302 } 303 304 func (InternetGatewayArgs) ElementType() reflect.Type { 305 return reflect.TypeOf((*internetGatewayArgs)(nil)).Elem() 306 } 307 308 type InternetGatewayInput interface { 309 pulumi.Input 310 311 ToInternetGatewayOutput() InternetGatewayOutput 312 ToInternetGatewayOutputWithContext(ctx context.Context) InternetGatewayOutput 313 } 314 315 func (*InternetGateway) ElementType() reflect.Type { 316 return reflect.TypeOf((**InternetGateway)(nil)).Elem() 317 } 318 319 func (i *InternetGateway) ToInternetGatewayOutput() InternetGatewayOutput { 320 return i.ToInternetGatewayOutputWithContext(context.Background()) 321 } 322 323 func (i *InternetGateway) ToInternetGatewayOutputWithContext(ctx context.Context) InternetGatewayOutput { 324 return pulumi.ToOutputWithContext(ctx, i).(InternetGatewayOutput) 325 } 326 327 // InternetGatewayArrayInput is an input type that accepts InternetGatewayArray and InternetGatewayArrayOutput values. 328 // You can construct a concrete instance of `InternetGatewayArrayInput` via: 329 // 330 // InternetGatewayArray{ InternetGatewayArgs{...} } 331 type InternetGatewayArrayInput interface { 332 pulumi.Input 333 334 ToInternetGatewayArrayOutput() InternetGatewayArrayOutput 335 ToInternetGatewayArrayOutputWithContext(context.Context) InternetGatewayArrayOutput 336 } 337 338 type InternetGatewayArray []InternetGatewayInput 339 340 func (InternetGatewayArray) ElementType() reflect.Type { 341 return reflect.TypeOf((*[]*InternetGateway)(nil)).Elem() 342 } 343 344 func (i InternetGatewayArray) ToInternetGatewayArrayOutput() InternetGatewayArrayOutput { 345 return i.ToInternetGatewayArrayOutputWithContext(context.Background()) 346 } 347 348 func (i InternetGatewayArray) ToInternetGatewayArrayOutputWithContext(ctx context.Context) InternetGatewayArrayOutput { 349 return pulumi.ToOutputWithContext(ctx, i).(InternetGatewayArrayOutput) 350 } 351 352 // InternetGatewayMapInput is an input type that accepts InternetGatewayMap and InternetGatewayMapOutput values. 353 // You can construct a concrete instance of `InternetGatewayMapInput` via: 354 // 355 // InternetGatewayMap{ "key": InternetGatewayArgs{...} } 356 type InternetGatewayMapInput interface { 357 pulumi.Input 358 359 ToInternetGatewayMapOutput() InternetGatewayMapOutput 360 ToInternetGatewayMapOutputWithContext(context.Context) InternetGatewayMapOutput 361 } 362 363 type InternetGatewayMap map[string]InternetGatewayInput 364 365 func (InternetGatewayMap) ElementType() reflect.Type { 366 return reflect.TypeOf((*map[string]*InternetGateway)(nil)).Elem() 367 } 368 369 func (i InternetGatewayMap) ToInternetGatewayMapOutput() InternetGatewayMapOutput { 370 return i.ToInternetGatewayMapOutputWithContext(context.Background()) 371 } 372 373 func (i InternetGatewayMap) ToInternetGatewayMapOutputWithContext(ctx context.Context) InternetGatewayMapOutput { 374 return pulumi.ToOutputWithContext(ctx, i).(InternetGatewayMapOutput) 375 } 376 377 type InternetGatewayOutput struct{ *pulumi.OutputState } 378 379 func (InternetGatewayOutput) ElementType() reflect.Type { 380 return reflect.TypeOf((**InternetGateway)(nil)).Elem() 381 } 382 383 func (o InternetGatewayOutput) ToInternetGatewayOutput() InternetGatewayOutput { 384 return o 385 } 386 387 func (o InternetGatewayOutput) ToInternetGatewayOutputWithContext(ctx context.Context) InternetGatewayOutput { 388 return o 389 } 390 391 // The ARN of the Internet Gateway. 392 func (o InternetGatewayOutput) Arn() pulumi.StringOutput { 393 return o.ApplyT(func(v *InternetGateway) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 394 } 395 396 // The ID of the AWS account that owns the internet gateway. 397 func (o InternetGatewayOutput) OwnerId() pulumi.StringOutput { 398 return o.ApplyT(func(v *InternetGateway) pulumi.StringOutput { return v.OwnerId }).(pulumi.StringOutput) 399 } 400 401 // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 402 // 403 // > **Note:** It's recommended to denote that the AWS Instance or Elastic IP depends on the Internet Gateway. For example: 404 // 405 // <!--Start PulumiCodeChooser --> 406 // ```go 407 // package main 408 // 409 // import ( 410 // 411 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2" 412 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 413 // 414 // ) 415 // 416 // func main() { 417 // pulumi.Run(func(ctx *pulumi.Context) error { 418 // gw, err := ec2.NewInternetGateway(ctx, "gw", &ec2.InternetGatewayArgs{ 419 // VpcId: pulumi.Any(main.Id), 420 // }) 421 // if err != nil { 422 // return err 423 // } 424 // _, err = ec2.NewInstance(ctx, "foo", nil, pulumi.DependsOn([]pulumi.Resource{ 425 // gw, 426 // })) 427 // if err != nil { 428 // return err 429 // } 430 // return nil 431 // }) 432 // } 433 // 434 // ``` 435 // <!--End PulumiCodeChooser --> 436 func (o InternetGatewayOutput) Tags() pulumi.StringMapOutput { 437 return o.ApplyT(func(v *InternetGateway) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 438 } 439 440 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 441 // 442 // Deprecated: Please use `tags` instead. 443 func (o InternetGatewayOutput) TagsAll() pulumi.StringMapOutput { 444 return o.ApplyT(func(v *InternetGateway) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 445 } 446 447 // The VPC ID to create in. See the ec2.InternetGatewayAttachment resource for an alternate way to attach an Internet Gateway to a VPC. 448 func (o InternetGatewayOutput) VpcId() pulumi.StringOutput { 449 return o.ApplyT(func(v *InternetGateway) pulumi.StringOutput { return v.VpcId }).(pulumi.StringOutput) 450 } 451 452 type InternetGatewayArrayOutput struct{ *pulumi.OutputState } 453 454 func (InternetGatewayArrayOutput) ElementType() reflect.Type { 455 return reflect.TypeOf((*[]*InternetGateway)(nil)).Elem() 456 } 457 458 func (o InternetGatewayArrayOutput) ToInternetGatewayArrayOutput() InternetGatewayArrayOutput { 459 return o 460 } 461 462 func (o InternetGatewayArrayOutput) ToInternetGatewayArrayOutputWithContext(ctx context.Context) InternetGatewayArrayOutput { 463 return o 464 } 465 466 func (o InternetGatewayArrayOutput) Index(i pulumi.IntInput) InternetGatewayOutput { 467 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *InternetGateway { 468 return vs[0].([]*InternetGateway)[vs[1].(int)] 469 }).(InternetGatewayOutput) 470 } 471 472 type InternetGatewayMapOutput struct{ *pulumi.OutputState } 473 474 func (InternetGatewayMapOutput) ElementType() reflect.Type { 475 return reflect.TypeOf((*map[string]*InternetGateway)(nil)).Elem() 476 } 477 478 func (o InternetGatewayMapOutput) ToInternetGatewayMapOutput() InternetGatewayMapOutput { 479 return o 480 } 481 482 func (o InternetGatewayMapOutput) ToInternetGatewayMapOutputWithContext(ctx context.Context) InternetGatewayMapOutput { 483 return o 484 } 485 486 func (o InternetGatewayMapOutput) MapIndex(k pulumi.StringInput) InternetGatewayOutput { 487 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *InternetGateway { 488 return vs[0].(map[string]*InternetGateway)[vs[1].(string)] 489 }).(InternetGatewayOutput) 490 } 491 492 func init() { 493 pulumi.RegisterInputType(reflect.TypeOf((*InternetGatewayInput)(nil)).Elem(), &InternetGateway{}) 494 pulumi.RegisterInputType(reflect.TypeOf((*InternetGatewayArrayInput)(nil)).Elem(), InternetGatewayArray{}) 495 pulumi.RegisterInputType(reflect.TypeOf((*InternetGatewayMapInput)(nil)).Elem(), InternetGatewayMap{}) 496 pulumi.RegisterOutputType(InternetGatewayOutput{}) 497 pulumi.RegisterOutputType(InternetGatewayArrayOutput{}) 498 pulumi.RegisterOutputType(InternetGatewayMapOutput{}) 499 }