Terraforming the Lab

Posted by Brad on Mon 21 October 2019

Well, I finally got around to making my lab terraform more useful and decided it was probably time to make it available to the world (not that any of its generic enough to be usable by anyone else). Currently it sets up a few basic things in vCenter (that were mostly imported) and is able to create a VM and bootstrap chef client on it. For a little while I toyed with using Infoblox, however the provider hadn't been updated for Terraform 0.12 at the time and I was tired of having to rebuild every 60 days. So now I'm trying to once again use dhcp unless I really need to static IP something.

Before I ramble to long you can take a look at the repo at https://git.bradlab.tech/lab/terraform.

At home I have a gitlab server that I do all my work in and some basic CI/CD stuff and then I sync that with my public gitea server. When I went to set up the repo sync for this I ran across a few issues. The first was permission related in gitea. I forgot to add the repo to the team that includes my sync user. Then I started getting 413 errors from gitlab. It turned out that was caused by having previously commited a large binary file. The file had been removed but of course it was still in the history and so the sync was failing. Per this I found out you can rewrite the git history without having to worry about 3rd party tools with the following command git filter-branch --tree-filter 'rm -f yourgiantfile' HEAD. Once I had performed the git surgery sync started working as expected.

Now that I have basic VM creation working I hope to add some additional chef work to do more than just the basics as well as create another module to provision via ansible. Long term I also want to add more of the vCenter infrastructure but since it's already built and the import function isn't quite perfect this might not happen as quickly. I also ran into an issue with guest customization running on CentOS 8 that I need to dig further into. In other words lots of fun to come with terraform in the lab.

tags: terraform, git