Skip to content

devops-terraform-aws/modules

Repository files navigation

Install Jenkins, SonarQube, Nexus, Tomcat on AWS Terraform

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

Terraform Virtual Environment Configuration - WSL-Ubuntu (Optional)

  • 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
    

Deploy Application to AWS

  • Terraform version must be v1.3.0 and above. verify your installations by running
terraform --version

AWS Credentials Setup (Optional)

sudo apt install awscli -y
aws --version
  • Generate Access Key and Secret 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]:
  • To deploy all the resources set bootstrap=true in the terraform.tfvars

Jenkins Credentials

  • Default port: 8080
  • SSH into Jenkins Server using the private key that is created
  • Inside the Jenkins Server, run
sudo cat /var/lib/jenkins/secrets/initialAdminPassword

Nexus Credentials

  • Default port: 8081
  • Username: admin
  • Password: SSH into Nexus Server and run
sudo cat /opt/sonatype-work/nexus3/admin.password

SonarQube Credentials

  • Default port: 9000
  • Username: admin
  • Password: admin

Tomcat Server

  • Default port: 8080

To Provision Specific Server

  • 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 to false in the tfvars | Line 9

    allow_all_network_traffic = false
    
  • Provision Application(s)

terraform init && terraform apply --auto-approve
  • Give it 1 minute to provision the server(s).

Destroy all resources

terraform destroy --auto-approve
  • To clean up your environment after destroying resources run:
./scripts/clean.sh

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published