Skip to content

Commit

Permalink
Push pre-commit changes
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharth-singh1 authored and github-actions[bot] committed Nov 30, 2024
1 parent 5c02bff commit 3b791db
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 72 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ Terraform will display a plan showing the changes it intends to make. Review the
| <a name="module_acm"></a> [acm](#module\_acm) | git::https://github.com/cloudposse/terraform-aws-acm-request-certificate | 0.17.0 |
| <a name="module_alb"></a> [alb](#module\_alb) | ./modules/alb | n/a |
| <a name="module_alb_sg"></a> [alb\_sg](#module\_alb\_sg) | git::https://github.com/cloudposse/terraform-aws-security-group | 2.0.0 |
| <a name="module_ecs"></a> [ecs](#module\_ecs) | git::https://github.com/terraform-aws-modules/terraform-aws-ecs | v5.11.1 |
| <a name="module_ecs"></a> [ecs](#module\_ecs) | ./modules/ecs | n/a |
| <a name="module_health_check"></a> [health\_check](#module\_health\_check) | ./modules/health-check | n/a |

## Resources
Expand Down
1 change: 1 addition & 0 deletions example/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 5 additions & 17 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,22 @@ Example demonstrating how to use terraform-aws-refarch-ecs.
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.5 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 4.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 5.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.67.0 |
No providers.

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_ecs"></a> [ecs](#module\_ecs) | sourcefuse/arc-ecs/aws | n/a |
| <a name="module_ecs"></a> [ecs](#module\_ecs) | ../modules/ecs | n/a |
| <a name="module_tags"></a> [tags](#module\_tags) | sourcefuse/arc-tags/aws | 1.2.3 |

## Resources

| Name | Type |
|------|------|
| [aws_route53_zone.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route53_zone) | data source |
| [aws_subnets.private](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnets) | data source |
| [aws_subnets.public](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnets) | data source |
| [aws_vpc.vpc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) | data source |
No resources.

## Inputs

Expand All @@ -50,10 +43,5 @@ Example demonstrating how to use terraform-aws-refarch-ecs.

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_cluster_arn"></a> [cluster\_arn](#output\_cluster\_arn) | ECS Cluster ARN |
| <a name="output_cluster_id"></a> [cluster\_id](#output\_cluster\_id) | ECS Cluster ID |
| <a name="output_cluster_name"></a> [cluster\_name](#output\_cluster\_name) | Name of the ECS Cluster |
| <a name="output_health_check_fqdn"></a> [health\_check\_fqdn](#output\_health\_check\_fqdn) | Health check FQDN record created in Route 53. |
No outputs.
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
14 changes: 7 additions & 7 deletions example/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ module "ecs" {
cluster_service_connect_defaults = []
create_cloudwatch_log_group = true
cluster_service_connect_defaults = {}
cluster_settings = []
cluster_settings = []
cluster_configuration = {
execute_command_configuration = {
logging = "OVERRIDE"
log_configuration = {
cloud_watch_log_group_name = "arc-poc-cluster-log-group"
}
execute_command_configuration = {
logging = "OVERRIDE"
log_configuration = {
cloud_watch_log_group_name = "arc-poc-cluster-log-group"
}
}
}

}
Expand All @@ -63,7 +63,7 @@ module "ecs" {
autoscaling_capacity_providers = {}
fargate_capacity_providers = {
fargate_cp = {
name = "FARGATE"
name = "FARGATE"
tags = {
Environment = "poc"
}
Expand Down
26 changes: 13 additions & 13 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,36 @@ terraform {
## cluster
################################################################################
module "ecs" {
source = "./modules/ecs"
source = "./modules/ecs"

create = true

ecs_cluster = {
cluster_name = "my-ecs-cluster"
cluster_name = "my-ecs-cluster"
cluster_service_connect_defaults = []
create_cloudwatch_log_group = false
create_cloudwatch_log_group = false

}

cloudwatch = {
log_group_name = "my-cloudwatch-log-group"
log_group_name = "my-cloudwatch-log-group"
log_group_retention_in_days = 7
log_group_kms_key_id = null
log_group_tags = { Environment = "production" }
log_group_kms_key_id = null
log_group_tags = { Environment = "production" }
}

capacity_provider = {
autoscaling_capacity_providers = {
my-provider = {
name = "my-autoscaling-provider"
auto_scaling_group_arn = "arn:aws:autoscaling:region:account-id:autoScalingGroup:autoScalingGroupName/my-asg"
managed_scaling = { instance_warmup_period = 300, maximum_scaling_step_size = 10, minimum_scaling_step_size = 1, status = "ENABLED", target_capacity = 100 }
name = "my-autoscaling-provider"
auto_scaling_group_arn = "arn:aws:autoscaling:region:account-id:autoScalingGroup:autoScalingGroupName/my-asg"
managed_scaling = { instance_warmup_period = 300, maximum_scaling_step_size = 10, minimum_scaling_step_size = 1, status = "ENABLED", target_capacity = 100 }
managed_termination_protection = "ENABLED"
managed_draining = "ENABLED"
tags = { Environment = "production" }
managed_draining = "ENABLED"
tags = { Environment = "production" }
}
}
fargate_capacity_providers = {}
fargate_capacity_providers = {}
default_capacity_provider_use_fargate = false
}

Expand Down
37 changes: 14 additions & 23 deletions modules/alb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,34 @@ AWS Terraform ALB Module

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.3 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 4.30 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.5 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 5.0 |

## Providers

No providers.
| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 5.0 |

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_alb"></a> [alb](#module\_alb) | git::https://github.com/cloudposse/terraform-aws-alb | 1.5.0 |
No modules.

## Resources

No resources.
| Name | Type |
|------|------|
| [aws_lb.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb) | resource |
| [aws_lb_listener.http_forward](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_listener) | resource |
| [aws_lb_target_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_target_group) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_access_logs_enabled"></a> [access\_logs\_enabled](#input\_access\_logs\_enabled) | A boolean flag to enable/disable access\_logs | `bool` | `true` | no |
| <a name="input_alb_access_logs_s3_bucket_force_destroy"></a> [alb\_access\_logs\_s3\_bucket\_force\_destroy](#input\_alb\_access\_logs\_s3\_bucket\_force\_destroy) | A boolean that indicates all objects should be deleted from the ALB access logs S3 bucket so that the bucket can be destroyed without error | `bool` | `false` | no |
| <a name="input_alb_access_logs_s3_bucket_force_destroy_enabled"></a> [alb\_access\_logs\_s3\_bucket\_force\_destroy\_enabled](#input\_alb\_access\_logs\_s3\_bucket\_force\_destroy\_enabled) | When `true`, permits `force_destroy` to be set to `true`.<br>This is an extra safety precaution to reduce the chance that Terraform will destroy and recreate<br>your S3 bucket, causing COMPLETE LOSS OF ALL DATA even if it was stored in Glacier.<br>WARNING: Upgrading this module from a version prior to 0.27.0 to this version<br> will cause Terraform to delete your existing S3 bucket CAUSING COMPLETE DATA LOSS<br> unless you follow the upgrade instructions on the Wiki [here](https://github.com/cloudposse/terraform-aws-s3-log-storage/wiki/Upgrading-to-v0.27.0-(POTENTIAL-DATA-LOSS)).<br> See additional instructions for upgrading from v0.27.0 to v0.28.0 [here](https://github.com/cloudposse/terraform-aws-s3-log-storage/wiki/Upgrading-to-v0.28.0-and-AWS-provider-v4-(POTENTIAL-DATA-LOSS)). | `bool` | `false` | no |
| <a name="input_cross_zone_load_balancing_enabled"></a> [cross\_zone\_load\_balancing\_enabled](#input\_cross\_zone\_load\_balancing\_enabled) | A boolean flag to enable/disable cross zone load balancing | `bool` | `true` | no |
| <a name="input_deletion_protection_enabled"></a> [deletion\_protection\_enabled](#input\_deletion\_protection\_enabled) | A boolean flag to enable/disable deletion protection for ALB | `bool` | `false` | no |
| <a name="input_deregistration_delay"></a> [deregistration\_delay](#input\_deregistration\_delay) | The amount of time to wait in seconds before changing the state of a deregistering target to unused | `number` | `15` | no |
| <a name="input_http_ingress_cidr_blocks"></a> [http\_ingress\_cidr\_blocks](#input\_http\_ingress\_cidr\_blocks) | List of CIDR blocks to allow in HTTP security group | `list(string)` | <pre>[<br> "0.0.0.0/0"<br>]</pre> | no |
| <a name="input_https_ingress_cidr_blocks"></a> [https\_ingress\_cidr\_blocks](#input\_https\_ingress\_cidr\_blocks) | List of CIDR blocks to allow in HTTPS security group | `list(string)` | <pre>[<br> "0.0.0.0/0"<br>]</pre> | no |
| <a name="input_idle_timeout"></a> [idle\_timeout](#input\_idle\_timeout) | The time in seconds that the connection is allowed to be idle | `number` | `60` | no |
| <a name="input_internal"></a> [internal](#input\_internal) | Internal or external facing ALB. | `bool` | `false` | no |
| <a name="input_ip_address_type"></a> [ip\_address\_type](#input\_ip\_address\_type) | The type of IP addresses used by the subnets for your load balancer. The possible values are `ipv4` and `dualstack`. | `string` | `"ipv4"` | no |
| <a name="input_name"></a> [name](#input\_name) | Name to assign the resource | `string` | `""` | no |
| <a name="input_security_group_ids"></a> [security\_group\_ids](#input\_security\_group\_ids) | Security group Ids for access | `list(string)` | n/a | yes |
| <a name="input_subnet_ids"></a> [subnet\_ids](#input\_subnet\_ids) | Subnet Ids assigned to the LB | `list(string)` | n/a | yes |
| <a name="input_tags"></a> [tags](#input\_tags) | Tags to assign the resources | `map(string)` | `{}` | no |
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | Id of the VPC where the resources will live | `string` | n/a | yes |
| <a name="input_alb"></a> [alb](#input\_alb) | n/a | <pre>object({<br> name = optional(string, null)<br> internal = optional(bool, false)<br> load_balancer_type = optional(string, "application")<br> idle_timeout = optional(number, 60)<br> enable_deletion_protection = optional(bool, false)<br> enable_http2 = optional(bool, true)<br><br> access_logs = optional(object({<br> bucket = string<br> enabled = optional(bool, false)<br> prefix = optional(string, "")<br> }))<br><br> tags = optional(map(string), "")<br> })</pre> | n/a | yes |
| <a name="input_alb_target_group"></a> [alb\_target\_group](#input\_alb\_target\_group) | n/a | <pre>object({<br> name = optional(string, null)<br> port = number<br> protocol = optional(string, null)<br> protocol_version = optional(string, "HTTP1")<br> vpc_id = optional(string, "")<br> target_type = optional(string, "instance")<br> ip_address_type = optional(string, "ipv4")<br> load_balancing_algorithm_type = optional(string, "round_robin")<br> load_balancing_cross_zone_enabled = optional(string, "use_load_balancer_configuration")<br> deregistration_delay = optional(number, 300)<br> slow_start = optional(number, 0)<br><br> health_check = optional(object({<br> enabled = optional(bool, true)<br> protocol = optional(string, "HTTP") # Allowed values: "HTTP", "HTTPS", "TCP", etc.<br> path = optional(string, "/")<br> port = optional(string, "traffic-port")<br> timeout = optional(number, 6)<br> healthy_threshold = optional(number, 3)<br> unhealthy_threshold = optional(number, 3)<br> interval = optional(number, 30)<br> matcher = optional(string, "200") # Default HTTP matcher. Range 200 to 499<br> }))<br><br> stickiness = optional(object({<br> enabled = optional(bool, true)<br> type = string<br> cookie_duration = optional(number, 86400)<br> })<br> )<br><br> })</pre> | n/a | yes |
| <a name="input_create_alb"></a> [create\_alb](#input\_create\_alb) | A flag that decides whether to create alb along with ecs cluster | `bool` | `false` | no |

## Outputs

Expand Down
4 changes: 2 additions & 2 deletions modules/alb/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ variable "alb_target_group" {
enabled = optional(bool, true)
type = string
cookie_duration = optional(number, 86400)
})
)
})
)

})
}
24 changes: 24 additions & 0 deletions modules/ecs/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions modules/ecs/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ resource "aws_ecs_capacity_provider" "this" {
}
}

tags = merge(var.tags, each.value.tags)
depends_on = [aws_ecs_cluster.this]
tags = merge(var.tags, each.value.tags)
depends_on = [aws_ecs_cluster.this]
}


Expand Down Expand Up @@ -129,12 +129,10 @@ resource "aws_ecs_cluster_capacity_providers" "this" {

content {
capacity_provider = strategy.value.name
base = lookup(strategy.value, "base", null) # Adjusted lookup
base = lookup(strategy.value, "base", null) # Adjusted lookup
weight = lookup(strategy.value, "weight", null)
}
}

depends_on = [aws_ecs_capacity_provider.this]
}


5 changes: 1 addition & 4 deletions modules/ecs/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Keys:
- cluster_configuration: The execute command configuration for the cluster.
- cluster_settings: A list of cluster settings (e.g., container insights). Default is an empty list.
- cluster_service_connect_defaults: Configures a default Service Connect namespace.
- create_cloudwatch_log_group: Boolean flag to specify whether to create a CloudWatch log group for the ECS cluster.
- create_cloudwatch_log_group: Boolean flag to specify whether to create a CloudWatch log group for the ECS cluster.
EOT

default = {
Expand Down Expand Up @@ -96,6 +96,3 @@ variable "capacity_provider" {
}))
})
}



0 comments on commit 3b791db

Please sign in to comment.