-
Notifications
You must be signed in to change notification settings - Fork 0
/
tm.tf
34 lines (25 loc) · 1.07 KB
/
tm.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Copyright 2023 Uli Heilmeier, Vitesco Technologies
#
# SPDX-License-Identifier: Apache-2.0
resource "time_sleep" "wait_30_seconds" {
depends_on = [aws_instance.tm-ec2-target]
create_duration = "30s"
}
resource "aws_ec2_traffic_mirror_target" "tm_eni_target" {
description = "Org TM ENI target"
network_interface_id = aws_network_interface.capture.id
depends_on = [time_sleep.wait_30_seconds]
tags = merge(var.tf_tags, {Name = "traffic-mirror-eni-target"})
}
resource "aws_ram_resource_share" "tm_eni_target_share" {
name = "TM Target Share - ${var.region}"
tags = merge(var.tf_tags, {Name = "traffic-mirror-eni-target"})
}
resource "aws_ram_principal_association" "tm_eni_target_share_ass" {
principal = data.aws_organizations_organization.current.arn
resource_share_arn = aws_ram_resource_share.tm_eni_target_share.arn
}
resource "aws_ram_resource_association" "tm_eni_target_ass" {
resource_arn = aws_ec2_traffic_mirror_target.tm_eni_target.arn
resource_share_arn = aws_ram_resource_share.tm_eni_target_share.arn
}