Skip to content

Commit 65b5140

Browse files
committed
Reorganizing code and adding variables to service
1 parent 065ad1f commit 65b5140

File tree

12 files changed

+313
-516
lines changed

12 files changed

+313
-516
lines changed

CODE_OF_CONDUCT.md

Lines changed: 0 additions & 94 deletions
This file was deleted.

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,37 @@ Check valid versions on:
3636
}
3737

3838
Check the section "Other modules that you may need to use this module" for details about modules mentioned in the usage example.
39+
<<<<<<< HEAD
40+
=======
41+
42+
## Input values
43+
* name_preffix: Name preffix for resources on AWS.
44+
* profile: AWS API key credentials to use.
45+
* region: AWS Region the infrastructure is hosted in.
46+
47+
* task_definition_arn: (Required) The full ARN of the task definition that you want to run in your service.
48+
* ecs_cluster_arn: ARN of an ECS cluster
49+
* desired_count: (Optional) The number of instances of the task definition to place and keep running. Defaults to 1.
50+
* platform_version: (Optional) The platform version on which to run your service. Defaults to LATEST. More information about Fargate platform versions can be found in the AWS ECS User Guide.
51+
* deployment_maximum_percent: (Optional) The upper limit (as a percentage of the service's desiredCount) of the number of running tasks that can be running in a service during a deployment.
52+
* deployment_minimum_healthy_percent: (Optional) The lower limit (as a percentage of the service's desiredCount) of the number of running tasks that must remain running and healthy in a service during a deployment.
53+
* enable_ecs_managed_tags: (Optional) Specifies whether to enable Amazon ECS managed tags for the tasks within the service.
54+
* propagate_tags: (Optional) Specifies whether to propagate the tags from the task definition or the service to the tasks. The valid values are SERVICE and TASK_DEFINITION. Default to SERVICE
55+
* ordered_placement_strategy: (Optional) Service level strategy rules that are taken into consideration during task placement. List from top to bottom in order of precedence. The maximum number of ordered_placement_strategy blocks is 5. This is a list of maps where each map should contain "id" and "field".
56+
* health_check_grace_period_seconds: (Optional) Seconds to ignore failing load balancer health checks on newly instantiated tasks to prevent premature shutdown, up to 2147483647. Only valid for services configured to use load balancers.
57+
* placement_constraints: (Optional) rules that are taken into consideration during task placement. Maximum number of placement_constraints is 10. This is a list of maps, where each map should contain "type" and "expression".
58+
* service_registries: (Optional) The service discovery registries for the service. The maximum number of service_registries blocks is 1. This is a map that should contain the following fields "registry_arn", "port", "container_port" and "container_name".
59+
* subnets: The subnets associated with the task or service.
60+
* security_groups: (Optional) The security groups associated with the task or service. If you do not specify a security group, the default security group for the VPC is used.
61+
* assign_public_ip: (Optional) Assign a public IP address to the ENI (Fargate launch type only). Valid values are true or false. Default false.
62+
>>>>>>> Reorganizing code and adding variables to service
3963
4064
## Output values
4165

66+
* aws_ecs_service_service_id: The Amazon Resource Name (ARN) that identifies the service.
67+
* aws_ecs_service_service_name: The name of the service.
68+
* aws_ecs_service_service_cluster: The Amazon Resource Name (ARN) of cluster which the service runs on.
69+
* aws_ecs_service_service_desired_count: The number of instances of the task definition.
4270
* lb_id: Load Balancer ID.
4371
* lb_arn: Load Balancer ARN.
4472
* lb_arn_suffix: Load Balancer ARN Suffix.
@@ -60,9 +88,15 @@ The networking module should look like this:
6088
module "networking" {
6189
source = "jnonino/networking/aws"
6290
version = "2.0.3"
91+
<<<<<<< HEAD
6392
name_preffix = var.name_preffix
6493
profile = var.profile
6594
region = var.region
95+
=======
96+
name_preffix = "base"
97+
profile = "aws_profile"
98+
region = "us-east-1"
99+
>>>>>>> Reorganizing code and adding variables to service
66100
vpc_cidr_block = "192.168.0.0/16"
67101
availability_zones = [ "us-east-1a", "us-east-1b", "us-east-1c", "us-east-1d" ]
68102
public_subnets_cidrs_per_availability_zone = [ "192.168.0.0/19", "192.168.32.0/19", "192.168.64.0/19", "192.168.96.0/19" ]

autoscaling.tf

Lines changed: 0 additions & 90 deletions
This file was deleted.

files/iam/ecs_task_execution_iam_role.json

Lines changed: 0 additions & 13 deletions
This file was deleted.

iam.tf

Lines changed: 0 additions & 29 deletions
This file was deleted.

load_balancing.tf renamed to load-balancing.tf

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
# ---------------------------------------------------------------------------------------------------------------------
2-
# AWS Load Balancer
2+
# AWS SECURITY GROUP - Control Access to ALB
3+
# ---------------------------------------------------------------------------------------------------------------------
4+
resource "aws_security_group" "lb_sg" {
5+
name = "${var.name_preffix}-lb-sg"
6+
description = "Control access to LB"
7+
vpc_id = var.vpc_id
8+
ingress {
9+
protocol = "tcp"
10+
from_port = 80
11+
to_port = 80
12+
cidr_blocks = ["0.0.0.0/0"]
13+
}
14+
egress {
15+
protocol = "-1"
16+
from_port = 0
17+
to_port = 0
18+
cidr_blocks = ["0.0.0.0/0"]
19+
}
20+
tags = {
21+
Name = "${var.name_preffix}-lb-sg"
22+
}
23+
}
24+
25+
# ---------------------------------------------------------------------------------------------------------------------
26+
# AWS LOAD BALANCER
327
# ---------------------------------------------------------------------------------------------------------------------
428
resource "aws_lb" "lb" {
529
name = "${var.name_preffix}-lb"
@@ -15,7 +39,7 @@ resource "aws_lb" "lb" {
1539
}
1640

1741
# ---------------------------------------------------------------------------------------------------------------------
18-
# AWS LB Target Group
42+
# AWS LOAD BALANCER - Target Group
1943
# ---------------------------------------------------------------------------------------------------------------------
2044
resource "aws_lb_target_group" "lb_tg" {
2145
depends_on = [aws_lb.lb]
@@ -34,7 +58,7 @@ resource "aws_lb_target_group" "lb_tg" {
3458
}
3559

3660
# ---------------------------------------------------------------------------------------------------------------------
37-
# AWS LB Listener
61+
# AWS LOAD BALANCER - Listener
3862
# ---------------------------------------------------------------------------------------------------------------------
3963
resource "aws_lb_listener" "listener" {
4064
depends_on = [aws_lb_target_group.lb_tg]

logs.tf

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)