Skip to content
This repository has been archived by the owner on Oct 8, 2020. It is now read-only.

template_dir resource should support wildcarding on the source_dir attribute #37

Open
aggallim opened this issue Sep 26, 2018 · 1 comment

Comments

@aggallim
Copy link

Hi I would like to see the template_dir resource support wildcarding on the source_dir attribute.

template_dir renders all files within the source_dir directory. I would like to be able to specif a wildcard in the source-dir. For my use case this is to target a particular file type.

Terraform Version

Terraform v0.11.1

  • provider.aws v1.34.0
  • provider.local v1.1.0
  • provider.template v1.0.0

Affected Resource(s)

template_dir

Actual Behavior

resource "template_dir" "this" {
  source_dir      = "../templates/"
  destination_dir = "${path.root}/rendered"

  vars {
    foo= "bar"
  }
}

Expected Behavior

resource "template_dir" "this" {
  source_dir      = "../templates/*.tpl"
  destination_dir = "${path.root}/rendered"

  vars {
    foo= "bar"
  }
}

I'd like to keep my code DRY and not use template_file unless someone can suggest a way to use count in template_file and enumerate the .tpl files.

@tomlarkworthy
Copy link

or adding excludes would be really helpful to me. The situation I am in is trying to deploy GAE manually via gcloud. You need the app.yaml and .js files in a directory. I want the env variables to be templated in app.yaml, however, I use the ${} syntax in the sibling javascript files. template_dir chokes coz it can't instanciate the Javascript templates. I don't want to escape them as it breakes JS IDE. I would like to copy the whole directory over but apply templating only to the app.yaml

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

No branches or pull requests

3 participants