-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
44 lines (33 loc) · 911 Bytes
/
main.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
data "aws_vpc" "peer" {
id = var.peer_vpc_id
}
data "aws_arn" "peer" {
arn = data.aws_vpc.peer.arn
}
module "label" {
source = "cloudposse/label/null"
version = "0.25.0"
attributes = ["pcx"]
context = module.this.context
}
resource "hcp_aws_network_peering" "this" {
count = local.enabled ? 1 : 0
hvn_id = var.hcp_hvn_id
peering_id = module.label.id
peer_vpc_id = data.aws_vpc.peer.id
peer_account_id = data.aws_vpc.peer.owner_id
peer_vpc_region = data.aws_arn.peer.region
timeouts {
create = var.create_timeout
delete = var.delete_timeout
}
}
resource "aws_vpc_peering_connection_accepter" "this" {
count = local.enabled ? 1 : 0
vpc_peering_connection_id = hcp_aws_network_peering.this[0].provider_peering_id
auto_accept = true
tags = module.label.tags
}
locals {
enabled = module.this.enabled
}