NOTE: Developed using Terraform 0.12.x syntax.
-
Configure the AWS Credentials and install the general packages, Terraform, Terragrunt, Go and Terraform-Docs following the instructions on the REQUIREMENTS.md file.
-
Clone this repository.
git clone https://github.com/aeciopires/adsoft
cd adsoft/aws_services
- This directory contains the files:
terraform_prod.tfvars
=> where you can define the values of the variables for environment production used bymain.tf
. See Inputsvariables.tf
=> The default values of the variables used bymain.tf
, if you not define values in toterraform_prod.tfvars
file. See Inputs
- The goal is to install Docker Registry, Prometheus, Zabbix, Grafana and Apps.
-
Change the values according to the need of the environment in the
terraform_prod.tfvars
file. -
Validate the settings and create the environment with the following commands
terragrunt validate
terragrunt plan
terragrunt apply
terragrunt show
Terragrunt is a thin wrapper that provides extra tools for keeping your configurations DRY, working with multiple Terraform modules, and managing remote state.
Terragrunt will forward almost all commands, arguments, and options directly to Terraform, but based on the settings in your terragrunt.hcl
file
Useful commands:
terraform --help
=> Show help of command terraformterraform providers
=> Prints a tree of the providers used in the configurationterraform init
=> Initialize a Terraform working directoryterraform validate
=> Validates the Terraform filesterraform plan
=> Generate and show an execution planterraform apply
=> Builds or changes infrastructureterraform show
=> Inspect Terraform state or planterraform destroy
=> Destroy Terraform-managed infrastructureterraform output
=> Show informations output.terraform graph | dot -Tsvg > graph.svg
=> Show graph with resources relationaments.
No destroy some resource:
- list all resources
terraform state list
- remove that resource you don't want to destroy, you can add more to be excluded if required
terraform state rm <resource_to_be_deleted>
- destroy the whole stack except above resource(s)
terraform destroy
Access: https://terragrunt.gruntwork.io/docs/getting-started/cli-options/
In the your notebook or computer, edit or create the daemon.json file, whose default location is /etc/docker/daemon. Add the follow content:
{
"insecure-registries" : ["myregistrydomain.com:5000"]
}
Change myregistrydomain.com
for IP Address server of according your environment.
sudo systemctl restart docker
Reference: https://docs.docker.com/registry/insecure/
- Generate docs with terraform-docs for project
adsoft/aws_services
.
cd adsoft/aws_services
terraform-docs markdown . > /tmp/doc.md
cat /tmp/doc.md
Name | Version |
---|---|
aws | n/a |
Name | Description | Type | Default | Required |
---|---|---|---|---|
address_allowed | IP or Net address allowed for remote access. | string |
"179.159.236.209/32" |
no |
aws_instance_user | Instance user for remote connection. | string |
"ubuntu" |
no |
aws_key_name | Key name. | string |
"aws-teste" |
no |
aws_key_private_path | Private Key Private path. | string |
"/home/aws-teste.pem" |
no |
aws_key_public_path | Private Key Public path. | string |
"/home/aws-teste.pub" |
no |
aws_zone | The zone to operate under, if not specified by a given resource. Reference: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html | string |
"us-east-2" |
no |
disk_size | AWS EBS disk size in GB | number |
300 |
no |
disk_type | AWS EBS disk type. Reference: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html | string |
"gp2" |
no |
port_apps_crud_api | Port Apps Crud API. | number |
9000 |
no |
port_apps_nodejs | Port Apps NodeJS. | number |
8080 |
no |
port_apps_python_external_01 | Port Apps Python external. | number |
8001 |
no |
port_apps_python_external_02 | Port Apps Python external. | number |
8002 |
no |
port_grafana_external | Port Grafana external. | number |
3000 |
no |
port_loki_external | Port Loki external. | number |
3100 |
no |
port_prometheus_external | Port Prometheus external. | number |
9090 |
no |
port_protocol | Protocol of container ports. | string |
"TCP" |
no |
port_registry_external | Port Registry external. | number |
5000 |
no |
port_ssh_external | Port SSH external. | number |
22 |
no |
port_zabbix_server_external | Port Zabbix Server external. | number |
10051 |
no |
port_zabbix_web_external | Port Prometheus external. | number |
80 |
no |
s3_bucket_name | S3 bucket name | string |
"adsoft_bucket" |
no |
vpc_cidr_block | Range of IPv4 address for the VPC. | string |
"10.0.0.0/16" |
no |
Name | Description |
---|---|
apps_instance_id | ID instance |
apps_instance_name | Name instance |
apps_ip_private | Private IP instance |
apps_ip_public | Public IP instance |
loki_instance_id | ID instance |
loki_instance_name | Name instance |
loki_ip_private | Private IP instance |
loki_ip_public | Public IP instance |
monitoring_instance_id | ID instance |
monitoring_instance_name | Name instance |
monitoring_ip_private | Private IP instance |
monitoring_ip_public | Public IP instance |
registry_instance_id | ID instance |
registry_instance_name | Name instance |
registry_ip_private | Private IP instance |
registry_ip_public | Public IP instance |
security_group | Id of security Group |