Skip to content

Commit 1c1dbfd

Browse files
Updated Document
1 parent 8e0b3d1 commit 1c1dbfd

File tree

1 file changed

+68
-5
lines changed

1 file changed

+68
-5
lines changed

README.md

Lines changed: 68 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Known Vulnerabilities](https://github.com/sourcefuse/terraform-aws-arc-ecs/actions/workflows/snyk.yaml/badge.svg)](https://github.com/sourcefuse/terraform-aws-arc-ecs/actions/workflows/snyk.yaml)
66
## Overview
77

8-
Terraform Module for AWS ECS by the SourceFuse ARC team.
8+
SourceFuse's AWS Reference Architecture Terraform module leverages the terraform-aws-modules/terraform-aws-ecs GitHub repository to facilitate the deployment and management of an AWS ECS (Elastic Container Service) cluster. It streamlines the configuration of ECS tasks, services, and related components, providing a scalable and efficient solution for orchestrating containerized applications. With customizable settings for logging, load balancing, and service discovery, the module promotes seamless deployment and management of containerized workloads on AWS.
99

1010
The module assumes that upstream dependencies, namely networking dependencies, are created upstream and the values are passed into this module via mechanisms such as Terraform data source queries.
1111

@@ -20,17 +20,49 @@ The module provisions
2020
* Utilizes ACM to generate a certificate specific to the ALB.
2121
* Tags/SSM params - the module tags resources and outputs SSM params that can be used in data source lookups downstream for ECS services to reference to deploy into the cluster.
2222

23+
2324
![Module Structure](./static/arc_ecs_basic_components.png)
2425

2526
Our approach to ECS Fargate clusters is to provision a cluster and allow downstream services to attach to it via convention based data source queries.
2627

27-
**Note**: the example below is does not have a pinned version. Be sure to pin your version. Refer to the `example` folder for a working example version.
28+
### Prerequisites
29+
Before using this module, ensure you have the following:
30+
31+
- AWS credentials configured.
32+
- Terraform installed.
33+
- A working knowledge of Terraform.
34+
- Route 53 hosted zone
35+
- Network
36+
37+
38+
## Getting Started
39+
40+
1. **Define the Module**
41+
42+
Initially, it's essential to define a Terraform module, which is organized as a distinct directory encompassing Terraform configuration files. Within this module directory, input variables and output values must be defined in the variables.tf and outputs.tf files, respectively. The following illustrates an example directory structure:
43+
44+
45+
```plaintext
46+
ecs/
47+
|-- main.tf
48+
|-- variables.tf
49+
|-- outputs.tf
50+
```
51+
52+
53+
2. **Define Input Variables**
54+
55+
Inside the `variables.tf` or in `*.tfvars` file, you should define values for the variables that the module requires.
56+
57+
3. **Use the Module in Your Main Configuration**
58+
In your main Terraform configuration file (e.g., main.tf), you can use the module. Specify the source of the module, and version, For Example
59+
2860
## Usage
2961

3062
```hcl
3163
module "ecs" {
32-
source = "sourcefuse/arc-ecs/aws"
33-
version = "1.3.7"
64+
source = "sourcefuse/arc-ecs/aws"
65+
version = "1.5.2"
3466
3567
environment = var.environment
3668
namespace = var.namespace
@@ -46,7 +78,8 @@ module "ecs" {
4678
// -------------------------- END ------------------------- //
4779
4880
## create acm certificate and dns record for health check
49-
route_53_zone = local.route_53_zone
81+
route_53_zone_name = var.route_53_zone
82+
route_53_zone_id = data.aws_route53_zone.this.id
5083
acm_domain_name = "healthcheck-ecs-${var.namespace}-${var.environment}.${local.route_53_zone}"
5184
acm_subject_alternative_names = []
5285
health_check_route_53_records = [
@@ -61,6 +94,36 @@ module "ecs" {
6194
}
6295
```
6396

97+
4. **Output Values**
98+
99+
Inside the `outputs.tf` file of the module, you can define output values that can be referenced in the main configuration. For example:
100+
101+
```hcl
102+
output "cluster_name" {
103+
description = "Name of the ECS Cluster"
104+
value = module.ecs.cluster_name
105+
}
106+
107+
output "health_check_fqdn" {
108+
description = "Health check FQDN record created in Route 53."
109+
value = module.ecs.health_check_fqdn
110+
}
111+
```
112+
113+
5. **Execute Terraform Commands**
114+
115+
After defining your main configuration, navigate to the directory containing your Terraform files and run the following commands:
116+
117+
118+
```bash
119+
terraform init
120+
terraform apply
121+
```
122+
123+
6. **Review and Confirm**
124+
125+
Terraform will display a plan showing the changes it intends to make. Review the plan and confirm by typing 'yes' when prompted.
126+
64127
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
65128
## Requirements
66129

0 commit comments

Comments
 (0)