scottwinkler / terraform-provider-shell

Terraform provider for executing shell commands and saving output to state file
Mozilla Public License 2.0
279 stars 60 forks source link

add interpreter #54

Closed scottwinkler closed 4 years ago

scottwinkler commented 4 years ago

This closes PR #37 .

A new interpreter attribute is added to the provider and data source + managed resource. This allows users to overwrite the default interpreter. The order of precedence is: default interpreter < provider supplied interpreter < resource supplied interpreter.

Here is an example of configuring the provider:

provider "shell" {
    interpreter = ["/bin/bash", "-c"]
}

and here is an example of configuring a resource:

resource "shell_script" "example" {
    lifecycle_commands {
        create = file("${path.module}/scripts/create.sh")
        read   = file("${path.module}/scripts/read.sh")
        update = file("${path.module}/scripts/update.sh")
        delete = file("${path.module}/scripts/delete.sh")
    }

    interpreter = ["/bin/bash", "-c"]
}