The Jenkins pipeline used in this repo defines of various stages used to initialise, plan, approve and apply terraform configurations
This repo is intended to showcase the simplicity of leveraging Jenkins, Terraform & Ansible together and how to best structure an IaC repo with clear demarcation between Infrastructure as Code & Configuration Management.
-
Setup with AWS authentication
-
Terraform 12 installed and working
In order to run this example pipeline yourself you'll first need to fork this repo, then complete the following changes:
-
Update the BACKEND_BUCKET value
-
Update the filters in data.tf to reference values applicable to your AWS environment
-
Create a new Jenkins pipeline using the location of your forked repo
-
Create a DynamoDB table for state locking defined as terraform-state-lock
You can use the Terraform/Setup configuration to create a test S3 backend bucket / Dynamo table if needed, if you'd prefer to use existing infrastructure just update the values in the Jenkinsfile & terraform.tf accordingly
Running the pipeline will create everything in the Demo directory for the environment specified, it will pause for manual approval before making any changes, this allows you to fully review the tf plan before proceeding.
Parameter | Options | Description |
---|---|---|
Action | build or destroy | The action to take on the terraform infrastructure |
Colour | blue or green | The leg to take action on |