Skip to content

Commit 79179ff

Browse files
authored
Merge pull request #4 from GiamPy5/fixes-documentation-and-adds-terraform-docs
chore: Fixes documentation and adds terraform docs
2 parents 8b463b7 + 42f3483 commit 79179ff

File tree

3 files changed

+136
-46
lines changed

3 files changed

+136
-46
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ repos:
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_docs
7+
args:
8+
- --args=--config=.terraform-docs.yml
79
args:
810
- '--args=--lockfile=false'
911
- id: terraform_tflint

.terraform-docs.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
formatter: "markdown"
2+
3+
output:
4+
file: "README.md"
5+
mode: replace
6+
template: |-
7+
# Terraform AWS Directus Module
8+
9+
This Terraform module deploys Directus on an AWS Fargate ECS cluster.
10+
11+
## Usage
12+
13+
```hcl
14+
module "directus" {
15+
source = "./.."
16+
17+
application_name = local.name # Change this to your application name
18+
admin_email = "[email protected]" # Change this to your email address
19+
vpc_id = module.vpc.vpc_id # Change this to your VPC ID
20+
subnet_ids = module.vpc.public_subnets # Change this to your subnet IDs
21+
22+
create_cloudwatch_logs_group = true
23+
cloudwatch_logs_stream_prefix = "directus"
24+
25+
cpu = 1024
26+
memory = 2048
27+
28+
rds_database_name = "database_name"
29+
rds_database_host = "database_host"
30+
rds_database_port = "database_port
31+
rds_database_engine = "database_engine"
32+
rds_database_username = "database_username
33+
rds_database_password_secrets_manager_arn = "database_user_password_secrets_manager_arn"
34+
35+
create_s3_bucket = true # If you do not create an S3 bucket, you will need to provide an existing S3 bucket name
36+
s3_bucket_name = "terraform-aws-directus-${local.region}"
37+
38+
healthcheck_path = "/server/ping"
39+
image_tag = "latest" # It's HIGHLY RECOMMENDED to specify an image tag instead of relying on "latest" as it could trigger unwanted updates.
40+
41+
tags = {
42+
Application = "Directus"
43+
Environment = "Test"
44+
} # Change these tags to your prefered tags
45+
}
46+
```
47+
48+
For further information on a complete example (including all dependencies, such as database inputs) check [here](https://github.com/GiamPy5/terraform-aws-directus/tree/main/examples).
49+
50+
## Features
51+
52+
- Easy deployment of Directus on AWS Fargate ECS
53+
- Automatic scaling and load balancing
54+
- Highly available and fault-tolerant architecture
55+
- Customizable configuration options
56+
- S3 integration for static assets
57+
58+
## To-Be-Done
59+
60+
- Implement Redis to allow multi-container deployment (currently only one is supported) (https://docs.directus.io/self-hosted/config-options.html#redis)
61+
- Implement Amazon Cognito authentication
62+
- HTTPS support
63+
64+
## Prerequisites
65+
66+
Before using this module, make sure you have the following prerequisites:
67+
68+
- AWS account
69+
- Terraform installed
70+
- Basic knowledge of AWS services and Terraform
71+
72+
<!-- BEGIN_TF_DOCS -->
73+
{{ .Content }}
74+
<!-- END_TF_DOCS -->
75+
76+
## Contributing
77+
78+
Contributions to this module are welcome! If you encounter any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.
79+
80+
## License
81+
82+
This module is open source and available under the [MIT License](https://opensource.org/licenses/MIT).
83+
{{/** End of file fixer */}}

README.md

Lines changed: 51 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,6 @@
22

33
This Terraform module deploys Directus on an AWS Fargate ECS cluster.
44

5-
## Features
6-
7-
- Easy deployment of Directus on AWS Fargate ECS
8-
- Automatic scaling and load balancing
9-
- Highly available and fault-tolerant architecture
10-
- Customizable configuration options
11-
- S3 integration for static assets
12-
13-
## To-Be-Done
14-
15-
- Implement Redis to allow multi-container deployment (currently only one is supported) (https://docs.directus.io/self-hosted/config-options.html#redis)
16-
- Implement Amazon Cognito authentication
17-
- HTTPS support
18-
19-
## Prerequisites
20-
21-
Before using this module, make sure you have the following prerequisites:
22-
23-
- AWS account
24-
- Terraform installed
25-
- Basic knowledge of AWS services and Terraform
26-
275
## Usage
286

297
```hcl
@@ -63,16 +41,43 @@ module "directus" {
6341

6442
For further information on a complete example (including all dependencies, such as database inputs) check [here](https://github.com/GiamPy5/terraform-aws-directus/tree/main/examples).
6543

44+
## Features
45+
46+
- Easy deployment of Directus on AWS Fargate ECS
47+
- Automatic scaling and load balancing
48+
- Highly available and fault-tolerant architecture
49+
- Customizable configuration options
50+
- S3 integration for static assets
51+
52+
## To-Be-Done
53+
54+
- Implement Redis to allow multi-container deployment (currently only one is supported) (https://docs.directus.io/self-hosted/config-options.html#redis)
55+
- Implement Amazon Cognito authentication
56+
- HTTPS support
57+
58+
## Prerequisites
59+
60+
Before using this module, make sure you have the following prerequisites:
61+
62+
- AWS account
63+
- Terraform installed
64+
- Basic knowledge of AWS services and Terraform
65+
66+
<!-- BEGIN_TF_DOCS -->
6667
## Requirements
6768

68-
No requirements.
69+
| Name | Version |
70+
|------|---------|
71+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
72+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.30 |
73+
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0 |
6974

7075
## Providers
7176

7277
| Name | Version |
7378
|------|---------|
74-
| <a name="provider_aws"></a> [aws](#provider\_aws) | n/a |
75-
| <a name="provider_random"></a> [random](#provider\_random) | n/a |
79+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.30 |
80+
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.0 |
7681

7782
## Modules
7883

@@ -87,29 +92,29 @@ No requirements.
8792
| [aws_ecs_service.directus](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_service) | resource |
8893
| [aws_ecs_task_definition.directus](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_task_definition) | resource |
8994
| [aws_iam_access_key.directus](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_access_key) | resource |
90-
| [aws_iam_policy.cloudwatch-logs-policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
91-
| [aws_iam_role.ecs-service-role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
92-
| [aws_iam_role.ecs-task-role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
93-
| [aws_iam_role_policy_attachment.ecs-service-role-ecs-task-execution](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
95+
| [aws_iam_policy.cloudwatch_logs_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
96+
| [aws_iam_role.ecs_service_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
97+
| [aws_iam_role.ecs_task_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
98+
| [aws_iam_role_policy_attachment.ecs_service_role_ecs_task_execution](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
9499
| [aws_iam_user.directus](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_user) | resource |
95100
| [aws_iam_user_policy.lb_ro](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_user_policy) | resource |
96101
| [aws_lb.directus](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb) | resource |
97-
| [aws_lb_listener.directus-lb-listener-http](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_listener) | resource |
98-
| [aws_lb_target_group.directus-lb-target-group-http](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_target_group) | resource |
102+
| [aws_lb_listener.directus_lb_listener_http](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_listener) | resource |
103+
| [aws_lb_target_group.directus_lb_target_group_http](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_target_group) | resource |
99104
| [aws_s3_bucket.directus](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) | resource |
100-
| [aws_secretsmanager_secret.directus-admin-password](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/secretsmanager_secret) | resource |
101-
| [aws_secretsmanager_secret.directus-secret](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/secretsmanager_secret) | resource |
102-
| [aws_secretsmanager_secret.directus-serviceuser-secret](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/secretsmanager_secret) | resource |
103-
| [aws_secretsmanager_secret_version.directus-admin-password-version](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/secretsmanager_secret_version) | resource |
104-
| [aws_secretsmanager_secret_version.directus-secret-version](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/secretsmanager_secret_version) | resource |
105-
| [aws_secretsmanager_secret_version.directus-serviceuser-secret-version](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/secretsmanager_secret_version) | resource |
106-
| [aws_security_group.ecs-sg](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource |
105+
| [aws_secretsmanager_secret.directus_admin_password](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/secretsmanager_secret) | resource |
106+
| [aws_secretsmanager_secret.directus_secret](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/secretsmanager_secret) | resource |
107+
| [aws_secretsmanager_secret.directus_serviceuser_secret](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/secretsmanager_secret) | resource |
108+
| [aws_secretsmanager_secret_version.directus_admin_password_version](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/secretsmanager_secret_version) | resource |
109+
| [aws_secretsmanager_secret_version.directus_secret_version](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/secretsmanager_secret_version) | resource |
110+
| [aws_secretsmanager_secret_version.directus_serviceuser_secret_version](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/secretsmanager_secret_version) | resource |
111+
| [aws_security_group.ecs_sg](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource |
107112
| [aws_security_group.lb_sg](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource |
108-
| [random_password.directus-admin-password](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/password) | resource |
109-
| [random_password.directus-secret](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/password) | resource |
113+
| [random_password.directus_admin_password](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/password) | resource |
114+
| [random_password.directus_secret](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/password) | resource |
110115
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
111-
| [aws_iam_policy_document.cloudwatch-policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
112-
| [aws_iam_policy_document.s3-policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
116+
| [aws_iam_policy_document.cloudwatch_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
117+
| [aws_iam_policy_document.s3_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
113118
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |
114119
| [aws_s3_bucket.directus](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/s3_bucket) | data source |
115120

@@ -143,10 +148,10 @@ No requirements.
143148

144149
| Name | Description |
145150
|------|-------------|
146-
| <a name="output_load_balancer_dns_name"></a> [load\_balancer\_dns\_name](#output\_load\_balancer\_dns\_name) | n/a |
147-
| <a name="output_s3_bucket_arn"></a> [s3\_bucket\_arn](#output\_s3\_bucket\_arn) | n/a |
148-
| <a name="output_s3_bucket_name"></a> [s3\_bucket\_name](#output\_s3\_bucket\_name) | n/a |
149-
151+
| <a name="output_load_balancer_dns_name"></a> [load\_balancer\_dns\_name](#output\_load\_balancer\_dns\_name) | The DNS name of the load balancer |
152+
| <a name="output_s3_bucket_arn"></a> [s3\_bucket\_arn](#output\_s3\_bucket\_arn) | The ARN of the S3 bucket |
153+
| <a name="output_s3_bucket_name"></a> [s3\_bucket\_name](#output\_s3\_bucket\_name) | The name of the S3 bucket |
154+
<!-- END_TF_DOCS -->
150155

151156
## Contributing
152157

0 commit comments

Comments
 (0)