Skip to content

Commit 0c5f7b3

Browse files
committed
feat(examples/complete)!: make complete example generic by extracting all parameters from variables
Remove VPC and ASG declaration.
1 parent a99c6dc commit 0c5f7b3

File tree

5 files changed

+234
-332
lines changed

5 files changed

+234
-332
lines changed

examples/complete/.header.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22

33
Configuration in this directory creates:
44

5-
- VPC with two private subnets and two public subnets
6-
- Autoscaling Group with a Launch Template
7-
- ECS Service in a pre-configured ECS Cluster to spin up a Nginx web server, and corresponding ECS Capacity Providers
8-
- Internet-facing Application Load Balancer to access the internal Nginx server, and
5+
- ECS Service in a pre-configured ECS Cluster and corresponding ECS Capacity Providers
6+
- Internet-facing Application Load Balancer to access the deployed services, and
97
- ACM to generate an Amazon-issued certificate for a base domain, and then create a Route53 A-type record with an endpoint
108

119
## Usage

examples/complete/README.md

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33

44
Configuration in this directory creates:
55

6-
- VPC with two private subnets and two public subnets
7-
- Autoscaling Group with a Launch Template
8-
- ECS Service in a pre-configured ECS Cluster to spin up a Nginx web server, and corresponding ECS Capacity Providers
9-
- Internet-facing Application Load Balancer to access the internal Nginx server, and
6+
- ECS Service in a pre-configured ECS Cluster and corresponding ECS Capacity Providers
7+
- Internet-facing Application Load Balancer to access the deployed services, and
108
- ACM to generate an Amazon-issued certificate for a base domain, and then create a Route53 A-type record with an endpoint
119

1210
## Usage
@@ -37,9 +35,7 @@ Please note that this example may create resources that can incur monetary charg
3735

