github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2transitgateway/prefixListReference.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 ec2transitgateway
     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  // Manages an EC2 Transit Gateway Prefix List Reference.
    16  //
    17  // ## Example Usage
    18  //
    19  // ### Attachment Routing
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2transitgateway"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			_, err := ec2transitgateway.NewPrefixListReference(ctx, "example", &ec2transitgateway.PrefixListReferenceArgs{
    35  //				PrefixListId:               pulumi.Any(exampleAwsEc2ManagedPrefixList.Id),
    36  //				TransitGatewayAttachmentId: pulumi.Any(exampleAwsEc2TransitGatewayVpcAttachment.Id),
    37  //				TransitGatewayRouteTableId: pulumi.Any(exampleAwsEc2TransitGateway.AssociationDefaultRouteTableId),
    38  //			})
    39  //			if err != nil {
    40  //				return err
    41  //			}
    42  //			return nil
    43  //		})
    44  //	}
    45  //
    46  // ```
    47  // <!--End PulumiCodeChooser -->
    48  //
    49  // ### Blackhole Routing
    50  //
    51  // <!--Start PulumiCodeChooser -->
    52  // ```go
    53  // package main
    54  //
    55  // import (
    56  //
    57  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2transitgateway"
    58  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    59  //
    60  // )
    61  //
    62  //	func main() {
    63  //		pulumi.Run(func(ctx *pulumi.Context) error {
    64  //			_, err := ec2transitgateway.NewPrefixListReference(ctx, "example", &ec2transitgateway.PrefixListReferenceArgs{
    65  //				Blackhole:                  pulumi.Bool(true),
    66  //				PrefixListId:               pulumi.Any(exampleAwsEc2ManagedPrefixList.Id),
    67  //				TransitGatewayRouteTableId: pulumi.Any(exampleAwsEc2TransitGateway.AssociationDefaultRouteTableId),
    68  //			})
    69  //			if err != nil {
    70  //				return err
    71  //			}
    72  //			return nil
    73  //		})
    74  //	}
    75  //
    76  // ```
    77  // <!--End PulumiCodeChooser -->
    78  //
    79  // ## Import
    80  //
    81  // Using `pulumi import`, import `aws_ec2_transit_gateway_prefix_list_reference` using the EC2 Transit Gateway Route Table identifier and EC2 Prefix List identifier, separated by an underscore (`_`). For example:
    82  //
    83  // ```sh
    84  // $ pulumi import aws:ec2transitgateway/prefixListReference:PrefixListReference example tgw-rtb-12345678_pl-12345678
    85  // ```
    86  type PrefixListReference struct {
    87  	pulumi.CustomResourceState
    88  
    89  	// Indicates whether to drop traffic that matches the Prefix List. Defaults to `false`.
    90  	Blackhole pulumi.BoolPtrOutput `pulumi:"blackhole"`
    91  	// Identifier of EC2 Prefix List.
    92  	PrefixListId      pulumi.StringOutput `pulumi:"prefixListId"`
    93  	PrefixListOwnerId pulumi.StringOutput `pulumi:"prefixListOwnerId"`
    94  	// Identifier of EC2 Transit Gateway Attachment.
    95  	TransitGatewayAttachmentId pulumi.StringPtrOutput `pulumi:"transitGatewayAttachmentId"`
    96  	// Identifier of EC2 Transit Gateway Route Table.
    97  	//
    98  	// The following arguments are optional:
    99  	TransitGatewayRouteTableId pulumi.StringOutput `pulumi:"transitGatewayRouteTableId"`
   100  }
   101  
   102  // NewPrefixListReference registers a new resource with the given unique name, arguments, and options.
   103  func NewPrefixListReference(ctx *pulumi.Context,
   104  	name string, args *PrefixListReferenceArgs, opts ...pulumi.ResourceOption) (*PrefixListReference, error) {
   105  	if args == nil {
   106  		return nil, errors.New("missing one or more required arguments")
   107  	}
   108  
   109  	if args.PrefixListId == nil {
   110  		return nil, errors.New("invalid value for required argument 'PrefixListId'")
   111  	}
   112  	if args.TransitGatewayRouteTableId == nil {
   113  		return nil, errors.New("invalid value for required argument 'TransitGatewayRouteTableId'")
   114  	}
   115  	opts = internal.PkgResourceDefaultOpts(opts)
   116  	var resource PrefixListReference
   117  	err := ctx.RegisterResource("aws:ec2transitgateway/prefixListReference:PrefixListReference", name, args, &resource, opts...)
   118  	if err != nil {
   119  		return nil, err
   120  	}
   121  	return &resource, nil
   122  }
   123  
   124  // GetPrefixListReference gets an existing PrefixListReference resource's state with the given name, ID, and optional
   125  // state properties that are used to uniquely qualify the lookup (nil if not required).
   126  func GetPrefixListReference(ctx *pulumi.Context,
   127  	name string, id pulumi.IDInput, state *PrefixListReferenceState, opts ...pulumi.ResourceOption) (*PrefixListReference, error) {
   128  	var resource PrefixListReference
   129  	err := ctx.ReadResource("aws:ec2transitgateway/prefixListReference:PrefixListReference", name, id, state, &resource, opts...)
   130  	if err != nil {
   131  		return nil, err
   132  	}
   133  	return &resource, nil
   134  }
   135  
   136  // Input properties used for looking up and filtering PrefixListReference resources.
   137  type prefixListReferenceState struct {
   138  	// Indicates whether to drop traffic that matches the Prefix List. Defaults to `false`.
   139  	Blackhole *bool `pulumi:"blackhole"`
   140  	// Identifier of EC2 Prefix List.
   141  	PrefixListId      *string `pulumi:"prefixListId"`
   142  	PrefixListOwnerId *string `pulumi:"prefixListOwnerId"`
   143  	// Identifier of EC2 Transit Gateway Attachment.
   144  	TransitGatewayAttachmentId *string `pulumi:"transitGatewayAttachmentId"`
   145  	// Identifier of EC2 Transit Gateway Route Table.
   146  	//
   147  	// The following arguments are optional:
   148  	TransitGatewayRouteTableId *string `pulumi:"transitGatewayRouteTableId"`
   149  }
   150  
   151  type PrefixListReferenceState struct {
   152  	// Indicates whether to drop traffic that matches the Prefix List. Defaults to `false`.
   153  	Blackhole pulumi.BoolPtrInput
   154  	// Identifier of EC2 Prefix List.
   155  	PrefixListId      pulumi.StringPtrInput
   156  	PrefixListOwnerId pulumi.StringPtrInput
   157  	// Identifier of EC2 Transit Gateway Attachment.
   158  	TransitGatewayAttachmentId pulumi.StringPtrInput
   159  	// Identifier of EC2 Transit Gateway Route Table.
   160  	//
   161  	// The following arguments are optional:
   162  	TransitGatewayRouteTableId pulumi.StringPtrInput
   163  }
   164  
   165  func (PrefixListReferenceState) ElementType() reflect.Type {
   166  	return reflect.TypeOf((*prefixListReferenceState)(nil)).Elem()
   167  }
   168  
   169  type prefixListReferenceArgs struct {
   170  	// Indicates whether to drop traffic that matches the Prefix List. Defaults to `false`.
   171  	Blackhole *bool `pulumi:"blackhole"`
   172  	// Identifier of EC2 Prefix List.
   173  	PrefixListId string `pulumi:"prefixListId"`
   174  	// Identifier of EC2 Transit Gateway Attachment.
   175  	TransitGatewayAttachmentId *string `pulumi:"transitGatewayAttachmentId"`
   176  	// Identifier of EC2 Transit Gateway Route Table.
   177  	//
   178  	// The following arguments are optional:
   179  	TransitGatewayRouteTableId string `pulumi:"transitGatewayRouteTableId"`
   180  }
   181  
   182  // The set of arguments for constructing a PrefixListReference resource.
   183  type PrefixListReferenceArgs struct {
   184  	// Indicates whether to drop traffic that matches the Prefix List. Defaults to `false`.
   185  	Blackhole pulumi.BoolPtrInput
   186  	// Identifier of EC2 Prefix List.
   187  	PrefixListId pulumi.StringInput
   188  	// Identifier of EC2 Transit Gateway Attachment.
   189  	TransitGatewayAttachmentId pulumi.StringPtrInput
   190  	// Identifier of EC2 Transit Gateway Route Table.
   191  	//
   192  	// The following arguments are optional:
   193  	TransitGatewayRouteTableId pulumi.StringInput
   194  }
   195  
   196  func (PrefixListReferenceArgs) ElementType() reflect.Type {
   197  	return reflect.TypeOf((*prefixListReferenceArgs)(nil)).Elem()
   198  }
   199  
   200  type PrefixListReferenceInput interface {
   201  	pulumi.Input
   202  
   203  	ToPrefixListReferenceOutput() PrefixListReferenceOutput
   204  	ToPrefixListReferenceOutputWithContext(ctx context.Context) PrefixListReferenceOutput
   205  }
   206  
   207  func (*PrefixListReference) ElementType() reflect.Type {
   208  	return reflect.TypeOf((**PrefixListReference)(nil)).Elem()
   209  }
   210  
   211  func (i *PrefixListReference) ToPrefixListReferenceOutput() PrefixListReferenceOutput {
   212  	return i.ToPrefixListReferenceOutputWithContext(context.Background())
   213  }
   214  
   215  func (i *PrefixListReference) ToPrefixListReferenceOutputWithContext(ctx context.Context) PrefixListReferenceOutput {
   216  	return pulumi.ToOutputWithContext(ctx, i).(PrefixListReferenceOutput)
   217  }
   218  
   219  // PrefixListReferenceArrayInput is an input type that accepts PrefixListReferenceArray and PrefixListReferenceArrayOutput values.
   220  // You can construct a concrete instance of `PrefixListReferenceArrayInput` via:
   221  //
   222  //	PrefixListReferenceArray{ PrefixListReferenceArgs{...} }
   223  type PrefixListReferenceArrayInput interface {
   224  	pulumi.Input
   225  
   226  	ToPrefixListReferenceArrayOutput() PrefixListReferenceArrayOutput
   227  	ToPrefixListReferenceArrayOutputWithContext(context.Context) PrefixListReferenceArrayOutput
   228  }
   229  
   230  type PrefixListReferenceArray []PrefixListReferenceInput
   231  
   232  func (PrefixListReferenceArray) ElementType() reflect.Type {
   233  	return reflect.TypeOf((*[]*PrefixListReference)(nil)).Elem()
   234  }
   235  
   236  func (i PrefixListReferenceArray) ToPrefixListReferenceArrayOutput() PrefixListReferenceArrayOutput {
   237  	return i.ToPrefixListReferenceArrayOutputWithContext(context.Background())
   238  }
   239  
   240  func (i PrefixListReferenceArray) ToPrefixListReferenceArrayOutputWithContext(ctx context.Context) PrefixListReferenceArrayOutput {
   241  	return pulumi.ToOutputWithContext(ctx, i).(PrefixListReferenceArrayOutput)
   242  }
   243  
   244  // PrefixListReferenceMapInput is an input type that accepts PrefixListReferenceMap and PrefixListReferenceMapOutput values.
   245  // You can construct a concrete instance of `PrefixListReferenceMapInput` via:
   246  //
   247  //	PrefixListReferenceMap{ "key": PrefixListReferenceArgs{...} }
   248  type PrefixListReferenceMapInput interface {
   249  	pulumi.Input
   250  
   251  	ToPrefixListReferenceMapOutput() PrefixListReferenceMapOutput
   252  	ToPrefixListReferenceMapOutputWithContext(context.Context) PrefixListReferenceMapOutput
   253  }
   254  
   255  type PrefixListReferenceMap map[string]PrefixListReferenceInput
   256  
   257  func (PrefixListReferenceMap) ElementType() reflect.Type {
   258  	return reflect.TypeOf((*map[string]*PrefixListReference)(nil)).Elem()
   259  }
   260  
   261  func (i PrefixListReferenceMap) ToPrefixListReferenceMapOutput() PrefixListReferenceMapOutput {
   262  	return i.ToPrefixListReferenceMapOutputWithContext(context.Background())
   263  }
   264  
   265  func (i PrefixListReferenceMap) ToPrefixListReferenceMapOutputWithContext(ctx context.Context) PrefixListReferenceMapOutput {
   266  	return pulumi.ToOutputWithContext(ctx, i).(PrefixListReferenceMapOutput)
   267  }
   268  
   269  type PrefixListReferenceOutput struct{ *pulumi.OutputState }
   270  
   271  func (PrefixListReferenceOutput) ElementType() reflect.Type {
   272  	return reflect.TypeOf((**PrefixListReference)(nil)).Elem()
   273  }
   274  
   275  func (o PrefixListReferenceOutput) ToPrefixListReferenceOutput() PrefixListReferenceOutput {
   276  	return o
   277  }
   278  
   279  func (o PrefixListReferenceOutput) ToPrefixListReferenceOutputWithContext(ctx context.Context) PrefixListReferenceOutput {
   280  	return o
   281  }
   282  
   283  // Indicates whether to drop traffic that matches the Prefix List. Defaults to `false`.
   284  func (o PrefixListReferenceOutput) Blackhole() pulumi.BoolPtrOutput {
   285  	return o.ApplyT(func(v *PrefixListReference) pulumi.BoolPtrOutput { return v.Blackhole }).(pulumi.BoolPtrOutput)
   286  }
   287  
   288  // Identifier of EC2 Prefix List.
   289  func (o PrefixListReferenceOutput) PrefixListId() pulumi.StringOutput {
   290  	return o.ApplyT(func(v *PrefixListReference) pulumi.StringOutput { return v.PrefixListId }).(pulumi.StringOutput)
   291  }
   292  
   293  func (o PrefixListReferenceOutput) PrefixListOwnerId() pulumi.StringOutput {
   294  	return o.ApplyT(func(v *PrefixListReference) pulumi.StringOutput { return v.PrefixListOwnerId }).(pulumi.StringOutput)
   295  }
   296  
   297  // Identifier of EC2 Transit Gateway Attachment.
   298  func (o PrefixListReferenceOutput) TransitGatewayAttachmentId() pulumi.StringPtrOutput {
   299  	return o.ApplyT(func(v *PrefixListReference) pulumi.StringPtrOutput { return v.TransitGatewayAttachmentId }).(pulumi.StringPtrOutput)
   300  }
   301  
   302  // Identifier of EC2 Transit Gateway Route Table.
   303  //
   304  // The following arguments are optional:
   305  func (o PrefixListReferenceOutput) TransitGatewayRouteTableId() pulumi.StringOutput {
   306  	return o.ApplyT(func(v *PrefixListReference) pulumi.StringOutput { return v.TransitGatewayRouteTableId }).(pulumi.StringOutput)
   307  }
   308  
   309  type PrefixListReferenceArrayOutput struct{ *pulumi.OutputState }
   310  
   311  func (PrefixListReferenceArrayOutput) ElementType() reflect.Type {
   312  	return reflect.TypeOf((*[]*PrefixListReference)(nil)).Elem()
   313  }
   314  
   315  func (o PrefixListReferenceArrayOutput) ToPrefixListReferenceArrayOutput() PrefixListReferenceArrayOutput {
   316  	return o
   317  }
   318  
   319  func (o PrefixListReferenceArrayOutput) ToPrefixListReferenceArrayOutputWithContext(ctx context.Context) PrefixListReferenceArrayOutput {
   320  	return o
   321  }
   322  
   323  func (o PrefixListReferenceArrayOutput) Index(i pulumi.IntInput) PrefixListReferenceOutput {
   324  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *PrefixListReference {
   325  		return vs[0].([]*PrefixListReference)[vs[1].(int)]
   326  	}).(PrefixListReferenceOutput)
   327  }
   328  
   329  type PrefixListReferenceMapOutput struct{ *pulumi.OutputState }
   330  
   331  func (PrefixListReferenceMapOutput) ElementType() reflect.Type {
   332  	return reflect.TypeOf((*map[string]*PrefixListReference)(nil)).Elem()
   333  }
   334  
   335  func (o PrefixListReferenceMapOutput) ToPrefixListReferenceMapOutput() PrefixListReferenceMapOutput {
   336  	return o
   337  }
   338  
   339  func (o PrefixListReferenceMapOutput) ToPrefixListReferenceMapOutputWithContext(ctx context.Context) PrefixListReferenceMapOutput {
   340  	return o
   341  }
   342  
   343  func (o PrefixListReferenceMapOutput) MapIndex(k pulumi.StringInput) PrefixListReferenceOutput {
   344  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *PrefixListReference {
   345  		return vs[0].(map[string]*PrefixListReference)[vs[1].(string)]
   346  	}).(PrefixListReferenceOutput)
   347  }
   348  
   349  func init() {
   350  	pulumi.RegisterInputType(reflect.TypeOf((*PrefixListReferenceInput)(nil)).Elem(), &PrefixListReference{})
   351  	pulumi.RegisterInputType(reflect.TypeOf((*PrefixListReferenceArrayInput)(nil)).Elem(), PrefixListReferenceArray{})
   352  	pulumi.RegisterInputType(reflect.TypeOf((*PrefixListReferenceMapInput)(nil)).Elem(), PrefixListReferenceMap{})
   353  	pulumi.RegisterOutputType(PrefixListReferenceOutput{})
   354  	pulumi.RegisterOutputType(PrefixListReferenceArrayOutput{})
   355  	pulumi.RegisterOutputType(PrefixListReferenceMapOutput{})
   356  }