Skip to content

Commit

Permalink
Add ECS Exec (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
wayne-root authored Dec 13, 2022
1 parent 6b892be commit 9bec953
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ No resources.
| <a name="input_asg_wait_for_capacity_timeout"></a> [asg\_wait\_for\_capacity\_timeout](#input\_asg\_wait\_for\_capacity\_timeout) | A maximum duration that Terraform should wait for ASG instances to be healthy before timing out. (See also Waiting for Capacity below.) Setting this to '0' causes Terraform to skip all Capacity Waiting behavior. | `string` | `null` | no |
| <a name="input_assign_public_ip"></a> [assign\_public\_ip](#input\_assign\_public\_ip) | Enable a public IP address for the container | `bool` | `false` | no |
| <a name="input_create_launch_template"></a> [create\_launch\_template](#input\_create\_launch\_template) | Create a launch template | `bool` | `true` | no |
| <a name="input_enable_execute_command"></a> [enable\_execute\_command](#input\_enable\_execute\_command) | Specifies whether to enable Amazon ECS Exec for the tasks within the service | `bool` | `false` | no |
| <a name="input_launch_type"></a> [launch\_type](#input\_launch\_type) | The launch type on which to run your task.(EC2\|FARGATE) | `string` | `"EC2"` | no |
| <a name="input_link_ecs_to_asg_capacity_provider"></a> [link\_ecs\_to\_asg\_capacity\_provider](#input\_link\_ecs\_to\_asg\_capacity\_provider) | Specify whether to link ECS to autoscaling group capacity provider | `bool` | `false` | no |
| <a name="input_name"></a> [name](#input\_name) | Name of the product/project/application | `string` | `null` | no |
Expand All @@ -68,5 +69,7 @@ No resources.

## Outputs

No outputs.
| Name | Description |
|------|-------------|
| <a name="output_ecs_cluster_kms_arn"></a> [ecs\_cluster\_kms\_arn](#output\_ecs\_cluster\_kms\_arn) | The AWS Key Management Service key ID to encrypt the data between the local client and the container |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
2 changes: 2 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ module "service" {

docker_volumes = lookup(each.value, "docker_volumes", [])
assign_public_ip = var.assign_public_ip

enable_execute_command = var.enable_execute_command
}

module "service_cpu_autoscaling_policy" {
Expand Down
1 change: 1 addition & 0 deletions modules/cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,6 @@ No modules.
|------|-------------|
| <a name="output_ecs_cluster_arn"></a> [ecs\_cluster\_arn](#output\_ecs\_cluster\_arn) | ARN of the ECS Cluster |
| <a name="output_ecs_cluster_id"></a> [ecs\_cluster\_id](#output\_ecs\_cluster\_id) | ID of the ECS Cluster |
| <a name="output_ecs_cluster_kms_arn"></a> [ecs\_cluster\_kms\_arn](#output\_ecs\_cluster\_kms\_arn) | The AWS Key Management Service key ID to encrypt the data between the local client and the container |
| <a name="output_ecs_cluster_name"></a> [ecs\_cluster\_name](#output\_ecs\_cluster\_name) | The name of the ECS cluster |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
5 changes: 5 additions & 0 deletions modules/cluster/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ output "ecs_cluster_name" {
description = "The name of the ECS cluster"
value = try(aws_ecs_cluster.this.name, "")
}

output "ecs_cluster_kms_arn" {
description = "The AWS Key Management Service key ID to encrypt the data between the local client and the container"
value = try(aws_kms_key.cluster.arn, "")
}
1 change: 1 addition & 0 deletions modules/service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ No modules.
| <a name="input_ecs_load_balancers"></a> [ecs\_load\_balancers](#input\_ecs\_load\_balancers) | Configuration block for load balancers. | `list(any)` | `[]` | no |
| <a name="input_efs_volumes"></a> [efs\_volumes](#input\_efs\_volumes) | Task EFS volume definitions as list of configuration objects. You cannot define both Docker volumes and EFS volumes on the same task definition. | `list(any)` | `[]` | no |
| <a name="input_enable_ecs_managed_tags"></a> [enable\_ecs\_managed\_tags](#input\_enable\_ecs\_managed\_tags) | Specifies whether to enable Amazon ECS managed tags for the tasks within the service | `bool` | `true` | no |
| <a name="input_enable_execute_command"></a> [enable\_execute\_command](#input\_enable\_execute\_command) | Specifies whether to enable Amazon ECS Exec for the tasks within the service | `bool` | `false` | no |
| <a name="input_execution_role_arn"></a> [execution\_role\_arn](#input\_execution\_role\_arn) | ECS excution role arn | `string` | `""` | no |
| <a name="input_launch_type"></a> [launch\_type](#input\_launch\_type) | Launch type | `string` | `"EC2"` | no |
| <a name="input_name"></a> [name](#input\_name) | The Service name | `string` | n/a | yes |
Expand Down
1 change: 1 addition & 0 deletions modules/service/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ resource "aws_ecs_service" "this" {
platform_version = var.launch_type == "FARGATE" ? var.platform_version : null
desired_count = var.desired_count
enable_ecs_managed_tags = var.enable_ecs_managed_tags
enable_execute_command = var.enable_execute_command
propagate_tags = var.propagate_tags

deployment_maximum_percent = var.deployment_maximum_percent
Expand Down
6 changes: 6 additions & 0 deletions modules/service/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ variable "enable_ecs_managed_tags" {
default = true
}

variable "enable_execute_command" {
description = "Specifies whether to enable Amazon ECS Exec for the tasks within the service"
type = bool
default = false
}

variable "propagate_tags" {
description = "Specifies whether to propagate the tags from the task definition or the service to the tasks. The valid values are SERVICE and TASK_DEFINITION"
type = string
Expand Down
4 changes: 4 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
output "ecs_cluster_kms_arn" {
description = "The AWS Key Management Service key ID to encrypt the data between the local client and the container"
value = try(module.cluster.ecs_cluster_kms_arn, "")
}
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ variable "assign_public_ip" {
default = false
}

variable "enable_execute_command" {
description = "Specifies whether to enable Amazon ECS Exec for the tasks within the service"
type = bool
default = false
}

################################################################################
# Autoscaling group
################################################################################
Expand Down

0 comments on commit 9bec953

Please sign in to comment.