Skip to content

Support other target types as Terraform module dependencies #23642

Description

@RaniSputnik

Is your feature request related to a problem? Please describe.

We are using the hashicorp/external provider for Terraform which allows us to run arbitrary scripts as a a data source (input) to a Terraform module. We use this because we have a shell script for retrieving artifacts from a database.

The problem is that the only files that get materialised in the sandbox for the terraform backend to use are file targets and resource targets. This is a bit inconvenient because it means you usually need to add two pants targets for a single file:

shell_sources(name="shell-scripts")

# Duplicate target covered in shell sources above
# to allow Terraform to list it as a dependency.
file(name="get-artifacts-script-file", source="get_artifacts.sh")

terraform_module(dependencies=[":get-artifacts-script-file"])

Describe the solution you'd like

I would like to be able to directly reference (and materialise) shell scripts, python scripts... any other file target like so:

shell_sources(name="shell-scripts")
terraform_module(dependencies=[":shell-scripts"])

You can see a full example (including Terraform code) here.

Describe alternatives you've considered

As described in the problem statement, you can work around this using the file and resource targets, but it means multiple targets referencing the same file.

Additional context

This would make even more sense if Terraform also packaged dependencies (where required). I will keep this issue narrow in scope and open a separate issue for that.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions