Skip to content

Commit

Permalink
Transit net Module
Browse files Browse the repository at this point in the history
  • Loading branch information
jelinn committed May 29, 2020
0 parents commit b5de278
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#Azure Compute Module

##Who Maintains and Approves this Module?

##Usage

##Inputs

##Outputs
29 changes: 29 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
resource "random_integer" "tvpc_subnet" {
min = 1
max = 250
}

resource "aviatrix_vpc" "aws_transit" {
cloud_type = var.cloud_type
account_name = var.account_name
region = var.region
name = "transit-vpc${var.cloud_type}"
cidr = cidrsubnet("10.0.0.0/8", 8, random_integer.tvpc_subnet.result)
aviatrix_transit_vpc = (var.cloud_type == 1) ? true : false
aviatrix_firenet_vpc = (var.cloud_type == 1) ? false: true
}

resource "aviatrix_transit_gateway" "transit_gateway_tvpc" {
cloud_type = var.cloud_type
vpc_reg = var.region
vpc_id = aviatrix_vpc.aws_transit.vpc_id
account_name = aviatrix_vpc.aws_transit.account_name
gw_name = "tvpc-gw${var.cloud_type}"
ha_gw_size = var.avtx_gw_size
gw_size = var.avtx_gw_size
subnet = (var.cloud_type == 1) ? aviatrix_vpc.aws_transit.subnets[5].cidr : aviatrix_vpc.aws_transit.subnets[2].cidr
ha_subnet = (var.cloud_type == 1) ? aviatrix_vpc.aws_transit.subnets[7].cidr : aviatrix_vpc.aws_transit.subnets[3].cidr
enable_active_mesh = true
enable_hybrid_connection = (var.cloud_type == 1) ? true : false
connected_transit = true
}
26 changes: 26 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
output "tvpc_id" {
value = aviatrix_vpc.aws_transit.vpc_id
}

output "avtx_gw_name" {
value = aviatrix_transit_gateway.transit_gateway_tvpc.gw_name
}

output "transit_gw_public_ip" {
value = aviatrix_transit_gateway.transit_gateway_tvpc.eip
}

output "transit_gw_private_ip" {
value = aviatrix_transit_gateway.transit_gateway_tvpc.private_ip
}

output "transit_hagw_public_ip" {
value = aviatrix_transit_gateway.transit_gateway_tvpc.ha_eip
}

output "tvpc_cidr" {
value = aviatrix_vpc.aws_transit.cidr
}
#output "transit_hagw_private_ip" {
# value = aviatrix_transit_gateway.transit_gateway_tvpc.eip
#}
24 changes: 24 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
locals {
aws = 1
gcp = 4
azure = 8
}

variable cloud_type {
default = 1
}

variable region {
default = "us-east-1"
}

variable avtx_gw_size {
default = "t2.micro"
}

variable hpe {
default = false
}

variable account_name {}
#variable aws_transit_gw {}

0 comments on commit b5de278

Please sign in to comment.