First Impressions with Terraform Cloud (Part 2)
Updated: Jan 27
I wanted to provide a quick update on some further testing with TF Cloud. Part 1 is here.
*continued in part 3
There are two things I want to cover in this short post. Firstly, in the month or so that it has been since I last tested TF Cloud, it appears that the plan steps now render in the unique way that the apply steps do.
Previous plans looked similar to normal terminal output.
The new plan step has a unique rendering in the TF Cloud UI.
Secondly, I want to cover some additional testing I conducted with variables. In the previous post, it seemed like TF Cloud was forcing you to input Terraform variables within the web UI. This is because there is no way to reference a .tfvars file during execution and TF Cloud overrides a local terraform.tfvars file with a generated one that is based on the variable inputs in the UI.
As I was writing the original blog post, I came across this thread which shined a lot of light on how to keep variables in TF code with TF Cloud. I did some testing with this today and was pretty happy with the result.
The thread brings up that TF Cloud will still let you use .auto.tfvars files to pull in variables from code. I have never used .auto.tfvars files before, but I went ahead and removed the variables from the TF Cloud UI.
Then I opened VS Code and created a new terraform.auto.tfvars file with the variables that were originally in the TF Cloud UI.
After committing and pushing to Github, the plan kicked off in Terraform Cloud. As hoped, it worked great and the plan executed, with no expected changes, successfully.
With that, a big concern that I had was gone. I couldn't believe that HashiCorp would force you to move your variables out of code and I was pleased to see that that was not the case and only slight modifications were needed to accomplish what was being done in other CI/CD tools and manual TF executions.