drone-terraform
drone-terraform copied to clipboard
Root_dir is not applied
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.
hi, having exactly the same issue, did you find out the problem ?
Thanks
Hi! Nope, ended up doing it without plugins using the terraform docker image
@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:
...
Thanks @henriquegibin , I guess that should be fixed or better documented at least
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.
Is this going to be fixed? I can't use the plugin if this is not solved. @jmccann