Skip to content

Commit

Permalink
Merge pull request #242 from silinternational/feature/tgw
Browse files Browse the repository at this point in the history
Add option to use a transit gateway in the VPC
  • Loading branch information
briskt authored Feb 23, 2024
2 parents 72dcd31 + 27aa0e7 commit b00c7bf
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 25 deletions.
2 changes: 1 addition & 1 deletion terraform/000-core/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Create ECS cluster
*/
module "ecscluster" {
source = "github.com/silinternational/terraform-modules//aws/ecs/cluster?ref=8.6.0"
source = "github.com/silinternational/terraform-modules//aws/ecs/cluster?ref=8.7.0"
cluster_name = var.cluster_name
}

Expand Down
28 changes: 16 additions & 12 deletions terraform/010-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,25 @@
* Create VPC
*/
module "vpc" {
source = "github.com/silinternational/terraform-modules//aws/vpc?ref=8.6.0"
app_name = var.app_name
app_env = var.app_env
aws_zones = var.aws_zones
create_nat_gateway = var.create_nat_gateway
private_subnet_cidr_blocks = var.private_subnet_cidr_blocks
public_subnet_cidr_blocks = var.public_subnet_cidr_blocks
vpc_cidr_block = var.vpc_cidr_block
source = "github.com/silinternational/terraform-modules//aws/vpc?ref=8.7.0"
app_name = var.app_name
app_env = var.app_env
aws_zones = var.aws_zones
create_nat_gateway = var.create_nat_gateway
private_subnet_cidr_blocks = var.private_subnet_cidr_blocks
public_subnet_cidr_blocks = var.public_subnet_cidr_blocks
vpc_cidr_block = var.vpc_cidr_block
use_transit_gateway = var.use_transit_gateway
transit_gateway_id = var.transit_gateway_id
transit_gateway_default_route_table_association = var.transit_gateway_default_route_table_association
transit_gateway_default_route_table_propagation = var.transit_gateway_default_route_table_propagation
}

/*
* Security group to limit traffic to Cloudflare IPs
*/
module "cloudflare-sg" {
source = "github.com/silinternational/terraform-modules//aws/cloudflare-sg?ref=8.6.0"
source = "github.com/silinternational/terraform-modules//aws/cloudflare-sg?ref=8.7.0"
vpc_id = module.vpc.id
}

