Skip to content
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

Root_dir is not applied #105

Open
etienne-napoleone opened this issue Nov 1, 2019 · 6 comments
Open

Root_dir is not applied #105

etienne-napoleone opened this issue Nov 1, 2019 · 6 comments

Comments

@etienne-napoleone
Copy link

etienne-napoleone commented Nov 1, 2019

Hi!
I've been testing drone-terraform and can't get root_dir to work:

---
kind: pipeline
type: docker
name: terraform

steps:
- name: plan
  image: jmccann/drone-terraform:6
  plan: true
  root_dir: terraform
  volumes:
    - name: docker
      path: /var/run/docker.sock

volumes:
  - name: docker
    host:
      path: /var/run/docker.sock
➜ tree .
.
├── README.md
├── .drone.yml
└── terraform
    └── main.tf
➜ drone exec --trusted
[plan:0] time="2019-11-01T06:08:01Z" level=info msg="Drone Terraform Plugin Version" Revision=
[plan:1] $ terraform version
[plan:2] Terraform v0.12.11
[plan:3]
[plan:4] Your version of Terraform is out of date! The latest version
[plan:5] is 0.12.13. You can update by downloading from www.terraform.io/downloads.html
[plan:6] $ rm -rf .terraform
[plan:7] $ terraform init -input=false
[plan:8] Terraform initialized in an empty directory!
[plan:9]
[plan:10] The directory has no Terraform configuration files. You may begin working
[plan:11] with Terraform immediately by creating Terraform configuration files.
[plan:12] $ terraform get
[plan:13] $ terraform validate
[plan:14] Success! The configuration is valid.
[plan:15]
[plan:16] $ terraform plan -out=plan.tfout
[plan:17]
[plan:18] Error: No configuration files
[plan:19]
[plan:20] Plan requires configuration to be present. Planning without a configuration
[plan:21] would mark everything for destruction, which is normally not what is desired.
[plan:22] If you would like to destroy everything, run plan with the -destroy option.
[plan:23] Otherwise, create a Terraform configuration file (.tf file) and try again.
[plan:24]
[plan:25] time="2019-11-01T06:08:02Z" level=fatal msg="Failed to execute a command" error="exit status 1"
2019/11/01 15:08:03 plan : exit code 1

If I put the file in the root directory, it will be planned.

@numiralofe
Copy link

hi,
having exactly the same issue, did you find out the problem ?

Thanks

@etienne-napoleone
Copy link
Author

Hi!
Nope, ended up doing it without plugins using the terraform docker image

@henriquegibin
Copy link

@etienne-napoleone I had the same issue, but I made root_dir work as follows:

- name: terraform
  image: jmccann/drone-terraform
  settings:
    root_dir: terraform/
  environment:
    ...

@etienne-napoleone
Copy link
Author

Thanks @henriquegibin , I guess that should be fixed or better documented at least

@jmccann
Copy link
Owner

jmccann commented Jul 31, 2020

I'm guessing this is due to latest versions of Drone. Docs written for this plugin were for Drone 0.8.0. I've not used any version past that tbh. Open to a PR to update docs otherwise I'll try to get to it sometime.

@mknapcok
Copy link

Is this going to be fixed? I can't use the plugin if this is not solved. @jmccann

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants