github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2/customerGateway.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 customer gateway inside a VPC. These objects can be connected to VPN gateways via VPN connections, and allow you to establish tunnels between your network and the VPC.
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			_, err := ec2.NewCustomerGateway(ctx, "main", &ec2.CustomerGatewayArgs{
    33  //				BgpAsn:    pulumi.String("65000"),
    34  //				IpAddress: pulumi.String("172.83.124.10"),
    35  //				Type:      pulumi.String("ipsec.1"),
    36  //				Tags: pulumi.StringMap{
    37  //					"Name": pulumi.String("main-customer-gateway"),
    38  //				},
    39  //			})
    40  //			if err != nil {
    41  //				return err
    42  //			}
    43  //			return nil
    44  //		})
    45  //	}
    46  //
    47  // ```
    48  // <!--End PulumiCodeChooser -->
    49  //
    50  // ## Import
    51  //
    52  // Using `pulumi import`, import Customer Gateways using the `id`. For example:
    53  //
    54  // ```sh
    55  // $ pulumi import aws:ec2/customerGateway:CustomerGateway main cgw-b4dc3961
    56  // ```
    57  type CustomerGateway struct {
    58  	pulumi.CustomResourceState
    59  
    60  	// The ARN of the customer gateway.
    61  	Arn pulumi.StringOutput `pulumi:"arn"`
    62  	// The gateway's Border Gateway Protocol (BGP) Autonomous System Number (ASN).
    63  	BgpAsn pulumi.StringOutput `pulumi:"bgpAsn"`
    64  	// The Amazon Resource Name (ARN) for the customer gateway certificate.
    65  	CertificateArn pulumi.StringPtrOutput `pulumi:"certificateArn"`
    66  	// A name for the customer gateway device.
    67  	DeviceName pulumi.StringPtrOutput `pulumi:"deviceName"`
    68  	// The IPv4 address for the customer gateway device's outside interface.
    69  	IpAddress pulumi.StringPtrOutput `pulumi:"ipAddress"`
    70  	// Tags to apply to the gateway. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    71  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    72  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    73  	//
    74  	// Deprecated: Please use `tags` instead.
    75  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    76  	// The type of customer gateway. The only type AWS
    77  	// supports at this time is "ipsec.1".
    78  	Type pulumi.StringOutput `pulumi:"type"`
    79  }
    80  
    81  // NewCustomerGateway registers a new resource with the given unique name, arguments, and options.
    82  func NewCustomerGateway(ctx *pulumi.Context,
    83  	name string, args *CustomerGatewayArgs, opts ...pulumi.ResourceOption) (*CustomerGateway, error) {
    84  	if args == nil {
    85  		return nil, errors.New("missing one or more required arguments")
    86  	}
    87  
    88  	if args.BgpAsn == nil {
    89  		return nil, errors.New("invalid value for required argument 'BgpAsn'")
    90  	}
    91  	if args.Type == nil {
    92  		return nil, errors.New("invalid value for required argument 'Type'")
    93  	}
    94  	opts = internal.PkgResourceDefaultOpts(opts)
    95  	var resource CustomerGateway
    96  	err := ctx.RegisterResource("aws:ec2/customerGateway:CustomerGateway", name, args, &resource, opts...)
    97  	if err != nil {
    98  		return nil, err
    99  	}
   100  	return &resource, nil
   101  }
   102  
   103  // GetCustomerGateway gets an existing CustomerGateway 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 GetCustomerGateway(ctx *pulumi.Context,
   106  	name string, id pulumi.IDInput, state *CustomerGatewayState, opts ...pulumi.ResourceOption) (*CustomerGateway, error) {
   107  	var resource CustomerGateway
   108  	err := ctx.ReadResource("aws:ec2/customerGateway:CustomerGateway", 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 CustomerGateway resources.
   116  type customerGatewayState struct {
   117  	// The ARN of the customer gateway.
   118  	Arn *string `pulumi:"arn"`
   119  	// The gateway's Border Gateway Protocol (BGP) Autonomous System Number (ASN).
   120  	BgpAsn *string `pulumi:"bgpAsn"`
   121  	// The Amazon Resource Name (ARN) for the customer gateway certificate.
   122  	CertificateArn *string `pulumi:"certificateArn"`
   123  	// A name for the customer gateway device.
   124  	DeviceName *string `pulumi:"deviceName"`
   125  	// The IPv4 address for the customer gateway device's outside interface.
   126  	IpAddress *string `pulumi:"ipAddress"`
   127  	// Tags to apply to the gateway. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   128  	Tags map[string]string `pulumi:"tags"`
   129  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   130  	//
   131  	// Deprecated: Please use `tags` instead.
   132  	TagsAll map[string]string `pulumi:"tagsAll"`
   133  	// The type of customer gateway. The only type AWS
   134  	// supports at this time is "ipsec.1".
   135  	Type *string `pulumi:"type"`
   136  }
   137  
   138  type CustomerGatewayState struct {
   139  	// The ARN of the customer gateway.
   140  	Arn pulumi.StringPtrInput
   141  	// The gateway's Border Gateway Protocol (BGP) Autonomous System Number (ASN).
   142  	BgpAsn pulumi.StringPtrInput
   143  	// The Amazon Resource Name (ARN) for the customer gateway certificate.
   144  	CertificateArn pulumi.StringPtrInput
   145  	// A name for the customer gateway device.
   146  	DeviceName pulumi.StringPtrInput
   147  	// The IPv4 address for the customer gateway device's outside interface.
   148  	IpAddress pulumi.StringPtrInput
   149  	// Tags to apply to the gateway. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   150  	Tags pulumi.StringMapInput
   151  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   152  	//
   153  	// Deprecated: Please use `tags` instead.
   154  	TagsAll pulumi.StringMapInput
   155  	// The type of customer gateway. The only type AWS
   156  	// supports at this time is "ipsec.1".
   157  	Type pulumi.StringPtrInput
   158  }
   159  
   160  func (CustomerGatewayState) ElementType() reflect.Type {
   161  	return reflect.TypeOf((*customerGatewayState)(nil)).Elem()
   162  }
   163  
   164  type customerGatewayArgs struct {
   165  	// The gateway's Border Gateway Protocol (BGP) Autonomous System Number (ASN).
   166  	BgpAsn string `pulumi:"bgpAsn"`
   167  	// The Amazon Resource Name (ARN) for the customer gateway certificate.
   168  	CertificateArn *string `pulumi:"certificateArn"`
   169  	// A name for the customer gateway device.
   170  	DeviceName *string `pulumi:"deviceName"`
   171  	// The IPv4 address for the customer gateway device's outside interface.
   172  	IpAddress *string `pulumi:"ipAddress"`
   173  	// Tags to apply to the gateway. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   174  	Tags map[string]string `pulumi:"tags"`
   175  	// The type of customer gateway. The only type AWS
   176  	// supports at this time is "ipsec.1".
   177  	Type string `pulumi:"type"`
   178  }
   179  
   180  // The set of arguments for constructing a CustomerGateway resource.
   181  type CustomerGatewayArgs struct {
   182  	// The gateway's Border Gateway Protocol (BGP) Autonomous System Number (ASN).
   183  	BgpAsn pulumi.StringInput
   184  	// The Amazon Resource Name (ARN) for the customer gateway certificate.
   185  	CertificateArn pulumi.StringPtrInput
   186  	// A name for the customer gateway device.
   187  	DeviceName pulumi.StringPtrInput
   188  	// The IPv4 address for the customer gateway device's outside interface.
   189  	IpAddress pulumi.StringPtrInput
   190  	// Tags to apply to the gateway. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   191  	Tags pulumi.StringMapInput
   192  	// The type of customer gateway. The only type AWS
   193  	// supports at this time is "ipsec.1".
   194  	Type pulumi.StringInput
   195  }
   196  
   197  func (CustomerGatewayArgs) ElementType() reflect.Type {
   198  	return reflect.TypeOf((*customerGatewayArgs)(nil)).Elem()
   199  }
   200  
   201  type CustomerGatewayInput interface {
   202  	pulumi.Input
   203  
   204  	ToCustomerGatewayOutput() CustomerGatewayOutput
   205  	ToCustomerGatewayOutputWithContext(ctx context.Context) CustomerGatewayOutput
   206  }
   207  
   208  func (*CustomerGateway) ElementType() reflect.Type {
   209  	return reflect.TypeOf((**CustomerGateway)(nil)).Elem()
   210  }
   211  
   212  func (i *CustomerGateway) ToCustomerGatewayOutput() CustomerGatewayOutput {
   213  	return i.ToCustomerGatewayOutputWithContext(context.Background())
   214  }
   215  
   216  func (i *CustomerGateway) ToCustomerGatewayOutputWithContext(ctx context.Context) CustomerGatewayOutput {
   217  	return pulumi.ToOutputWithContext(ctx, i).(CustomerGatewayOutput)
   218  }
   219  
   220  // CustomerGatewayArrayInput is an input type that accepts CustomerGatewayArray and CustomerGatewayArrayOutput values.
   221  // You can construct a concrete instance of `CustomerGatewayArrayInput` via:
   222  //
   223  //	CustomerGatewayArray{ CustomerGatewayArgs{...} }
   224  type CustomerGatewayArrayInput interface {
   225  	pulumi.Input
   226  
   227  	ToCustomerGatewayArrayOutput() CustomerGatewayArrayOutput
   228  	ToCustomerGatewayArrayOutputWithContext(context.Context) CustomerGatewayArrayOutput
   229  }
   230  
   231  type CustomerGatewayArray []CustomerGatewayInput
   232  
   233  func (CustomerGatewayArray) ElementType() reflect.Type {
   234  	return reflect.TypeOf((*[]*CustomerGateway)(nil)).Elem()
   235  }
   236  
   237  func (i CustomerGatewayArray) ToCustomerGatewayArrayOutput() CustomerGatewayArrayOutput {
   238  	return i.ToCustomerGatewayArrayOutputWithContext(context.Background())
   239  }
   240  
   241  func (i CustomerGatewayArray) ToCustomerGatewayArrayOutputWithContext(ctx context.Context) CustomerGatewayArrayOutput {
   242  	return pulumi.ToOutputWithContext(ctx, i).(CustomerGatewayArrayOutput)
   243  }
   244  
   245  // CustomerGatewayMapInput is an input type that accepts CustomerGatewayMap and CustomerGatewayMapOutput values.
   246  // You can construct a concrete instance of `CustomerGatewayMapInput` via:
   247  //
   248  //	CustomerGatewayMap{ "key": CustomerGatewayArgs{...} }
   249  type CustomerGatewayMapInput interface {
   250  	pulumi.Input
   251  
   252  	ToCustomerGatewayMapOutput() CustomerGatewayMapOutput
   253  	ToCustomerGatewayMapOutputWithContext(context.Context) CustomerGatewayMapOutput
   254  }
   255  
   256  type CustomerGatewayMap map[string]CustomerGatewayInput
   257  
   258  func (CustomerGatewayMap) ElementType() reflect.Type {
   259  	return reflect.TypeOf((*map[string]*CustomerGateway)(nil)).Elem()
   260  }
   261  
   262  func (i CustomerGatewayMap) ToCustomerGatewayMapOutput() CustomerGatewayMapOutput {
   263  	return i.ToCustomerGatewayMapOutputWithContext(context.Background())
   264  }
   265  
   266  func (i CustomerGatewayMap) ToCustomerGatewayMapOutputWithContext(ctx context.Context) CustomerGatewayMapOutput {
   267  	return pulumi.ToOutputWithContext(ctx, i).(CustomerGatewayMapOutput)
   268  }
   269  
   270  type CustomerGatewayOutput struct{ *pulumi.OutputState }
   271  
   272  func (CustomerGatewayOutput) ElementType() reflect.Type {
   273  	return reflect.TypeOf((**CustomerGateway)(nil)).Elem()
   274  }
   275  
   276  func (o CustomerGatewayOutput) ToCustomerGatewayOutput() CustomerGatewayOutput {
   277  	return o
   278  }
   279  
   280  func (o CustomerGatewayOutput) ToCustomerGatewayOutputWithContext(ctx context.Context) CustomerGatewayOutput {
   281  	return o
   282  }
   283  
   284  // The ARN of the customer gateway.
   285  func (o CustomerGatewayOutput) Arn() pulumi.StringOutput {
   286  	return o.ApplyT(func(v *CustomerGateway) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   287  }
   288  
   289  // The gateway's Border Gateway Protocol (BGP) Autonomous System Number (ASN).
   290  func (o CustomerGatewayOutput) BgpAsn() pulumi.StringOutput {
   291  	return o.ApplyT(func(v *CustomerGateway) pulumi.StringOutput { return v.BgpAsn }).(pulumi.StringOutput)
   292  }
   293  
   294  // The Amazon Resource Name (ARN) for the customer gateway certificate.
   295  func (o CustomerGatewayOutput) CertificateArn() pulumi.StringPtrOutput {
   296  	return o.ApplyT(func(v *CustomerGateway) pulumi.StringPtrOutput { return v.CertificateArn }).(pulumi.StringPtrOutput)
   297  }
   298  
   299  // A name for the customer gateway device.
   300  func (o CustomerGatewayOutput) DeviceName() pulumi.StringPtrOutput {
   301  	return o.ApplyT(func(v *CustomerGateway) pulumi.StringPtrOutput { return v.DeviceName }).(pulumi.StringPtrOutput)
   302  }
   303  
   304  // The IPv4 address for the customer gateway device's outside interface.
   305  func (o CustomerGatewayOutput) IpAddress() pulumi.StringPtrOutput {
   306  	return o.ApplyT(func(v *CustomerGateway) pulumi.StringPtrOutput { return v.IpAddress }).(pulumi.StringPtrOutput)
   307  }
   308  
   309  // Tags to apply to the gateway. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   310  func (o CustomerGatewayOutput) Tags() pulumi.StringMapOutput {
   311  	return o.ApplyT(func(v *CustomerGateway) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   312  }
   313  
   314  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   315  //
   316  // Deprecated: Please use `tags` instead.
   317  func (o CustomerGatewayOutput) TagsAll() pulumi.StringMapOutput {
   318  	return o.ApplyT(func(v *CustomerGateway) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   319  }
   320  
   321  // The type of customer gateway. The only type AWS
   322  // supports at this time is "ipsec.1".
   323  func (o CustomerGatewayOutput) Type() pulumi.StringOutput {
   324  	return o.ApplyT(func(v *CustomerGateway) pulumi.StringOutput { return v.Type }).(pulumi.StringOutput)
   325  }
   326  
   327  type CustomerGatewayArrayOutput struct{ *pulumi.OutputState }
   328  
   329  func (CustomerGatewayArrayOutput) ElementType() reflect.Type {
   330  	return reflect.TypeOf((*[]*CustomerGateway)(nil)).Elem()
   331  }
   332  
   333  func (o CustomerGatewayArrayOutput) ToCustomerGatewayArrayOutput() CustomerGatewayArrayOutput {
   334  	return o
   335  }
   336  
   337  func (o CustomerGatewayArrayOutput) ToCustomerGatewayArrayOutputWithContext(ctx context.Context) CustomerGatewayArrayOutput {
   338  	return o
   339  }
   340  
   341  func (o CustomerGatewayArrayOutput) Index(i pulumi.IntInput) CustomerGatewayOutput {
   342  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *CustomerGateway {
   343  		return vs[0].([]*CustomerGateway)[vs[1].(int)]
   344  	}).(CustomerGatewayOutput)
   345  }
   346  
   347  type CustomerGatewayMapOutput struct{ *pulumi.OutputState }
   348  
   349  func (CustomerGatewayMapOutput) ElementType() reflect.Type {
   350  	return reflect.TypeOf((*map[string]*CustomerGateway)(nil)).Elem()
   351  }
   352  
   353  func (o CustomerGatewayMapOutput) ToCustomerGatewayMapOutput() CustomerGatewayMapOutput {
   354  	return o
   355  }
   356  
   357  func (o CustomerGatewayMapOutput) ToCustomerGatewayMapOutputWithContext(ctx context.Context) CustomerGatewayMapOutput {
   358  	return o
   359  }
   360  
   361  func (o CustomerGatewayMapOutput) MapIndex(k pulumi.StringInput) CustomerGatewayOutput {
   362  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *CustomerGateway {
   363  		return vs[0].(map[string]*CustomerGateway)[vs[1].(string)]
   364  	}).(CustomerGatewayOutput)
   365  }
   366  
   367  func init() {
   368  	pulumi.RegisterInputType(reflect.TypeOf((*CustomerGatewayInput)(nil)).Elem(), &CustomerGateway{})
   369  	pulumi.RegisterInputType(reflect.TypeOf((*CustomerGatewayArrayInput)(nil)).Elem(), CustomerGatewayArray{})
   370  	pulumi.RegisterInputType(reflect.TypeOf((*CustomerGatewayMapInput)(nil)).Elem(), CustomerGatewayMap{})
   371  	pulumi.RegisterOutputType(CustomerGatewayOutput{})
   372  	pulumi.RegisterOutputType(CustomerGatewayArrayOutput{})
   373  	pulumi.RegisterOutputType(CustomerGatewayMapOutput{})
   374  }