Jenkins: v2.375.1
terraform: v1.3.6
docker run --name myjenkins -p 8080:8080 -p 50000:50000 -v $HOME:/var/jenkins_home jenkins/jenkins:lts-jdk11
-
Access http://localhost:8080 and authorized with admin password. Default path of password is
/var/jenkins_home/secrets/initialAdminPassword
.
# Enter container with root user.
docker exec -it --user root myjenkins bash
# Install terraform
apt update
apt-get install wget
apt-get install unzip
wget https://releases.hashicorp.com/terraform/1.3.6/terraform_1.3.6_linux_amd64.zip
unzip terraform_1.3.6_linux_amd64.zip
# Check version
terraform --version
-
Follow the tutorial to setup terraform plugin, AWS Credentials, Jenkins Pipeline
- You might need to copy his Jenkinsfile and modify by youself.
-
After building the pipeline, jenkins will load the Jenkinsfile and update the content.