1

Looking to get pointed in the right direction:

I am trying to build a pipeline that will recognize changes in a remote terraform template that will recognize changes compared to the previous git command before mine and have it only apply those changes by using specified commands:

terraform get -update
terraform plan

I also want it to display to the user and have user confirmation to proceed and have 2 min for total user response

Still green with Jenkins but so far:

I have the git fetch stage to grab the branch on the remote repository

A terraform init stage to initialize terraform

Can anyone point me to the right direction to detect the changes and apply them with the commands?

1 Answers1

0

Your question is really vague and depends a lot of information that you didn't supply.

Some of things you didn't mention were what git branching strategy you are using.

Typically you are not going to run terraform apply on every single commit. Instead you are going to have people open a PR and on that PR you will run linting and other static code checks like tfsec, terraform validate etc.

Then once that PR is merged to the master/main branch of your repo, you will run terraform apply.

This is still a beginners pipeline though because it has lots of problems still, like what happens when you merge to master but your deployment fails.

You need to talk to your team about how they want to build and test there software so that you can pick a branching strat and then design the pipeline around that.

Levi
  • 1,084
  • 6
  • 18