Sitemap

My First Challenge On my Journey to been a DevOps Engineer

3 min readApr 5, 2019

So here was i sitting on my chair and with my PC when i got a challenge to create a pipeline in Jenkins that runs Terraform and then pull the Jenkins file from a git repo, well as a newbie i started doing some research and read a lot of article on Medium and Stackoverflow, i was able to come up with this script

Press enter or click to view image in full size
Jenkins Pipeline Script

And that above was my first error, i was pulling from develop rather than from master, thanks to my mentor he corrected me and i changed it right to master.

Now i will walk you through each error i got and also how i was able to overcome it.

The first error was this

Press enter or click to view image in full size
Git error: Could not locate develop commit

Now after i changed it to master

Press enter or click to view image in full size
Could not fetch from repo

Now the error above had to do with my repo, it could not find any terraform file to pull so what i did was change the github repo to this: https://github.com/terraform-aws-modules/terraform-aws-ec2-instance

And Yes! you guessed right i had another error, now at this moment this was my day day 6 on the task, here is the error:

Press enter or click to view image in full size
Error: Initialization in an empty directory

Basically, Terraform initialization worked but it was checking this directory called dev and it could not locate any config file (.tf) and terraform plan requires a config file to be present and also i did not set my path right, you can read up on how to set path here: https://www.tecmint.com/set-path-variable-linux-permanently/ and https://letslearndevops.com/2017/07/23/how-to-install-terraform/.

So all i did was create a config file in my dev folder, set my path, restarted Jenkins and voila it worked and here is a picture of the success message:

Press enter or click to view image in full size
Success Message

And there you have it, 6 days working and Yay, it ran with no error.

Lesson learnt: Never give up, just that little more push will make it a success and always reach out for help.

Adefemi Micheal Afuwape
Adefemi Micheal Afuwape

Written by Adefemi Micheal Afuwape

Exceptional results ⚒️☁️. "Give me a place on which to stand, and I will move the earth"