I'm building a pipeline with Terraform docker container and I'm getting error message: "Terraform initialized in an empty directory!"In my Jenkinsfile I'm executing something like this:
Terraform 0.12.1
docker run -w /app -v /jenkins_dir:/app my-repo/hashicorp-terraform:0.12.1 initWhen I execute a ls -all on the /jenkins_dir directory, I see the configurations files. I also ran a similar instruction locally and it works without issues. Seems to me this is a Jenkins issue but I can't see why?
--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-too...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/bd1e2436-e790-4fda-b815-43290046d873%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
pipeline {
agent {
docker {
image 'my-repo/hashicorp-terraform:0.12.1'
args '--entrypoint="" -w /app -v /var/jenkins_home/jobs/devopsmigration/jobs/NexusIQ/branches/master/workspace:/app'
}
}
stages {
stage('checkout') {
steps {
checkout scm
}
}
stage('init') {
steps {
sh 'terraform version && terraform init -input=false'
}
}You say you executed ls in that directory... Did you change there first from inside the Docker?Does it have a WORKING directory set in the Dockerfile?--
Fernando Miguel
On Thu, 13 Jun 2019, 05:14 Patria Lukman, <phlu...@lukzen.com> wrote:
--I'm building a pipeline with Terraform docker container and I'm getting error message: "Terraform initialized in an empty directory!"In my Jenkinsfile I'm executing something like this:Terraform 0.12.1docker run -w /app -v /jenkins_dir:/app my-repo/hashicorp-terraform:0.12.1 initWhen I execute a ls -all on the /jenkins_dir directory, I see the configurations files. I also ran a similar instruction locally and it works without issues. Seems to me this is a Jenkins issue but I can't see why?
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terrafo...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-too...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/6f93c425-77db-4441-8b7d-9f196b0a1614%40googlegroups.com.