All resources are provisioned on us-east-1
(update the tfvars for your region)
- Clone the repository:
git clone https://github.com/devops-terraform-aws/modules.git
- Configure virtual environment on
Ubuntu WSL
sudo apt update && sudo apt upgrade -y
sudo ln -sf $(which python3) /usr/bin/python && sudo apt install python3-venv -y && sudo apt install unzip -y
python -m venv venv && source venv/bin/activate
- Terraform Installation
- Run the
install-terraform.sh
script
./scripts/install-terraform.sh
- Reload the virtual environment to ensure you have the latest terraform version
source venv/bin/activate
- Run the
- Terraform version must be
v1.3.0
and above. verify your installations by running
terraform --version
sudo apt install awscli -y
aws --version
- Generate
Access Key
andSecret Keys
from AWS Click Here- In
WSL2
, do:aws configure
- Parse the following:
AWS Access Key ID [None]:
AWS Secret Access Key [None]:
Default region name [None]:
Default output format [None]:
- In
- To deploy all the resources set
bootstrap=true
in theterraform.tfvars
Default port
: 8080SSH
intoJenkins Server
using the private key that is created- Inside the
Jenkins Server
, run
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Default port
: 8081Username
: adminPassword
:SSH
intoNexus Server
and run
sudo cat /opt/sonatype-work/nexus3/admin.password
Default port
: 9000Username
: adminPassword
: admin
Default port
: 8080
- Configure the tfvars
- For example to provision only
Jenkins Server
, set
bootstrap_jenkins = true
bootstrap_tomcat = false
bootstrap_nexus = false
bootstrap_sonarqube = false
-
To whitelist on your IP (Allow only your IP to access the VMs), set
allow_all_network_traffic
tofalse
in the tfvars | Line 9allow_all_network_traffic = false
-
Provision Application(s)
terraform init && terraform apply --auto-approve
- Give it 1 minute to provision the server(s).
terraform destroy --auto-approve
- To clean up your environment after
destroying resources
run:
./scripts/clean.sh