-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor cluster to not create EC2 resources by default
- Loading branch information
Showing
14 changed files
with
108 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"workbench.colorTheme": "Monokai Pro (Filter Ristretto)" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
data "aws_subnet" "any" { | ||
id = var.subnets[0] | ||
} | ||
|
||
locals { | ||
vpc_id = data.aws_subnet.any.vpc_id | ||
is_ec2 = var.ec2_settings != null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module "ec2" { | ||
/* | ||
EC2 machinery if using it as capacity provider | ||
*/ | ||
source = "./ec2" | ||
count = local.is_ec2 ? 1 : 0 | ||
|
||
name = var.name | ||
security_group_id = module.security_group.id | ||
extra_security_groups = var.extra_security_groups | ||
subnets = var.ec2_settings.subnets | ||
instance_type = var.ec2_settings.instance_type | ||
instance_key_name = var.ec2_settings.instance_key_name | ||
max_instances_count = var.ec2_settings.max_instances_count | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
data "aws_subnet" "any" { | ||
id = var.subnets[0] | ||
} | ||
|
||
locals { | ||
vpc_id = data.aws_subnet.any.vpc_id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
output "ecs_capacity_provider" { | ||
value = aws_ecs_capacity_provider.main | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
variable "name" { | ||
description = "The name of the cluster to manage." | ||
type = string | ||
} | ||
|
||
variable "security_group_id" { | ||
description = "The ID of the Security Group to assign to EC2 instances." | ||
type = string | ||
} | ||
|
||
variable "extra_security_groups" { | ||
type = list(string) | ||
default = [] | ||
} | ||
|
||
variable "subnets" { | ||
description = "The subnets to place objects in." | ||
type = list(string) | ||
} | ||
|
||
variable "instance_type" { | ||
description = "The instance type of the EC2 hosts to spin up." | ||
type = string | ||
} | ||
|
||
variable "instance_key_name" { | ||
description = "The SSH key name in EC2 to manually connect to hosts." | ||
type = string | ||
} | ||
|
||
variable "max_instances_count" { | ||
type = number | ||
description = "The maximum number of instances to provision in the cluster." | ||
default = 10 | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module "security_group" { | ||
/* | ||
The security group to wrap resources within the cluster | ||
*/ | ||
source = "emyller/security-group/aws" | ||
version = "~> 1.0" | ||
|
||
name = "ecs-${var.name}" | ||
vpc_id = var.vpc_id | ||
ingress_security_groups = var.ingress_security_groups | ||
ingress_cidr_blocks = var.ingress_cidr_blocks | ||
allow_self_ingress = true | ||
} |