Expand All @@ -37,7 +41,7 @@ data "aws_ami" "ecs_ami" {
* Create auto-scaling group
*/
module "asg" {
source = "github.com/silinternational/terraform-modules//aws/asg?ref=8.6.0"
source = "github.com/silinternational/terraform-modules//aws/asg?ref=8.7.0"
app_name = var.app_name
app_env = var.app_env
aws_instance = var.aws_instance
Expand All @@ -61,7 +65,7 @@ data "aws_acm_certificate" "wildcard" {
* Create application load balancer for public access
*/
module "alb" {
source = "github.com/silinternational/terraform-modules//aws/alb?ref=8.6.0"
source = "github.com/silinternational/terraform-modules//aws/alb?ref=8.7.0"
app_name = var.app_name
app_env = var.app_env
internal = "false"
Expand All @@ -75,7 +79,7 @@ module "alb" {
* Create application load balancer for internal use
*/
module "internal_alb" {
source = "github.com/silinternational/terraform-modules//aws/alb?ref=8.6.0"
source = "github.com/silinternational/terraform-modules//aws/alb?ref=8.7.0"
alb_name = "alb-${var.app_name}-${var.app_env}-int"
app_name = var.app_name
app_env = var.app_env
Expand Down
24 changes: 24 additions & 0 deletions terraform/010-cluster/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ variable "create_nat_gateway" {
default = true
}

variable "use_transit_gateway" {
description = "Set to true to attach a transit gateway to this VPC and route traffic to it. Use in conjunction with transit_gateway_id and create_nat_gateway=false."
type = bool
default = false
}

variable "ecs_cluster_name" {
type = string
}
Expand Down Expand Up @@ -68,6 +74,24 @@ variable "tags" {
default = {}
}

variable "transit_gateway_id" {
description = "The ID of the transit gateway to attach to when using create_transit_gateway_attachment."
type = string
default = ""
}

variable "transit_gateway_default_route_table_association" {
description = "Whether or not to associate with the default route table of the transit gateway."
type = bool
default = true
}

variable "transit_gateway_default_route_table_propagation" {
description = "Whether or not to send propagation of this route to the default route table of the transit gateway."
type = bool
default = true
}

variable "vpc_cidr_block" {
description = "The block of IP addresses (as a CIDR) the VPC should use"
type = string
Expand Down
2 changes: 1 addition & 1 deletion terraform/020-database/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ resource "random_id" "db_root_pass" {
}

module "rds" {
source = "github.com/silinternational/terraform-modules//aws/rds/mariadb?ref=8.6.0"
source = "github.com/silinternational/terraform-modules//aws/rds/mariadb?ref=8.7.0"
app_name = var.app_name
app_env = var.app_env
db_name = var.db_name
Expand Down
8 changes: 4 additions & 4 deletions terraform/022-ecr/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* id-broker
*/
module "ecr_idbroker" {
source = "github.com/silinternational/terraform-modules//aws/ecr?ref=8.6.0"
source = "github.com/silinternational/terraform-modules//aws/ecr?ref=8.7.0"
repo_name = "${var.idp_name}/id-broker"
ecsInstanceRole_arn = var.ecsInstanceRole_arn
ecsServiceRole_arn = var.ecsServiceRole_arn
Expand All @@ -15,7 +15,7 @@ module "ecr_idbroker" {
* pw-api
*/
module "ecr_pwapi" {
source = "github.com/silinternational/terraform-modules//aws/ecr?ref=8.6.0"
source = "github.com/silinternational/terraform-modules//aws/ecr?ref=8.7.0"
repo_name = "${var.idp_name}/pw-api"
ecsInstanceRole_arn = var.ecsInstanceRole_arn
ecsServiceRole_arn = var.ecsServiceRole_arn
Expand All @@ -28,7 +28,7 @@ module "ecr_pwapi" {
* simplesamlphp
*/
module "ecr_simplesamlphp" {
source = "github.com/silinternational/terraform-modules//aws/ecr?ref=8.6.0"
source = "github.com/silinternational/terraform-modules//aws/ecr?ref=8.7.0"
repo_name = "${var.idp_name}/simplesamlphp"
ecsInstanceRole_arn = var.ecsInstanceRole_arn
ecsServiceRole_arn = var.ecsServiceRole_arn
Expand All @@ -41,7 +41,7 @@ module "ecr_simplesamlphp" {
* id-sync
*/
module "ecr_idsync" {
source = "github.com/silinternational/terraform-modules//aws/ecr?ref=8.6.0"
source = "github.com/silinternational/terraform-modules//aws/ecr?ref=8.7.0"
repo_name = "${var.idp_name}/id-sync"
ecsInstanceRole_arn = var.ecsInstanceRole_arn
ecsServiceRole_arn = var.ecsServiceRole_arn
Expand Down
4 changes: 2 additions & 2 deletions terraform/031-email-service/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ locals {
}

module "ecsservice_api" {
source = "github.com/silinternational/terraform-modules//aws/ecs/service-only?ref=8.6.0"
source = "github.com/silinternational/terraform-modules//aws/ecs/service-only?ref=8.7.0"
cluster_id = var.ecs_cluster_id
service_name = "${var.idp_name}-${var.app_name}-api"
service_env = var.app_env
Expand Down Expand Up @@ -177,7 +177,7 @@ locals {
}

module "ecsservice_cron" {
source = "github.com/silinternational/terraform-modules//aws/ecs/service-no-alb?ref=8.6.0"
source = "github.com/silinternational/terraform-modules//aws/ecs/service-no-alb?ref=8.7.0"
cluster_id = var.ecs_cluster_id
service_name = "${var.idp_name}-${var.app_name}-cron"
service_env = var.app_env
Expand Down
2 changes: 1 addition & 1 deletion terraform/040-id-broker/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ locals {
}

module "ecsservice" {
source = "github.com/silinternational/terraform-modules//aws/ecs/service-only?ref=8.6.0"
source = "github.com/silinternational/terraform-modules//aws/ecs/service-only?ref=8.7.0"
cluster_id = var.ecs_cluster_id
service_name = "${var.idp_name}-${var.app_name}"
service_env = var.app_env
Expand Down
2 changes: 1 addition & 1 deletion terraform/050-pw-manager/main-api.tf
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ locals {
}

module "ecsservice" {
source = "github.com/silinternational/terraform-modules//aws/ecs/service-only?ref=8.6.0"
source = "github.com/silinternational/terraform-modules//aws/ecs/service-only?ref=8.7.0"
cluster_id = var.ecs_cluster_id
service_name = "${var.idp_name}-${var.app_name}"
service_env = var.app_env
Expand Down
2 changes: 1 addition & 1 deletion terraform/060-simplesamlphp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ This module is used to create an ECS service running simpleSAMLphp.

```hcl
module "cf_ips" {
source = "github.com/silinternational/terraform-modules//cloudflare/ips?ref=8.6.0"
source = "github.com/silinternational/terraform-modules//cloudflare/ips?ref=8.7.0"
}
module "ssp" {
Expand Down
4 changes: 2 additions & 2 deletions terraform/060-simplesamlphp/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ resource "random_id" "secretsalt" {
}

module "cf_ips" {
source = "github.com/silinternational/terraform-modules//cloudflare/ips?ref=8.6.0"
source = "github.com/silinternational/terraform-modules//cloudflare/ips?ref=8.7.0"
}

locals {
Expand Down Expand Up @@ -111,7 +111,7 @@ locals {
}

module "ecsservice" {
source = "github.com/silinternational/terraform-modules//aws/ecs/service-only?ref=8.6.0"
source = "github.com/silinternational/terraform-modules//aws/ecs/service-only?ref=8.7.0"
cluster_id = var.ecs_cluster_id
service_name = "${var.idp_name}-${var.app_name}"
service_env = var.app_env
Expand Down

0 comments on commit b00c7bf

Please sign in to comment.