https://github.com/buildo/terraform-aws-dockercomposehost
Terraform module for creating EC2 instances with Docker and Docker Compose installed
https://github.com/buildo/terraform-aws-dockercomposehost
Last synced: 7 months ago
JSON representation
Terraform module for creating EC2 instances with Docker and Docker Compose installed
- Host: GitHub
- URL: https://github.com/buildo/terraform-aws-dockercomposehost
- Owner: buildo
- License: mit
- Created: 2018-07-24T09:30:40.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2021-11-05T17:52:03.000Z (almost 5 years ago)
- Last Synced: 2025-01-21T03:41:34.323Z (over 1 year ago)
- Language: HCL
- Size: 43.9 KB
- Stars: 7
- Watchers: 4
- Forks: 15
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: security_group.tf
Awesome Lists containing this project
README
# aws-dockercomposehost
Terraform module for creating AWS EC2 instances with Docker and Docker Compose installed.
## Example
```yaml
# docker-compose.yml
version: '3'
services:
hello:
image: nginxdemos/hello
ports:
- "80:80"
```
```hcl
# main.tf
module "aws-dockercomposehost" {
source = "git@github.com:/buildo/terraform-aws-dockercomposehost.git"
project_name = "project-name"
ssh_key_name = "existing-key"
in_open_ports = [80]
}
```
By default a custom cloud watch configuration will be used.
If you want to specify a different one, just give a value to the variable `var.cloudwatch_agent_config`
Example:
```hcl
# main.tf
module "aws-dockercomposehost" {
source = "git@github.com:/buildo/terraform-aws-dockercomposehost.git"
project_name = "project-name"
ssh_key_name = "existing-key"
in_open_ports = [80]
cloudwatch_agent_config = "cwagentconfig.json"
}
```
## Resources
These resources are always created:
- A EC2 instance
- A Security Group
- A Security Group Rule for port 22/tcp
- A Security Group Rule for each port / port range specified in variable `in_open_ports`
- A IAM Role called "${var.project_name}-instance-profile"
- A IAM Profile called "${var.project_name}"
These resources are created if their variable is set
| Resource | Variable |
|---|---|
| A CloudWatch Alarm for disk space utilization | disk_utilization_alarm_enabled == true |
| A Route53 record | zone_id && host_name |
| | |
## Fixes/Ideas
- Missing data are treated as "breaching", but the cloudwatch agent needs time to begin to collect data. This way the alarm is always triggered. Solutions?
- Isn't better to have directly an AMI built with something (Packer?) with docker and docker-compose installed?