diff --git a/_example/diffrent-account/example.tf b/_example/different-account/example.tf similarity index 99% rename from _example/diffrent-account/example.tf rename to _example/different-account/example.tf index 81ff1a5..6abcdf6 100644 --- a/_example/diffrent-account/example.tf +++ b/_example/different-account/example.tf @@ -44,5 +44,4 @@ module "transit-gateway" { use_existing_transit_gateway_id = true transit_gateway_id = "tgw-XXXXXXXXXXX" destination_cidr_block = ["10.0.0.0/8", "172.16.0.0/12"] - -} +} \ No newline at end of file diff --git a/_example/diffrent-account/outputs.tf b/_example/different-account/outputs.tf similarity index 100% rename from _example/diffrent-account/outputs.tf rename to _example/different-account/outputs.tf diff --git a/_example/single-account/example.tf b/_example/single-account/example.tf index 54f82c2..46fc739 100644 --- a/_example/single-account/example.tf +++ b/_example/single-account/example.tf @@ -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" { @@ -64,7 +64,7 @@ module "transit-gateway" { amazon_side_asn = 64512 auto_accept_shared_attachments = "enable" default_route_table_propagation = "enable" - description = "This transit Gateway create for testung purpose" + description = "This transit Gateway create for testing purpose" #TGW Share resource_share_enable = false @@ -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.0.0.0/8", "172.16.0.0/12"] + destination_cidr_block = ["192.168.0.0/16"] } @@ -86,9 +86,9 @@ module "vpc-attachement" { label_order = ["environment", "application", "name"] # VPC Attachements - vpc_id = module.vpc-other.vpc_id - destination_cidr_block = ["10.0.0.0/8", "172.16.0.0/12"] - vpc_attachement_create = false # Enable After once create the subnets + 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 use_existing_transit_gateway_id = true transit_gateway_id = module.transit-gateway.transit_gateway_id -} +} \ No newline at end of file diff --git a/main.tf b/main.tf index f5b8d03..031d111 100644 --- a/main.tf +++ b/main.tf @@ -52,6 +52,10 @@ resource "aws_ec2_transit_gateway_vpc_attachment" "main" { "Name" = format("%s-vpc-attachment", module.labels.id) } ) + + depends_on = [ + data.aws_subnet_ids.main + ] } #Module : AWS RAM RESOURCE SHARE @@ -90,6 +94,11 @@ resource "aws_ram_resource_association" "main" { data "aws_route_tables" "main" { count = var.enable && var.vpc_attachement_create ? 1 : 0 vpc_id = var.vpc_id + + filter { + name = "tag:Application" + values = [var.application] + } } #Module : AWS ROUTE @@ -102,6 +111,7 @@ resource "aws_route" "main" { transit_gateway_id = var.use_existing_transit_gateway_id == false ? join("", aws_ec2_transit_gateway.main.*.id) : var.transit_gateway_id depends_on = [ data.aws_route_tables.main, + data.aws_subnet_ids.main, aws_ec2_transit_gateway_vpc_attachment.main, ] } @@ -109,5 +119,4 @@ resource "aws_route" "main" { resource "aws_ram_resource_share_accepter" "receiver_accept" { count = var.enable && var.aws_ram_resource_share_accepter ? 1 : 0 share_arn = var.resource_share_arn -} - +} \ No newline at end of file diff --git a/outputs.tf b/outputs.tf index 807e352..cacfad5 100644 --- a/outputs.tf +++ b/outputs.tf @@ -14,5 +14,4 @@ output "resource_share_arn" { output "tags" { value = module.labels.tags description = "A mapping of tags to assign to the resource." -} - +} \ No newline at end of file diff --git a/variables.tf b/variables.tf index a83bb5e..8437e5c 100644 --- a/variables.tf +++ b/variables.tf @@ -167,4 +167,4 @@ variable "aws_ram_resource_share_accepter" { type = bool default = false description = "Accepter the RAM." -} +} \ No newline at end of file