ljfranklin / terraform-resource

A concourse resource to create infrastructure via Terraform
MIT License
185 stars 85 forks source link

import_files is not used when plan_only is set #146

Closed fenech closed 3 years ago

fenech commented 3 years ago

I would like to ensure that running apply doesn't lead to any data loss for an existing repo, so I added a file github.yml:

github_repository.my_repo: my-repo

and in my pipeline I have configured:

  - name: plan-terraform-github
    public: true
    plan:
      - get: repo
        trigger: true
      - put: terraform-github
        params:
          terraform_source: repo/terraform/github
          plan_only: true
          import_files:
            - repo/terraform/imports/github.yml

but when I run the job, it says that the a new repo will be added, and there is no sign of any import having taken place.

Is this the expected behaviour? If so, how can I make sure that it is safe to run the apply?

ljfranklin commented 3 years ago

Thanks for the heads up, this looks like an oversight on my part. This should be fixed with https://github.com/ljfranklin/terraform-resource/commit/d217c4ca02e78fc30e98957f923771894f6115e6 which is included in the ljfranklin/terraform-resource:latest and ljfranklin/terraform-resource:0.14.8 images.