3836
| Name | Source | Version |
3937
|------|--------|---------|
40-
| <a name="module_asg"></a> [asg](#module\_asg) | terraform-aws-modules/autoscaling/aws | n/a |
4138
| <a name="module_ecs_deployment"></a> [ecs\_deployment](#module\_ecs\_deployment) | ../../ | n/a |
42-
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 5.9.0 |
4339

4440
## Resources
4541

@@ -48,43 +44,53 @@ Please note that this example may create resources that can incur monetary charg
4844
| [aws_acm_certificate_validation.base_domain_certificate](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/acm_certificate_validation) | resource |
4945
| [aws_route53_record.endpoint](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource |
5046
| [aws_security_group.alb_allow_all](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource |
51-
| [aws_security_group.allow_all_within_vpc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource |
52-
| [aws_security_group.allow_nginx_http_from_alb](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource |
53-
| [aws_ami.ecs_optimized_amzn_linux](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ami) | data source |
5447
| [aws_route53_zone.base_domain](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route53_zone) | data source |
5548

5649
## Inputs
5750

58-
No inputs.
51+
| Name | Description | Type | Default | Required |
52+
|------|-------------|------|---------|:--------:|
53+
| <a name="input_alb_name"></a> [alb\_name](#input\_alb\_name) | Name of the application load balancer | `string` | n/a | yes |
54+
| <a name="input_asg_arn"></a> [asg\_arn](#input\_asg\_arn) | ARN of the Auto Scaling group | `string` | n/a | yes |
55+
| <a name="input_base_domain"></a> [base\_domain](#input\_base\_domain) | Base domain name for ACM | `string` | n/a | yes |
56+
| <a name="input_capacity_provider_managed_scaling"></a> [capacity\_provider\_managed\_scaling](#input\_capacity\_provider\_managed\_scaling) | Managed scaling configuration for the Capacity Provider | `any` | n/a | yes |
57+
| <a name="input_capacity_provider_name"></a> [capacity\_provider\_name](#input\_capacity\_provider\_name) | Name of the Capacity Provider | `string` | n/a | yes |
58+
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | Name of the ECS cluster | `string` | n/a | yes |
59+
| <a name="input_container_cpu"></a> [container\_cpu](#input\_container\_cpu) | CPU units to allocate to the container | `number` | n/a | yes |
60+
| <a name="input_container_essential"></a> [container\_essential](#input\_container\_essential) | Essential flag for the container | `bool` | n/a | yes |
61+
| <a name="input_container_image"></a> [container\_image](#input\_container\_image) | Image of the container | `string` | n/a | yes |
62+
| <a name="input_container_memory"></a> [container\_memory](#input\_container\_memory) | Memory in MB to allocate to the container | `number` | n/a | yes |
63+
| <a name="input_container_name"></a> [container\_name](#input\_container\_name) | Name of the container | `string` | n/a | yes |
64+
| <a name="input_container_port"></a> [container\_port](#input\_container\_port) | Port on which the container will listen | `number` | n/a | yes |
65+
| <a name="input_container_port_mappings"></a> [container\_port\_mappings](#input\_container\_port\_mappings) | Port mappings for the container | `any` | n/a | yes |
66+
| <a name="input_container_readonly_root_filesystem"></a> [container\_readonly\_root\_filesystem](#input\_container\_readonly\_root\_filesystem) | Whether the root filesystem is readonly for the container | `bool` | n/a | yes |
67+
| <a name="input_endpoint"></a> [endpoint](#input\_endpoint) | DNS endpoint for the application | `string` | n/a | yes |
68+
| <a name="input_listener_port"></a> [listener\_port](#input\_listener\_port) | Port for the ALB listener | `number` | n/a | yes |
69+
| <a name="input_private_subnets"></a> [private\_subnets](#input\_private\_subnets) | List of private subnet IDs | `list(string)` | n/a | yes |
70+
| <a name="input_public_subnets"></a> [public\_subnets](#input\_public\_subnets) | List of public subnet IDs | `list(string)` | n/a | yes |
71+
| <a name="input_security_group_alb"></a> [security\_group\_alb](#input\_security\_group\_alb) | Name of the security group for ALB | `string` | n/a | yes |
72+
| <a name="input_service_desired_count"></a> [service\_desired\_count](#input\_service\_desired\_count) | Desired count for the ECS Service | `number` | n/a | yes |
73+
| <a name="input_service_network_configuration_security_groups"></a> [service\_network\_configuration\_security\_groups](#input\_service\_network\_configuration\_security\_groups) | Security Groups for the ECS Service's Network Configuration | `list(string)` | n/a | yes |
74+
| <a name="input_ssl_policy"></a> [ssl\_policy](#input\_ssl\_policy) | SSL policy for the ALB | `string` | n/a | yes |
75+
| <a name="input_target_group_health_check"></a> [target\_group\_health\_check](#input\_target\_group\_health\_check) | Health check configuration for the target group | `any` | n/a | yes |
76+
| <a name="input_target_group_name"></a> [target\_group\_name](#input\_target\_group\_name) | Name of the target group | `string` | n/a | yes |
77+
| <a name="input_target_group_protocol"></a> [target\_group\_protocol](#input\_target\_group\_protocol) | Protocol to use with the target group | `string` | n/a | yes |
78+
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | VPC ID where the resources will be deployed | `string` | n/a | yes |
5979

6080
## Outputs
6181

6282
| Name | Description |
6383
|------|-------------|
6484
| <a name="output_acm_amazon_issued_certificate_arn"></a> [acm\_amazon\_issued\_certificate\_arn](#output\_acm\_amazon\_issued\_certificate\_arn) | ARN of the ACM Amazon-issued certificate for the base domain |
6585
| <a name="output_alb_allow_all_sg_id"></a> [alb\_allow\_all\_sg\_id](#output\_alb\_allow\_all\_sg\_id) | ID of the Security Group for Application Load Balancer to allow all traffic from any source |
66-
| <a name="output_alb_arn"></a> [alb\_arn](#output\_alb\_arn) | ARN of the Application Load Balancer for Nginx ECS Service |
67-
| <a name="output_allow_all_within_vpc_sg_id"></a> [allow\_all\_within\_vpc\_sg\_id](#output\_allow\_all\_within\_vpc\_sg\_id) | ID of the Security Group to allow all traffic from any source within the VPC |
68-
| <a name="output_allow_nginx_http_from_alb_sg_id"></a> [allow\_nginx\_http\_from\_alb\_sg\_id](#output\_allow\_nginx\_http\_from\_alb\_sg\_id) | ID of the Security Group to allow all Nginx HTTP traffic from Application Load Balancer |
69-
| <a name="output_asg_arn"></a> [asg\_arn](#output\_asg\_arn) | ARN of the Autoscaling group |
70-
| <a name="output_asg_id"></a> [asg\_id](#output\_asg\_id) | Identifier of the Autoscaling group |
86+
| <a name="output_alb_arn"></a> [alb\_arn](#output\_alb\_arn) | ARN of the Application Load Balancer ECS Service |
7187
| <a name="output_ecs_capacity_provider_arn"></a> [ecs\_capacity\_provider\_arn](#output\_ecs\_capacity\_provider\_arn) | ARN of the ECS Capacity Provider |
7288
| <a name="output_ecs_capacity_provider_id"></a> [ecs\_capacity\_provider\_id](#output\_ecs\_capacity\_provider\_id) | Identifier of the ECS Capacity Provider |
7389
| <a name="output_ecs_cluster_capacity_providers_id"></a> [ecs\_cluster\_capacity\_providers\_id](#output\_ecs\_cluster\_capacity\_providers\_id) | Identifier of the ECS Cluster Capacity Providers |
74-
| <a name="output_ecs_service_arn"></a> [ecs\_service\_arn](#output\_ecs\_service\_arn) | ARN of the ECS Service for Nginx |
75-
| <a name="output_iam_instance_profile_arn"></a> [iam\_instance\_profile\_arn](#output\_iam\_instance\_profile\_arn) | ARN of the IAM Instance Profile |
76-
| <a name="output_iam_instance_profile_id"></a> [iam\_instance\_profile\_id](#output\_iam\_instance\_profile\_id) | Identifier of the IAM Instance Profile |
77-
| <a name="output_iam_instance_role_id"></a> [iam\_instance\_role\_id](#output\_iam\_instance\_role\_id) | Identifier of the IAM Instance Role |
78-
| <a name="output_launch_template_arn"></a> [launch\_template\_arn](#output\_launch\_template\_arn) | ARN of the Launch Template |
79-
| <a name="output_launch_template_id"></a> [launch\_template\_id](#output\_launch\_template\_id) | Identifier of the Launch Template |
80-
| <a name="output_listener_arn"></a> [listener\_arn](#output\_listener\_arn) | ARN of the ALB Listener forwarding to Nginx instances |
81-
| <a name="output_listener_id"></a> [listener\_id](#output\_listener\_id) | Identifier of the ALB Listener forwarding to Nginx instances |
82-
| <a name="output_target_group_arn"></a> [target\_group\_arn](#output\_target\_group\_arn) | ARN of the Target Group for Nginx instances |
83-
| <a name="output_target_group_id"></a> [target\_group\_id](#output\_target\_group\_id) | Identifier of the Target Group for Nginx instances |
84-
| <a name="output_task_definition_arn"></a> [task\_definition\_arn](#output\_task\_definition\_arn) | ARN of the ECS Task Definition for Nginx |
85-
| <a name="output_vpc_id"></a> [vpc\_id](#output\_vpc\_id) | Identifier of the VPC |
86-
| <a name="output_vpc_private_subnets_arns"></a> [vpc\_private\_subnets\_arns](#output\_vpc\_private\_subnets\_arns) | ARNs of the Private Subnets in the VPC |
87-
| <a name="output_vpc_private_subnets_ids"></a> [vpc\_private\_subnets\_ids](#output\_vpc\_private\_subnets\_ids) | Identifiers of the Private Subnets in the VPC |
88-
| <a name="output_vpc_public_subnets_arns"></a> [vpc\_public\_subnets\_arns](#output\_vpc\_public\_subnets\_arns) | ARNs of the Public Subnets in the VPC |
89-
| <a name="output_vpc_public_subnets_ids"></a> [vpc\_public\_subnets\_ids](#output\_vpc\_public\_subnets\_ids) | Identifiers of the Public Subnets in the VPC |
90+
| <a name="output_ecs_service_arn"></a> [ecs\_service\_arn](#output\_ecs\_service\_arn) | ARN of the ECS Service |
91+
| <a name="output_listener_arn"></a> [listener\_arn](#output\_listener\_arn) | ARN of the ALB Listener forwarding to container instances |
92+
| <a name="output_listener_id"></a> [listener\_id](#output\_listener\_id) | Identifier of the ALB Listener forwarding to container instances |
93+
| <a name="output_target_group_arn"></a> [target\_group\_arn](#output\_target\_group\_arn) | ARN of the Target Group instances |
94+
| <a name="output_target_group_id"></a> [target\_group\_id](#output\_target\_group\_id) | Identifier of the Target Group instances |
95+
| <a name="output_task_definition_arn"></a> [task\_definition\_arn](#output\_task\_definition\_arn) | ARN of the ECS Task Definition |
9096
<!-- END_TF_DOCS -->

0 commit comments

Comments
 (0)