Ask questionsfailed to save provider manifest: open .terraform/plugins/linux_amd64/lock.json: permission denied
Hi
Jenkins CICD Error I am running on Jenkins (CICD pipeline) but I am getting an error
+ ./terraform init
[0m[1m **Initializing provider plugins**...[0m
[31m **failed to save provider manifest: open .terraform/plugins/linux_amd64/lock.json: permission denied** [0m[0m
here is my bash file:
.sh
-----------------------------
pipeline{
agent any
stages {
stage('test')
{
steps {
terraformInstall()
sh '''
sudo apt-get install unzip
sudo wget https://releases.hashicorp.com/terraform/0.11.13/terraform_0.11.13_linux_amd64.zip
sudo unzip terraform_0.11.13_linux_amd64.zip
echo $PWD
sudo mv terraform /var/lib/jenkins/workspace/jenks/s3-bucket-creation
cd /var/lib/jenkins/workspace/jenks/s3-bucket-creation
./terraform --version
ls
./terraform init
./terraform plan -var access_key=${params.access_key} -var secret_key=${params.secret_key}
./terraform apply -auto-approve -var access_key=${params.access_key} -var secret_key=${params.secret_key}
'''
}
}
}}
def terraformInstall(){
echo "terraform running on Jenkins"
echo "${params.access_key}"
}
----------------------------------------------------------------------------------------------------
How to resolve this error?
Thanks
Answer
questions
hashibot[bot]
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.