Skip to content
This repository has been archived by the owner on Apr 26, 2022. It is now read-only.

Copy subdirectories and their contents in to the tmpdir. #47

Closed
wants to merge 1 commit into from

Conversation

deanwilson
Copy link
Contributor

We've started breaking things like json polcies and templates
out of the raw .tf files in to subdirectories. This ensures those are copied over too.

We've started breaking things like json polcies and templates
out of the raw .tf files in to subdirectories. This ensures those are copied over too.
# this has a small chance of overwriting a file if both resources/ and resources/$env
# have the same file
['files', 'templates'].each do |subdir|
if File.directory? "#{dir}/#{subdir}/"
Copy link
Contributor

@gpeng gpeng Apr 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dir here is resources or resources/<env> so this is working with an expected structure where the templates and files are inside resources rather than in <project>. Is that correct as it doesn't match up with @surminus's comment on #46?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works for a directory structure as per @surminus's #46 comment if we also pass the project directory into the loop at line line 163

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, seem to have left this go stale. I believe this approach is correct and the one I stated here is incorrect as we might want to have different files or templates with a different environment, which this loop takes account of.

@surminus
Copy link
Contributor

👍 merge!

@surminus
Copy link
Contributor

This doesn't actually work so I am going to close it off. The problem is that we "flatten" everything into a single temporary directory (foo) and then copy templates and files into subdirectories beneath then (foo/templates). When we run the rake task the code references the relative directory (templates/file.json) but Terraform only works on a CWD basis, so can't find the file.

I have suggested an alternative in a143e95.

@surminus surminus closed this May 24, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants