github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2/trafficMirrorTarget.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 Traffic mirror target.\ 15 // Read [limits and considerations](https://docs.aws.amazon.com/vpc/latest/mirroring/traffic-mirroring-considerations.html) for traffic mirroring 16 // 17 // ## Example Usage 18 // 19 // # To create a basic traffic mirror session 20 // 21 // <!--Start PulumiCodeChooser --> 22 // ```go 23 // package main 24 // 25 // import ( 26 // 27 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2" 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 := ec2.NewTrafficMirrorTarget(ctx, "nlb", &ec2.TrafficMirrorTargetArgs{ 35 // Description: pulumi.String("NLB target"), 36 // NetworkLoadBalancerArn: pulumi.Any(lb.Arn), 37 // }) 38 // if err != nil { 39 // return err 40 // } 41 // _, err = ec2.NewTrafficMirrorTarget(ctx, "eni", &ec2.TrafficMirrorTargetArgs{ 42 // Description: pulumi.String("ENI target"), 43 // NetworkInterfaceId: pulumi.Any(test.PrimaryNetworkInterfaceId), 44 // }) 45 // if err != nil { 46 // return err 47 // } 48 // _, err = ec2.NewTrafficMirrorTarget(ctx, "gwlb", &ec2.TrafficMirrorTargetArgs{ 49 // Description: pulumi.String("GWLB target"), 50 // GatewayLoadBalancerEndpointId: pulumi.Any(example.Id), 51 // }) 52 // if err != nil { 53 // return err 54 // } 55 // return nil 56 // }) 57 // } 58 // 59 // ``` 60 // <!--End PulumiCodeChooser --> 61 // 62 // ## Import 63 // 64 // Using `pulumi import`, import traffic mirror targets using the `id`. For example: 65 // 66 // ```sh 67 // $ pulumi import aws:ec2/trafficMirrorTarget:TrafficMirrorTarget target tmt-0c13a005422b86606 68 // ``` 69 type TrafficMirrorTarget struct { 70 pulumi.CustomResourceState 71 72 // The ARN of the traffic mirror target. 73 Arn pulumi.StringOutput `pulumi:"arn"` 74 // A description of the traffic mirror session. 75 Description pulumi.StringPtrOutput `pulumi:"description"` 76 // The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target. 77 GatewayLoadBalancerEndpointId pulumi.StringPtrOutput `pulumi:"gatewayLoadBalancerEndpointId"` 78 // The network interface ID that is associated with the target. 79 NetworkInterfaceId pulumi.StringPtrOutput `pulumi:"networkInterfaceId"` 80 // The Amazon Resource Name (ARN) of the Network Load Balancer that is associated with the target. 81 NetworkLoadBalancerArn pulumi.StringPtrOutput `pulumi:"networkLoadBalancerArn"` 82 // The ID of the AWS account that owns the traffic mirror target. 83 OwnerId pulumi.StringOutput `pulumi:"ownerId"` 84 // Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 85 // 86 // **NOTE:** Either `networkInterfaceId` or `networkLoadBalancerArn` should be specified and both should not be specified together 87 Tags pulumi.StringMapOutput `pulumi:"tags"` 88 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 89 // 90 // Deprecated: Please use `tags` instead. 91 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 92 } 93 94 // NewTrafficMirrorTarget registers a new resource with the given unique name, arguments, and options. 95 func NewTrafficMirrorTarget(ctx *pulumi.Context, 96 name string, args *TrafficMirrorTargetArgs, opts ...pulumi.ResourceOption) (*TrafficMirrorTarget, error) { 97 if args == nil { 98 args = &TrafficMirrorTargetArgs{} 99 } 100 101 opts = internal.PkgResourceDefaultOpts(opts) 102 var resource TrafficMirrorTarget 103 err := ctx.RegisterResource("aws:ec2/trafficMirrorTarget:TrafficMirrorTarget", name, args, &resource, opts...) 104 if err != nil { 105 return nil, err 106 } 107 return &resource, nil 108 } 109 110 // GetTrafficMirrorTarget gets an existing TrafficMirrorTarget resource's state with the given name, ID, and optional 111 // state properties that are used to uniquely qualify the lookup (nil if not required). 112 func GetTrafficMirrorTarget(ctx *pulumi.Context, 113 name string, id pulumi.IDInput, state *TrafficMirrorTargetState, opts ...pulumi.ResourceOption) (*TrafficMirrorTarget, error) { 114 var resource TrafficMirrorTarget 115 err := ctx.ReadResource("aws:ec2/trafficMirrorTarget:TrafficMirrorTarget", name, id, state, &resource, opts...) 116 if err != nil { 117 return nil, err 118 } 119 return &resource, nil 120 } 121 122 // Input properties used for looking up and filtering TrafficMirrorTarget resources. 123 type trafficMirrorTargetState struct { 124 // The ARN of the traffic mirror target. 125 Arn *string `pulumi:"arn"` 126 // A description of the traffic mirror session. 127 Description *string `pulumi:"description"` 128 // The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target. 129 GatewayLoadBalancerEndpointId *string `pulumi:"gatewayLoadBalancerEndpointId"` 130 // The network interface ID that is associated with the target. 131 NetworkInterfaceId *string `pulumi:"networkInterfaceId"` 132 // The Amazon Resource Name (ARN) of the Network Load Balancer that is associated with the target. 133 NetworkLoadBalancerArn *string `pulumi:"networkLoadBalancerArn"` 134 // The ID of the AWS account that owns the traffic mirror target. 135 OwnerId *string `pulumi:"ownerId"` 136 // Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 137 // 138 // **NOTE:** Either `networkInterfaceId` or `networkLoadBalancerArn` should be specified and both should not be specified together 139 Tags map[string]string `pulumi:"tags"` 140 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 141 // 142 // Deprecated: Please use `tags` instead. 143 TagsAll map[string]string `pulumi:"tagsAll"` 144 } 145 146 type TrafficMirrorTargetState struct { 147 // The ARN of the traffic mirror target. 148 Arn pulumi.StringPtrInput 149 // A description of the traffic mirror session. 150 Description pulumi.StringPtrInput 151 // The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target. 152 GatewayLoadBalancerEndpointId pulumi.StringPtrInput 153 // The network interface ID that is associated with the target. 154 NetworkInterfaceId pulumi.StringPtrInput 155 // The Amazon Resource Name (ARN) of the Network Load Balancer that is associated with the target. 156 NetworkLoadBalancerArn pulumi.StringPtrInput 157 // The ID of the AWS account that owns the traffic mirror target. 158 OwnerId pulumi.StringPtrInput 159 // Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 160 // 161 // **NOTE:** Either `networkInterfaceId` or `networkLoadBalancerArn` should be specified and both should not be specified together 162 Tags pulumi.StringMapInput 163 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 164 // 165 // Deprecated: Please use `tags` instead. 166 TagsAll pulumi.StringMapInput 167 } 168 169 func (TrafficMirrorTargetState) ElementType() reflect.Type { 170 return reflect.TypeOf((*trafficMirrorTargetState)(nil)).Elem() 171 } 172 173 type trafficMirrorTargetArgs struct { 174 // A description of the traffic mirror session. 175 Description *string `pulumi:"description"` 176 // The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target. 177 GatewayLoadBalancerEndpointId *string `pulumi:"gatewayLoadBalancerEndpointId"` 178 // The network interface ID that is associated with the target. 179 NetworkInterfaceId *string `pulumi:"networkInterfaceId"` 180 // The Amazon Resource Name (ARN) of the Network Load Balancer that is associated with the target. 181 NetworkLoadBalancerArn *string `pulumi:"networkLoadBalancerArn"` 182 // Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 183 // 184 // **NOTE:** Either `networkInterfaceId` or `networkLoadBalancerArn` should be specified and both should not be specified together 185 Tags map[string]string `pulumi:"tags"` 186 } 187 188 // The set of arguments for constructing a TrafficMirrorTarget resource. 189 type TrafficMirrorTargetArgs struct { 190 // A description of the traffic mirror session. 191 Description pulumi.StringPtrInput 192 // The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target. 193 GatewayLoadBalancerEndpointId pulumi.StringPtrInput 194 // The network interface ID that is associated with the target. 195 NetworkInterfaceId pulumi.StringPtrInput 196 // The Amazon Resource Name (ARN) of the Network Load Balancer that is associated with the target. 197 NetworkLoadBalancerArn pulumi.StringPtrInput 198 // Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 199 // 200 // **NOTE:** Either `networkInterfaceId` or `networkLoadBalancerArn` should be specified and both should not be specified together 201 Tags pulumi.StringMapInput 202 } 203 204 func (TrafficMirrorTargetArgs) ElementType() reflect.Type { 205 return reflect.TypeOf((*trafficMirrorTargetArgs)(nil)).Elem() 206 } 207 208 type TrafficMirrorTargetInput interface { 209 pulumi.Input 210 211 ToTrafficMirrorTargetOutput() TrafficMirrorTargetOutput 212 ToTrafficMirrorTargetOutputWithContext(ctx context.Context) TrafficMirrorTargetOutput 213 } 214 215 func (*TrafficMirrorTarget) ElementType() reflect.Type { 216 return reflect.TypeOf((**TrafficMirrorTarget)(nil)).Elem() 217 } 218 219 func (i *TrafficMirrorTarget) ToTrafficMirrorTargetOutput() TrafficMirrorTargetOutput { 220 return i.ToTrafficMirrorTargetOutputWithContext(context.Background()) 221 } 222 223 func (i *TrafficMirrorTarget) ToTrafficMirrorTargetOutputWithContext(ctx context.Context) TrafficMirrorTargetOutput { 224 return pulumi.ToOutputWithContext(ctx, i).(TrafficMirrorTargetOutput) 225 } 226 227 // TrafficMirrorTargetArrayInput is an input type that accepts TrafficMirrorTargetArray and TrafficMirrorTargetArrayOutput values. 228 // You can construct a concrete instance of `TrafficMirrorTargetArrayInput` via: 229 // 230 // TrafficMirrorTargetArray{ TrafficMirrorTargetArgs{...} } 231 type TrafficMirrorTargetArrayInput interface { 232 pulumi.Input 233 234 ToTrafficMirrorTargetArrayOutput() TrafficMirrorTargetArrayOutput 235 ToTrafficMirrorTargetArrayOutputWithContext(context.Context) TrafficMirrorTargetArrayOutput 236 } 237 238 type TrafficMirrorTargetArray []TrafficMirrorTargetInput 239 240 func (TrafficMirrorTargetArray) ElementType() reflect.Type { 241 return reflect.TypeOf((*[]*TrafficMirrorTarget)(nil)).Elem() 242 } 243 244 func (i TrafficMirrorTargetArray) ToTrafficMirrorTargetArrayOutput() TrafficMirrorTargetArrayOutput { 245 return i.ToTrafficMirrorTargetArrayOutputWithContext(context.Background()) 246 } 247 248 func (i TrafficMirrorTargetArray) ToTrafficMirrorTargetArrayOutputWithContext(ctx context.Context) TrafficMirrorTargetArrayOutput { 249 return pulumi.ToOutputWithContext(ctx, i).(TrafficMirrorTargetArrayOutput) 250 } 251 252 // TrafficMirrorTargetMapInput is an input type that accepts TrafficMirrorTargetMap and TrafficMirrorTargetMapOutput values. 253 // You can construct a concrete instance of `TrafficMirrorTargetMapInput` via: 254 // 255 // TrafficMirrorTargetMap{ "key": TrafficMirrorTargetArgs{...} } 256 type TrafficMirrorTargetMapInput interface { 257 pulumi.Input 258 259 ToTrafficMirrorTargetMapOutput() TrafficMirrorTargetMapOutput 260 ToTrafficMirrorTargetMapOutputWithContext(context.Context) TrafficMirrorTargetMapOutput 261 } 262 263 type TrafficMirrorTargetMap map[string]TrafficMirrorTargetInput 264 265 func (TrafficMirrorTargetMap) ElementType() reflect.Type { 266 return reflect.TypeOf((*map[string]*TrafficMirrorTarget)(nil)).Elem() 267 } 268 269 func (i TrafficMirrorTargetMap) ToTrafficMirrorTargetMapOutput() TrafficMirrorTargetMapOutput { 270 return i.ToTrafficMirrorTargetMapOutputWithContext(context.Background()) 271 } 272 273 func (i TrafficMirrorTargetMap) ToTrafficMirrorTargetMapOutputWithContext(ctx context.Context) TrafficMirrorTargetMapOutput { 274 return pulumi.ToOutputWithContext(ctx, i).(TrafficMirrorTargetMapOutput) 275 } 276 277 type TrafficMirrorTargetOutput struct{ *pulumi.OutputState } 278 279 func (TrafficMirrorTargetOutput) ElementType() reflect.Type { 280 return reflect.TypeOf((**TrafficMirrorTarget)(nil)).Elem() 281 } 282 283 func (o TrafficMirrorTargetOutput) ToTrafficMirrorTargetOutput() TrafficMirrorTargetOutput { 284 return o 285 } 286 287 func (o TrafficMirrorTargetOutput) ToTrafficMirrorTargetOutputWithContext(ctx context.Context) TrafficMirrorTargetOutput { 288 return o 289 } 290 291 // The ARN of the traffic mirror target. 292 func (o TrafficMirrorTargetOutput) Arn() pulumi.StringOutput { 293 return o.ApplyT(func(v *TrafficMirrorTarget) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 294 } 295 296 // A description of the traffic mirror session. 297 func (o TrafficMirrorTargetOutput) Description() pulumi.StringPtrOutput { 298 return o.ApplyT(func(v *TrafficMirrorTarget) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput) 299 } 300 301 // The VPC Endpoint Id of the Gateway Load Balancer that is associated with the target. 302 func (o TrafficMirrorTargetOutput) GatewayLoadBalancerEndpointId() pulumi.StringPtrOutput { 303 return o.ApplyT(func(v *TrafficMirrorTarget) pulumi.StringPtrOutput { return v.GatewayLoadBalancerEndpointId }).(pulumi.StringPtrOutput) 304 } 305 306 // The network interface ID that is associated with the target. 307 func (o TrafficMirrorTargetOutput) NetworkInterfaceId() pulumi.StringPtrOutput { 308 return o.ApplyT(func(v *TrafficMirrorTarget) pulumi.StringPtrOutput { return v.NetworkInterfaceId }).(pulumi.StringPtrOutput) 309 } 310 311 // The Amazon Resource Name (ARN) of the Network Load Balancer that is associated with the target. 312 func (o TrafficMirrorTargetOutput) NetworkLoadBalancerArn() pulumi.StringPtrOutput { 313 return o.ApplyT(func(v *TrafficMirrorTarget) pulumi.StringPtrOutput { return v.NetworkLoadBalancerArn }).(pulumi.StringPtrOutput) 314 } 315 316 // The ID of the AWS account that owns the traffic mirror target. 317 func (o TrafficMirrorTargetOutput) OwnerId() pulumi.StringOutput { 318 return o.ApplyT(func(v *TrafficMirrorTarget) pulumi.StringOutput { return v.OwnerId }).(pulumi.StringOutput) 319 } 320 321 // Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 322 // 323 // **NOTE:** Either `networkInterfaceId` or `networkLoadBalancerArn` should be specified and both should not be specified together 324 func (o TrafficMirrorTargetOutput) Tags() pulumi.StringMapOutput { 325 return o.ApplyT(func(v *TrafficMirrorTarget) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 326 } 327 328 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 329 // 330 // Deprecated: Please use `tags` instead. 331 func (o TrafficMirrorTargetOutput) TagsAll() pulumi.StringMapOutput { 332 return o.ApplyT(func(v *TrafficMirrorTarget) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 333 } 334 335 type TrafficMirrorTargetArrayOutput struct{ *pulumi.OutputState } 336 337 func (TrafficMirrorTargetArrayOutput) ElementType() reflect.Type { 338 return reflect.TypeOf((*[]*TrafficMirrorTarget)(nil)).Elem() 339 } 340 341 func (o TrafficMirrorTargetArrayOutput) ToTrafficMirrorTargetArrayOutput() TrafficMirrorTargetArrayOutput { 342 return o 343 } 344 345 func (o TrafficMirrorTargetArrayOutput) ToTrafficMirrorTargetArrayOutputWithContext(ctx context.Context) TrafficMirrorTargetArrayOutput { 346 return o 347 } 348 349 func (o TrafficMirrorTargetArrayOutput) Index(i pulumi.IntInput) TrafficMirrorTargetOutput { 350 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *TrafficMirrorTarget { 351 return vs[0].([]*TrafficMirrorTarget)[vs[1].(int)] 352 }).(TrafficMirrorTargetOutput) 353 } 354 355 type TrafficMirrorTargetMapOutput struct{ *pulumi.OutputState } 356 357 func (TrafficMirrorTargetMapOutput) ElementType() reflect.Type { 358 return reflect.TypeOf((*map[string]*TrafficMirrorTarget)(nil)).Elem() 359 } 360 361 func (o TrafficMirrorTargetMapOutput) ToTrafficMirrorTargetMapOutput() TrafficMirrorTargetMapOutput { 362 return o 363 } 364 365 func (o TrafficMirrorTargetMapOutput) ToTrafficMirrorTargetMapOutputWithContext(ctx context.Context) TrafficMirrorTargetMapOutput { 366 return o 367 } 368 369 func (o TrafficMirrorTargetMapOutput) MapIndex(k pulumi.StringInput) TrafficMirrorTargetOutput { 370 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *TrafficMirrorTarget { 371 return vs[0].(map[string]*TrafficMirrorTarget)[vs[1].(string)] 372 }).(TrafficMirrorTargetOutput) 373 } 374 375 func init() { 376 pulumi.RegisterInputType(reflect.TypeOf((*TrafficMirrorTargetInput)(nil)).Elem(), &TrafficMirrorTarget{}) 377 pulumi.RegisterInputType(reflect.TypeOf((*TrafficMirrorTargetArrayInput)(nil)).Elem(), TrafficMirrorTargetArray{}) 378 pulumi.RegisterInputType(reflect.TypeOf((*TrafficMirrorTargetMapInput)(nil)).Elem(), TrafficMirrorTargetMap{}) 379 pulumi.RegisterOutputType(TrafficMirrorTargetOutput{}) 380 pulumi.RegisterOutputType(TrafficMirrorTargetArrayOutput{}) 381 pulumi.RegisterOutputType(TrafficMirrorTargetMapOutput{}) 382 }