-
Notifications
You must be signed in to change notification settings - Fork 0
/
peering_connection.tf
64 lines (53 loc) · 2.25 KB
/
peering_connection.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#---------------------------------------------------------------------------------------------------------
# Requester's side of the connection.
#---------------------------------------------------------------------------------------------------------
resource "aws_vpc_peering_connection" "this" {
provider = aws.this
vpc_id = var.this_vpc_id
peer_vpc_id = var.peer_vpc_id
peer_owner_id = data.aws_caller_identity.peer.account_id
peer_region = data.aws_region.this.name
# auto_accept = false
tags = {
Side = "Requester"
}
}
#---------------------------------------------------------------------------------------------------------
# Accepter's side of the connection.
#---------------------------------------------------------------------------------------------------------
resource "aws_vpc_peering_connection_accepter" "peer" {
provider = aws.peer
vpc_peering_connection_id = aws_vpc_peering_connection.this.id
auto_accept = var.auto_accept_peering_connection
tags = {
Side = "Accepter"
}
}
#---------------------------------------------------------------------------------------------------------
# Accepter's side of the connection options.
#---------------------------------------------------------------------------------------------------------
resource "aws_vpc_peering_connection_options" "peer" {
provider = aws.peer
vpc_peering_connection_id = aws_vpc_peering_connection.this.id
accepter {
allow_remote_vpc_dns_resolution = var.allow_this_resolve_dns_in_peer
}
depends_on = [
aws_vpc_peering_connection.this,
aws_vpc_peering_connection_accepter.peer
]
}
#---------------------------------------------------------------------------------------------------------
# Accepter's side of the connection options.
#---------------------------------------------------------------------------------------------------------
resource "aws_vpc_peering_connection_options" "this" {
provider = aws.this
vpc_peering_connection_id = aws_vpc_peering_connection.this.id
requester {
allow_remote_vpc_dns_resolution = var.allow_peer_resolve_dns_in_this
}
depends_on = [
aws_vpc_peering_connection.this,
aws_vpc_peering_connection_accepter.peer
]
}