-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Dev #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Mraakhil
wants to merge
24
commits into
iam-veeramalla:main
Choose a base branch
from
Mraakhil:dev
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Dev #21
Changes from 12 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
6233152
Update main.tf
Mraakhil 20bc619
Update EKS variables for region, availability zones, and instance types
Mraakhil b721375
lo bhai jenkinsfile
Mraakhil eced5f2
afaf
Mraakhil 9b48127
git
Mraakhil b4cec78
le bhai
Mraakhil 923a06f
ksgs
Mraakhil d0c419f
doneboss
Mraakhil ef9e5b9
regiondone
Mraakhil 016cd5e
fix man
Mraakhil e3fb6f8
yes
Mraakhil 014e4ac
lsss
Mraakhil 2daa5e1
afsafd
Mraakhil da631d3
jdsfsdf
Mraakhil 0bebcb3
Update Jenkinsfile
Mraakhil 7b71481
Update Jenkinsfile
Mraakhil 9c73715
Update Jenkinsfile
Mraakhil 3f31783
Update Jenkinsfile
Mraakhil 7963f1c
Refactor Jenkins pipeline stages and cleanup
Mraakhil 5f72585
Update variables.tf
Mraakhil 39dee0c
Change default instance type from t3.micro to c7i-flex.large
Mraakhil c12cad9
Update variables.tf
Mraakhil 34bee1f
Update default Kubernetes version to 1.36
Mraakhil 37c3b47
Update variables.tf
Mraakhil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| pipeline { | ||
| agent any | ||
| tools { | ||
| terraform 'terraform-latest' // Must match the name you set in Manage Jenkins -> Tools | ||
| } | ||
|
|
||
| parameters { | ||
| choice(name: 'ACTION', choices: ['apply', 'destroy'], description: 'Choose whether to apply or destroy the Terraform EKS module') | ||
| } | ||
|
|
||
| environment { | ||
| TF_DIR = 'eks-install' | ||
| AWS_DEFAULT_REGION = 'ap-south-1' | ||
|
|
||
| // This pulls the two "Secret text" credentials you already created in Jenkins | ||
| // using the exact IDs shown in your screenshot ('accesskey' and 'secretaccesskey') | ||
| AWS_ACCESS_KEY_ID = credentials('accesskey') | ||
| AWS_SECRET_ACCESS_KEY = credentials('secretaccesskey') | ||
| } | ||
|
|
||
| stages { | ||
| stage('Checkout Code') { | ||
| steps { | ||
| checkout scm | ||
| } | ||
| } | ||
|
|
||
| stage('Terraform Init') { | ||
| steps { | ||
| dir("${env.TF_DIR}") { | ||
| sh 'terraform init' | ||
| } | ||
| } | ||
| } | ||
|
|
||
| stage('Terraform Plan') { | ||
| steps { | ||
| dir("${env.TF_DIR}") { | ||
| sh "terraform plan ${params.ACTION == 'destroy' ? '-destroy' : ''} -out=tfplan" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| stage('Manual Approval') { | ||
| steps { | ||
| input message: "Review plan for folder '${env.TF_DIR}'. Proceed with ${params.ACTION}?", ok: 'Proceed' | ||
| } | ||
| } | ||
|
|
||
| stage('Terraform Execute') { | ||
| steps { | ||
| dir("${env.TF_DIR}") { | ||
| script { | ||
| if (params.ACTION == 'apply') { | ||
| sh 'terraform apply -auto-approve tfplan' | ||
| } else if (params.ACTION == 'destroy') { | ||
| sh 'terraform apply -destroy -auto-approve' | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| post { | ||
| always { | ||
| cleanWs() // Cleans up workspace after execution | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: iam-veeramalla/ultimate-devops-project-aws
Length of output: 285
🏁 Script executed:
Repository: iam-veeramalla/ultimate-devops-project-aws
Length of output: 271
🌐 Web query:
Terraform S3 backend use_lockfile flag documentation GetObject PutObject DeleteObject permissions .tflock💡 Result:
When you enable native S3 state locking in the Terraform S3 backend by setting the use_lockfile argument to true, Terraform utilizes a lock file with a.tflock suffix (e.g., path/to/key.tflock) to manage concurrency [1][2][3]. Because Terraform must create, access, and subsequently delete this lock file to manage the locking lifecycle, you must grant specific IAM permissions for the.tflock object [2][3][4]. Required Permissions If use_lockfile is set to true, the following permissions are required specifically for the lock file resource [1][5][6]: s3:GetObject s3:PutObject s3:DeleteObject These permissions must be applied to the ARN corresponding to the lock file, such as arn:aws:s3:::mybucket/path/to/my/key.tflock [1][6]. Key Distinction It is important to note that the state file itself (the.tfstate file) does not require the s3:DeleteObject permission, as Terraform does not delete the state file during standard operations [2][6][4]. The s3:DeleteObject permission is strictly required for the.tflock file because Terraform actively deletes it to release the lock once an operation completes [2][3][4]. Failure to include s3:DeleteObject for the lock file will result in errors when Terraform attempts to release the lock [2][4][7].
Citations:
Pin and validate the Terraform locking contract.
use_lockfilerequires a Terraform CLI that supports the S3use_lockfileargument, butJenkinsfileinvokes an unpinnedterraform initand this module has no Terraform version constraint. Also ensure the Jenkins credentials can accessterraform.tfstate.tflockwiths3:GetObject,s3:PutObject, ands3:DeleteObject; S3 locking depends on those lockfile operations.Add a compatible
required_versionconstraint and validate the Jenkins agent/iam policy before relying on this lock.🤖 Prompt for AI Agents