jmccann / drone-terraform

Drone plugin for triggering Terraform deployments
http://plugins.drone.io/jmccann/terraform/
Apache License 2.0
86 stars 93 forks source link

Unable to pass deploy parameter into vars #97

Closed arkadiuszmigalaperform closed 5 years ago

arkadiuszmigalaperform commented 5 years ago

I'm using Drone 0.8

While invoking drone deploy I want to pass custom parameter e.g. VERSION_TAG to tell which TAG should be used for deployment.

So I invoke it by dronecli:

drone deploy -p VERSION_TAG=0.0.2 myrepo 10 dev

But I'm unable to access it in standard way in plugin:

terraform_dev_ecs_deploy:
  image: jmccann/drone-terraform:6
  ...
  root_dir: deployment
  vars:
    docker_image_tag: ${VERSION_TAG}
  when:
    event: deployment
    environment: dev

was trying also: $VERSION_TAG $$VERSION_TAG $${VERSION_TAG}

even:

my-step:
  image: jmccann/drone-terraform:6
  environment:
    - TAG=${VERSION_TAG}
  vars:
    docker_image_tag: ${TAG}

with same results any idea how it can be pass there, is it even possible?

caioquirino commented 5 years ago

Hi @arkadiuszmigalaperform, what you are receiving on terraform side? An empty string? Does the variable exists? Can you check if it is working for example using the following:

  test:
    image: alpine
    commands:
      - echo "VERSION_TAG=${VERSION_TAG}"
arkadiuszmigalaperform commented 5 years ago

Above example is not working and it's impossible with Drone 0.8 which I'm using. Brad answers here: https://discourse.drone.io/t/accessing-deploy-params-in-pipeline/5253