Skip to content

Commit

Permalink
Updated Files
Browse files Browse the repository at this point in the history
  • Loading branch information
aashishgoyal246 committed Apr 27, 2020
1 parent 6e4034f commit aea395f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 33 deletions.
35 changes: 6 additions & 29 deletions _example/different-account/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,37 +34,14 @@ module "transit-gateway" {
environment = "test"
label_order = ["environment", "application", "name"]

amazon_side_asn = 64512
auto_accept_shared_attachments = "enable"
default_route_table_propagation = "enable"
description = "This transit Gateway create for testing purpose"

#TGW Share
resource_share_enable = true
resource_share_allow_external_principals = true
resource_share_account_ids = ["XXXXXXXXXXXXX"]

# VPC Attachements
vpc_attachement_create = false # Enable After once create the subnets
vpc_id = module.vpc.vpc_id
destination_cidr_block = ["10.20.0.0/16"]
}

module "vpc-attachement" {
source = "./../../"
name = "transit-gateway"
application = "clouddrove"
environment = "test"
label_order = ["environment", "application", "name"]
#Transit gateway invitation accepter
aws_ram_resource_share_accepter = true
resource_share_arn = "arn:aws:ram:eu-west-1:XXXXXXXXXXX:resource-share/XXXXXXXXXXXXXXXXXXXXXXXXXX"

# VPC Attachements
vpc_id = module.vpc-other.vpc_id
destination_cidr_block = ["10.10.0.0/16"]
vpc_attachement_create = false # Enable After once create the subnets
vpc_id = module.vpc.vpc_id
use_existing_transit_gateway_id = true
transit_gateway_id = module.transit-gateway.transit_gateway_id

#Transit gateway invitation accepter
aws_ram_resource_share_accepter = true
resource_share_arn = module.transit-gateway.resource_share_arn
transit_gateway_id = "tgw-XXXXXXXXXXX"
destination_cidr_block = ["10.0.0.0/8", "172.16.0.0/12"]
}
4 changes: 2 additions & 2 deletions _example/single-account/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module "vpc-other" {
environment = "test"
label_order = ["environment", "application", "name"]

cidr_block = "10.20.0.0/16"
cidr_block = "192.168.0.0/16"
}

module "subnets-other" {
Expand Down Expand Up @@ -74,7 +74,7 @@ module "transit-gateway" {
# VPC Attachements
vpc_attachement_create = false # Enable After once create the subnets
vpc_id = module.vpc.vpc_id
destination_cidr_block = ["10.20.0.0/16"]
destination_cidr_block = ["192.168.0.0/16"]

}

Expand Down
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ data "aws_route_tables" "main" {

filter {
name = "tag:Application"
values = ["clouddrove"]
values = [var.application]
}
}

#Module : AWS ROUTE
#Description : Provides a resource to create a routing table entry (a route) in a VPC routing table.
resource "aws_route" "main" {
count = var.enable && var.vpc_attachement_create ? length(distinct(sort(data.aws_route_tables.main[0].ids)), ) : 0
count = var.enable && var.vpc_attachement_create ? length(distinct(sort(data.aws_route_tables.main[0].ids)), ) * length(var.destination_cidr_block) : 0

route_table_id = element(distinct(sort(data.aws_route_tables.main[0].ids)), count.index)
destination_cidr_block = element(distinct(sort(var.destination_cidr_block)), ceil(count.index / length(var.destination_cidr_block), ), )
Expand Down

0 comments on commit aea395f

Please sign in to comment.