Resource: aws_ec2_traffic_mirror_target

Provides a Traffic mirror target.
Read limits and considerations for traffic mirroring

Example Usage

To create a basic traffic mirror session

resource "aws_ec2_traffic_mirror_target" "nlb" {
  description               = "NLB target"
  network_load_balancer_arn = aws_lb.lb.arn
}

resource "aws_ec2_traffic_mirror_target" "eni" {
  description          = "ENI target"
  network_interface_id = aws_instance.test.primary_network_interface_id
}

resource "aws_ec2_traffic_mirror_target" "gwlb" {
  description                       = "GWLB target"
  gateway_load_balancer_endpoint_id = aws_vpc_endpoint.example.id
}

Argument Reference

This resource supports the following arguments:

NOTE: Either network_interface_id or network_load_balancer_arn should be specified and both should not be specified together

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Import

In Terraform v1.5.0 and later, use an import block to import traffic mirror targets using the id. For example:

import {
  to = aws_ec2_traffic_mirror_target.target
  id = "tmt-0c13a005422b86606"
}

Using terraform import, import traffic mirror targets using the id. For example:

% terraform import aws_ec2_traffic_mirror_target.target tmt-0c13a005422b86606