hashicorp / terraform-provider-template

Terraform template provider
https://www.terraform.io/docs/providers/template/
Mozilla Public License 2.0
131 stars 89 forks source link

template_dir doesn't skip hidden files #68

Open ekini opened 5 years ago

ekini commented 5 years ago

Terraform Version

Terraform v0.12.6, template provider v2.1.2

Affected Resource(s)

Please list the resources as a list, for example:

Terraform Configuration Files

provider template {}

resource "template_dir" "config" {
  source_dir      = "${path.module}/instance_config_templates"
  destination_dir = "${path.cwd}/instance_config"
}

Where instance_config_templates let's say is a git submodule, so it has .git directory inside.

Debug Output

$terraform apply
template_dir.config: Refreshing state... [id=d1cde20a34d2c848136a151c73453d8ee6b680b9]

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # template_dir.config will be created
  + resource "template_dir" "config" {
      + destination_dir = "/tmp/a/instance_config"
      + id              = (known after apply)
      + source_dir      = "./instance_config_templates"
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

template_dir.config: Creating...

Error: failed to render instance_config_templates/.git/hooks/applypatch-msg.sample: <template_file>:14,47-51: Invalid operand; Unsuitable value for right operand: a number is required.

  on main.tf line 3, in resource "template_dir" "config":
   3: resource "template_dir" "config" {

Expected Behavior

Hidden files (starting with dot) should be skipped, or at least there should be a configuration option to skip files by using a pattern.

Actual Behavior

It tries to render instance_config_templates/.git/hooks/applypatch-msg.sample as a template and fails.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Important Factoids

None

References

None

JrCs commented 4 years ago

Any chance to have a fix for this soon ?