Ask questionsfailed to save provider manifest: open .terraform/plugins/linux_amd64/lock.json: permission denied


Jenkins CICD Error I am running on Jenkins (CICD pipeline) but I am getting an error

+ ./terraform init
 **Initializing provider plugins**...
 **failed to save provider manifest: open .terraform/plugins/linux_amd64/lock.json: permission denied** 

here is my bash file:

 agent any
stages {
steps  {
  sh '''
	sudo apt-get install unzip
	sudo wget
	sudo unzip
	echo $PWD
	sudo mv terraform /var/lib/jenkins/workspace/jenks/s3-bucket-creation
	cd /var/lib/jenkins/workspace/jenks/s3-bucket-creation
	./terraform --version
	./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?



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.


Related questions

The argument "host" is required, but no definition was found. hot 3
Unable to run 0.12upgrade hot 3
Module cannot find alias AWS provider in 0.12.0 hot 3
Error: Invalid template interpolation value hot 2
Terraform v0.11.1 : Error downloading modules: Error loading modules: open .terraform/modules/3f10921295c292995128e9e36eb: no such file or directory hot 2
MalformedPolicyDocument: Policy document should not specify a principal. hot 2
Error in Terraform 0.12.0: This object has no argument, nested block, or exported attribute hot 2
Feature Request - Allow list/array in 'query' in 'external' data source hot 2
Terraform provider downloads fail with TLS handshake timeout hot 2
'terraform init' failed with 'Registry service unreachable.' error hot 2
for_each attribute for creating multiple resources based on a map hot 2
`Unreadable module directory` error is not clear for nested modules hot 2
Provider Development: Expected type 'string', got unconvertible type '[]interface {}' - with complicated block hot 2
"Error: Provider configuration not present" when aliased provider is used hot 2
Error loading state: state snapshot was created by Terraform v0.12.7, which is newer than current v0.12.6 hot 2
Github User Rank List