https://github.com/kunchalavikram1427/jenkins_terraform_intergration
Provision infrastructure with Terraform and Jenkins
https://github.com/kunchalavikram1427/jenkins_terraform_intergration
Last synced: 8 months ago
JSON representation
Provision infrastructure with Terraform and Jenkins
- Host: GitHub
- URL: https://github.com/kunchalavikram1427/jenkins_terraform_intergration
- Owner: kunchalavikram1427
- Created: 2023-10-31T15:06:54.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-11-01T21:09:29.000Z (almost 2 years ago)
- Last Synced: 2025-01-15T15:00:28.405Z (9 months ago)
- Language: Mustache
- Size: 84 KB
- Stars: 4
- Watchers: 2
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Terraform with Jenkins
## Youtube Video URL
[How to Use Terraform and Jenkins to Automate Infrastructure Setup](https://youtu.be/kIDiP3Unj7Y)## Install Jenkins
https://www.jenkins.io/doc/book/installing/kubernetes/#install-jenkins-with-helm-v3
```
helm repo add jenkinsci https://charts.jenkins.io
helm repo update
helm search repo
helm pull jenkinsci/jenkins --untar
```
Run
```
helm upgrade --install jenkins jenkins/
```
or install without making any changes to the chart by running
```
helm upgrade --install jenkins jenkinsci/jenkins --set controller.servicePort=80 --set controller.serviceType=LoadBalancer
```
Get password
```
kubectl exec -it jenkins-0 -- bash
cat /run/secrets/additional/chart-admin-password
```
## Pipeline Steps Snippets### Agent Template
https://plugins.jenkins.io/kubernetes/
```
agent {
kubernetes {
yaml '''
apiVersion: v1
kind: Pod
metadata:
labels:
app: test
spec:
containers:
- name: terraform
image: hashicorp/terraform
command:
- cat
tty: true
- name: git
image: bitnami/git:latest
command:
- cat
tty: true
'''
}
}
```
### Build Options
https://www.jenkins.io/doc/book/pipeline/syntax/#options
```
options {
buildDiscarder logRotator(daysToKeepStr: '2', numToKeepStr: '10')
timeout(time: 10, unit: 'MINUTES')
}
```## Plugins to use
```
https://plugins.jenkins.io/github/
https://plugins.jenkins.io/embeddable-build-status/
https://plugins.jenkins.io/matrix-auth/
```## Links
```
https://hub.docker.com/r/hashicorp/terraform
https://registry.terraform.io/providers/hashicorp/aws/latest/docs
https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#handling-credentials
https://www.jenkins.io/doc/book/pipeline/syntax/#input
https://www.jenkins.io/doc/book/pipeline/syntax/#parameters
https://www.jenkins.io/doc/book/pipeline/syntax/#options
```## Author
- Vikram K (www.youtube.com/c/devopsmadeeasy)