terraform-provider-template icon indicating copy to clipboard operation
terraform-provider-template copied to clipboard

template_dir resource should support wildcarding on the source_dir attribute

Open aggallim opened this issue 5 years ago • 1 comments

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.

aggallim avatar Sep 26 '18 11:09 aggallim

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

tomlarkworthy avatar Jul 15 '19 16:07 tomlarkworthy