Skip to content

Commit 6251ae7

Browse files
committed
refactor: change terraform version and add aws provider version
Change variables and outputs descriptions. Add ecs architecture diagram.
1 parent 3b130d6 commit 6251ae7

File tree

6 files changed

+69
-57
lines changed

6 files changed

+69
-57
lines changed

.header.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
# terraform-aws-ecs
22

33
A Terraform module to create ECS Cluster that relies on self-managed EC2 instances.
4+
5+
## Architecture Diagram
6+
7+
![ECS Architecture Diagram](./diagrams/ecs-architecture.png)

README.md

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@
33

44
A Terraform module to create ECS Cluster that relies on self-managed EC2 instances.
55

6+
## Architecture Diagram
7+
8+
![ECS Architecture Diagram](./diagrams/ecs-architecture.png)
9+
610
## Requirements
711

812
| Name | Version |
913
|------|---------|
10-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.6.0 |
14+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.8.4 |
15+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.51.0 |
1116

1217
## Providers
1318

@@ -29,36 +34,36 @@ No resources.
2934
| Name | Description | Type | Default | Required |
3035
|------|-------------|------|---------|:--------:|
3136
| <a name="input_asg_create_launch_template"></a> [asg\_create\_launch\_template](#input\_asg\_create\_launch\_template) | Either to create a Launch Template to associate with the Autoscaling group | `bool` | `true` | no |
32-
| <a name="input_asg_desired_capacity"></a> [asg\_desired\_capacity](#input\_asg\_desired\_capacity) | Desired capacity for the Autoscaling group | `number` | n/a | yes |
33-
| <a name="input_asg_iam_instance_profile_name"></a> [asg\_iam\_instance\_profile\_name](#input\_asg\_iam\_instance\_profile\_name) | Name of the IAM Instance Profile | `string` | `null` | no |
34-
| <a name="input_asg_iam_instance_profile_tags"></a> [asg\_iam\_instance\_profile\_tags](#input\_asg\_iam\_instance\_profile\_tags) | Resource Tags for the IAM Instance Profile | `map(any)` | `{}` | no |
35-
| <a name="input_asg_iam_role_name"></a> [asg\_iam\_role\_name](#input\_asg\_iam\_role\_name) | Name for the IAM Role | `string` | `null` | no |
36-
| <a name="input_asg_iam_role_policy_attachments"></a> [asg\_iam\_role\_policy\_attachments](#input\_asg\_iam\_role\_policy\_attachments) | Policy ARNs to attach to the IAM Role | `list(string)` | <pre>[<br> "arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role"<br>]</pre> | no |
37-
| <a name="input_asg_iam_role_tags"></a> [asg\_iam\_role\_tags](#input\_asg\_iam\_role\_tags) | Resource Tags for IAM Role | `map(any)` | `{}` | no |
38-
| <a name="input_asg_instances_tags"></a> [asg\_instances\_tags](#input\_asg\_instances\_tags) | Resources Tags to propagate to the Instances | `map(any)` | `{}` | no |
39-
| <a name="input_asg_launch_template"></a> [asg\_launch\_template](#input\_asg\_launch\_template) | Launch Template to use with the Autoscaling group | <pre>object({<br> name = optional(string, null)<br> image_id = optional(string, null)<br> instance_type = optional(string, null)<br> vpc_security_group_ids = optional(list(string), [])<br> key_name = optional(string, null)<br> user_data = optional(string, null)<br> tags = optional(map(any), {})<br> })</pre> | `{}` | no |
37+
| <a name="input_asg_desired_capacity"></a> [asg\_desired\_capacity](#input\_asg\_desired\_capacity) | The number of Amazon EC2 instances that should be running in the group. | `number` | n/a | yes |
38+
| <a name="input_asg_iam_instance_profile_name"></a> [asg\_iam\_instance\_profile\_name](#input\_asg\_iam\_instance\_profile\_name) | (Optional, Forces new resource) Name of the instance profile. | `string` | `null` | no |
39+
| <a name="input_asg_iam_instance_profile_tags"></a> [asg\_iam\_instance\_profile\_tags](#input\_asg\_iam\_instance\_profile\_tags) | (Optional) Map of resource tags for the IAM Instance Profile. | `map(string)` | `{}` | no |
40+
| <a name="input_asg_iam_role_name"></a> [asg\_iam\_role\_name](#input\_asg\_iam\_role\_name) | (Optional, Forces new resource) Friendly name of the role. | `string` | `null` | no |
41+
| <a name="input_asg_iam_role_policy_attachments"></a> [asg\_iam\_role\_policy\_attachments](#input\_asg\_iam\_role\_policy\_attachments) | (Required) - The ARN of the policy you want to apply | `list(string)` | <pre>[<br> "arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role"<br>]</pre> | no |
42+
| <a name="input_asg_iam_role_tags"></a> [asg\_iam\_role\_tags](#input\_asg\_iam\_role\_tags) | Key-value mapping of tags for the IAM role. | `map(string)` | `{}` | no |
43+
| <a name="input_asg_instances_tags"></a> [asg\_instances\_tags](#input\_asg\_instances\_tags) | Resources Tags to propagate to the Instances | `map(string)` | `{}` | no |
44+
| <a name="input_asg_launch_template"></a> [asg\_launch\_template](#input\_asg\_launch\_template) | Launch Template to use with the Autoscaling group | <pre>object({<br> name = optional(string, null)<br> image_id = optional(string, null)<br> instance_type = optional(string, null)<br> vpc_security_group_ids = optional(list(string), [])<br> key_name = optional(string, null)<br> user_data = optional(string, null)<br> tags = optional(map(string), {})<br> })</pre> | `{}` | no |
4045
| <a name="input_asg_launch_template_id"></a> [asg\_launch\_template\_id](#input\_asg\_launch\_template\_id) | Identifier of the Launch Template | `string` | `null` | no |
41-
| <a name="input_asg_max_size"></a> [asg\_max\_size](#input\_asg\_max\_size) | Max. size for the Autoscaling group | `number` | n/a | yes |
42-
| <a name="input_asg_min_size"></a> [asg\_min\_size](#input\_asg\_min\_size) | Min. size for the Autoscaling group | `number` | n/a | yes |
43-
| <a name="input_asg_name"></a> [asg\_name](#input\_asg\_name) | Name of the Autoscaling Group | `string` | n/a | yes |
44-
| <a name="input_asg_tags"></a> [asg\_tags](#input\_asg\_tags) | Resources Tags for Autoscaling group | `map(any)` | `{}` | no |
45-
| <a name="input_asg_vpc_zone_identifier"></a> [asg\_vpc\_zone\_identifier](#input\_asg\_vpc\_zone\_identifier) | Identifiers of the VPC Subnets | `list(string)` | n/a | yes |
46-
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | Name of the ECS Cluster to create | `string` | n/a | yes |
47-
| <a name="input_cluster_setting"></a> [cluster\_setting](#input\_cluster\_setting) | Details of the setting configuration | <pre>list(object({<br> name = string<br> value = string<br> }))</pre> | `[]` | no |
48-
| <a name="input_cluster_tags"></a> [cluster\_tags](#input\_cluster\_tags) | Resource Tags for ECS Cluster | `map(any)` | `{}` | no |
46+
| <a name="input_asg_max_size"></a> [asg\_max\_size](#input\_asg\_max\_size) | Maximum size of the Auto Scaling Group | `number` | n/a | yes |
47+
| <a name="input_asg_min_size"></a> [asg\_min\_size](#input\_asg\_min\_size) | Minimum size of the Auto Scaling Group | `number` | n/a | yes |
48+
| <a name="input_asg_name"></a> [asg\_name](#input\_asg\_name) | (Optional) Name of the Auto Scaling Group. | `string` | n/a | yes |
49+
| <a name="input_asg_tags"></a> [asg\_tags](#input\_asg\_tags) | Resources Tags for Autoscaling group | `map(string)` | `{}` | no |
50+
| <a name="input_asg_vpc_zone_identifier"></a> [asg\_vpc\_zone\_identifier](#input\_asg\_vpc\_zone\_identifier) | (Optional) List of subnet IDs to launch resources in. | `list(string)` | n/a | yes |
51+
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | (Required) Name of the cluster | `string` | n/a | yes |
52+
| <a name="input_cluster_setting"></a> [cluster\_setting](#input\_cluster\_setting) | (Optional) Configuration block(s) with cluster settings. | <pre>list(object({<br> name = string<br> value = string<br> }))</pre> | `[]` | no |
53+
| <a name="input_cluster_tags"></a> [cluster\_tags](#input\_cluster\_tags) | (Optional) Key-value map of resource tags. | `map(string)` | `{}` | no |
4954

5055
## Outputs
5156

5257
| Name | Description |
5358
|------|-------------|
54-
| <a name="output_asg_arn"></a> [asg\_arn](#output\_asg\_arn) | ARN of the Autoscaling group |
55-
| <a name="output_asg_iam_instance_profile_arn"></a> [asg\_iam\_instance\_profile\_arn](#output\_asg\_iam\_instance\_profile\_arn) | ARN of the IAM Instance Profile being used with the Launch Template |
56-
| <a name="output_asg_iam_instance_profile_id"></a> [asg\_iam\_instance\_profile\_id](#output\_asg\_iam\_instance\_profile\_id) | Identifier of the IAM Instance Profile being used with the Launch Template |
57-
| <a name="output_asg_iam_role_id"></a> [asg\_iam\_role\_id](#output\_asg\_iam\_role\_id) | Identifier of the IAM Role being used with the IAM Instnace Profile |
58-
| <a name="output_asg_id"></a> [asg\_id](#output\_asg\_id) | Identifier of the Autoscaling group |
59-
| <a name="output_asg_launch_template_arn"></a> [asg\_launch\_template\_arn](#output\_asg\_launch\_template\_arn) | ARN of the Launch Template being used with the Autoscaling Group |
60-
| <a name="output_asg_launch_template_id"></a> [asg\_launch\_template\_id](#output\_asg\_launch\_template\_id) | Identifier of the Launch Template being used with the Autoscaling Group |
61-
| <a name="output_cluster_arn"></a> [cluster\_arn](#output\_cluster\_arn) | ARN of the ECS Cluster |
59+
| <a name="output_asg_arn"></a> [asg\_arn](#output\_asg\_arn) | ARN for this Auto Scaling Group. |
60+
| <a name="output_asg_iam_instance_profile_arn"></a> [asg\_iam\_instance\_profile\_arn](#output\_asg\_iam\_instance\_profile\_arn) | ARN assigned by AWS to the instance profile. |
61+
| <a name="output_asg_iam_instance_profile_id"></a> [asg\_iam\_instance\_profile\_id](#output\_asg\_iam\_instance\_profile\_id) | Instance profile's ID. |
62+
| <a name="output_asg_iam_role_id"></a> [asg\_iam\_role\_id](#output\_asg\_iam\_role\_id) | Name of the role. |
63+
| <a name="output_asg_id"></a> [asg\_id](#output\_asg\_id) | Auto Scaling Group id. |
64+
| <a name="output_asg_launch_template_arn"></a> [asg\_launch\_template\_arn](#output\_asg\_launch\_template\_arn) | Amazon Resource Name (ARN) of the launch template. |
65+
| <a name="output_asg_launch_template_id"></a> [asg\_launch\_template\_id](#output\_asg\_launch\_template\_id) | The ID of the launch template. |
66+
| <a name="output_cluster_arn"></a> [cluster\_arn](#output\_cluster\_arn) | ARN that identifies the cluster. |
6267
| <a name="output_cluster_id"></a> [cluster\_id](#output\_cluster\_id) | Identifier of the ECS Cluster |
6368
| <a name="output_cluster_name"></a> [cluster\_name](#output\_cluster\_name) | Name of the ECS Cluster |
6469
<!-- END_TF_DOCS -->

diagrams/ecs-architecture.png

209 KB
Loading

outputs.tf

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ output "cluster_id" {
88
}
99

1010
output "cluster_arn" {
11-
description = "ARN of the ECS Cluster"
11+
description = "ARN that identifies the cluster."
1212
value = module.cluster.arn
1313
}
1414

@@ -22,12 +22,12 @@ output "cluster_name" {
2222
################################################################################
2323

2424
output "asg_id" {
25-
description = "Identifier of the Autoscaling group"
25+
description = "Auto Scaling Group id."
2626
value = module.asg.id
2727
}
2828

2929
output "asg_arn" {
30-
description = "ARN of the Autoscaling group"
30+
description = "ARN for this Auto Scaling Group."
3131
value = module.asg.arn
3232
}
3333

@@ -36,12 +36,12 @@ output "asg_arn" {
3636
################################################################################
3737

3838
output "asg_launch_template_id" {
39-
description = "Identifier of the Launch Template being used with the Autoscaling Group"
39+
description = "The ID of the launch template."
4040
value = module.asg.launch_template_id
4141
}
4242

4343
output "asg_launch_template_arn" {
44-
description = "ARN of the Launch Template being used with the Autoscaling Group"
44+
description = "Amazon Resource Name (ARN) of the launch template."
4545
value = module.asg.launch_template_arn
4646
}
4747

@@ -50,16 +50,16 @@ output "asg_launch_template_arn" {
5050
################################################################################
5151

5252
output "asg_iam_role_id" {
53-
description = "Identifier of the IAM Role being used with the IAM Instnace Profile"
53+
description = "Name of the role."
5454
value = module.asg.iam_role_id
5555
}
5656

5757
output "asg_iam_instance_profile_id" {
58-
description = "Identifier of the IAM Instance Profile being used with the Launch Template"
58+
description = "Instance profile's ID."
5959
value = module.asg.iam_instance_profile_id
6060
}
6161

6262
output "asg_iam_instance_profile_arn" {
63-
description = "ARN of the IAM Instance Profile being used with the Launch Template"
63+
description = "ARN assigned by AWS to the instance profile."
6464
value = module.asg.iam_instance_profile_arn
6565
}

variables.tf

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
################################################################################
2-
# ECS Cluster
3-
################################################################################
4-
51
variable "cluster_name" {
6-
description = "Name of the ECS Cluster to create"
2+
description = "(Required) Name of the cluster"
73
type = string
84
}
95

106
variable "cluster_setting" {
11-
description = "Details of the setting configuration"
7+
description = "(Optional) Configuration block(s) with cluster settings."
128
type = list(object({
139
name = string
1410
value = string
@@ -17,8 +13,8 @@ variable "cluster_setting" {
1713
}
1814

1915
variable "cluster_tags" {
20-
description = "Resource Tags for ECS Cluster"
21-
type = map(any)
16+
description = "(Optional) Key-value map of resource tags."
17+
type = map(string)
2218
default = {}
2319
}
2420

@@ -27,12 +23,12 @@ variable "cluster_tags" {
2723
################################################################################
2824

2925
variable "asg_name" {
30-
description = "Name of the Autoscaling Group"
26+
description = "(Optional) Name of the Auto Scaling Group."
3127
type = string
3228
}
3329

3430
variable "asg_vpc_zone_identifier" {
35-
description = "Identifiers of the VPC Subnets"
31+
description = "(Optional) List of subnet IDs to launch resources in."
3632
type = list(string)
3733

3834
validation {
@@ -42,7 +38,7 @@ variable "asg_vpc_zone_identifier" {
4238
}
4339

4440
variable "asg_desired_capacity" {
45-
description = "Desired capacity for the Autoscaling group"
41+
description = "The number of Amazon EC2 instances that should be running in the group."
4642
type = number
4743

4844
validation {
@@ -52,7 +48,7 @@ variable "asg_desired_capacity" {
5248
}
5349

5450
variable "asg_min_size" {
55-
description = "Min. size for the Autoscaling group"
51+
description = "Minimum size of the Auto Scaling Group"
5652
type = number
5753

5854
validation {
@@ -62,7 +58,7 @@ variable "asg_min_size" {
6258
}
6359

6460
variable "asg_max_size" {
65-
description = "Max. size for the Autoscaling group"
61+
description = "Maximum size of the Auto Scaling Group"
6662
type = number
6763

6864
validation {
@@ -73,13 +69,13 @@ variable "asg_max_size" {
7369

7470
variable "asg_instances_tags" {
7571
description = "Resources Tags to propagate to the Instances"
76-
type = map(any)
72+
type = map(string)
7773
default = {}
7874
}
7975

8076
variable "asg_tags" {
8177
description = "Resources Tags for Autoscaling group"
82-
type = map(any)
78+
type = map(string)
8379
default = {}
8480
}
8581

@@ -96,7 +92,7 @@ variable "asg_launch_template" {
9692
vpc_security_group_ids = optional(list(string), [])
9793
key_name = optional(string, null)
9894
user_data = optional(string, null)
99-
tags = optional(map(any), {})
95+
tags = optional(map(string), {})
10096
})
10197
default = {}
10298
}
@@ -123,22 +119,22 @@ variable "asg_launch_template_id" {
123119
################################################################################
124120

125121
variable "asg_iam_role_name" {
126-
description = "Name for the IAM Role"
122+
description = "(Optional, Forces new resource) Friendly name of the role."
127123
type = string
128124
default = null
129125
}
130126

131127
variable "asg_iam_role_policy_attachments" {
132-
description = "Policy ARNs to attach to the IAM Role"
128+
description = "(Required) - The ARN of the policy you want to apply"
133129
type = list(string)
134130
default = [
135131
"arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role"
136132
]
137133
}
138134

139135
variable "asg_iam_role_tags" {
140-
description = "Resource Tags for IAM Role"
141-
type = map(any)
136+
description = "Key-value mapping of tags for the IAM role."
137+
type = map(string)
142138
default = {}
143139
}
144140

@@ -147,13 +143,13 @@ variable "asg_iam_role_tags" {
147143
################################################################################
148144

149145
variable "asg_iam_instance_profile_name" {
150-
description = "Name of the IAM Instance Profile"
146+
description = "(Optional, Forces new resource) Name of the instance profile."
151147
type = string
152148
default = null
153149
}
154150

155151
variable "asg_iam_instance_profile_tags" {
156-
description = "Resource Tags for the IAM Instance Profile"
157-
type = map(any)
152+
description = "(Optional) Map of resource tags for the IAM Instance Profile."
153+
type = map(string)
158154
default = {}
159155
}

versions.tf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
terraform {
2-
required_version = ">= 1.6.0"
2+
required_version = ">= 1.8.4"
3+
4+
required_providers {
5+
aws = {
6+
source = "hashicorp/aws"
7+
version = ">= 5.51.0"
8+
}
9+
}
310
}

0 commit comments

Comments
 (0)