https://github.com/jeff-pedro/learn-terraform-ansible
Repository used to learn about Ansible and Terraform with AWS provider.
https://github.com/jeff-pedro/learn-terraform-ansible
ansible aws terraform
Last synced: 2 months ago
JSON representation
Repository used to learn about Ansible and Terraform with AWS provider.
- Host: GitHub
- URL: https://github.com/jeff-pedro/learn-terraform-ansible
- Owner: jeff-pedro
- Created: 2023-05-30T01:34:38.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-01T17:39:37.000Z (over 2 years ago)
- Last Synced: 2025-12-03T18:30:37.104Z (7 months ago)
- Topics: ansible, aws, terraform
- Language: HCL
- Homepage:
- Size: 66.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Learning Terraform and Ansible with AWS provider
> This repository deploy a simple API. Building the infrastructure, installation and dependencies necessary to run the web server.
### Applied Concepts
- Separation of environments: Production and Dev
- Elastic Infrastructure
- Suspend Machines
- Load Test with [Locust](https://locust.io/)
### Useful resources
- [Official Terraform Docs](https://developer.hashicorp.com/terraform/tutorials/aws-get-started)
- [Official Ansible Docs](https://docs.ansible.com/ansible/latest/getting_started/index.html)
## Terraform
> Used to deploy the infrastructure.
### Initialize the configuration directory
```
terraform init
```
### Check and validate format code
```
terraform fmt
terraform validate
```
### Create infrastructure
1. Show the plan
```
terraform plan
```
2. Apply changes
```
terraform apply
```
3. Destroy resources
```
terraform destroy
```
## Ansible
> Used to manage configurations and install programs.
1. Run
```
ansible-playbook playbook.yml -u [user] --private-key [key] --hosts [host_file]
```
## Deploy Production
---
1. Go to
```
cd ./env/Prod
```
2. Check
```
terraform plan
```
3. Deploy
```
terraform apply
```
**Web Interface**
> http://:**8000**
## Deploy Dev
---
1. Go to
```
cd ./env/Dev
```
2. Check
```
terraform plan
```
3. Deploy Infrastruture
```
terraform apply
```
4. Deploy API
```
ansible-playbook playbook.yml -u ubuntu --private-key IaC-DEV --hosts ../../infra/hosts.yml
```
**Web Interface**
> http://:**8000**
## Load Test
```
locust -f ./load.py
```
**Web Interface**
> http://0.0.0.0:8089