Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

External resource provider #5

Open
bramtassyns opened this issue Jul 19, 2017 · 3 comments
Open

External resource provider #5

bramtassyns opened this issue Jul 19, 2017 · 3 comments

Comments

@bramtassyns
Copy link

Hi,

Are you are working on/considering adding support for resources (next to data) to this provider?

While you can use a null_resource to create a sort of 'scripted' provider using provisioners. The support for running a script on destruction is very limited there (if you set the count to 0 it is executed, if you just remove it the script is never executed). It also lacks the option to set output variables based on the output of your script.

@apparentlymart
Copy link
Member

Hi @bramtassyns,

This is not something the Terraform team at HashiCorp is currently working on, mainly just due to focus being elsewhere.

The original proposal for this provider in hashicorp/terraform#8144 did discuss such a resource type, but we elected to do the data source only for the first pass because it was a "quicker win" to solve a particular class of problem and we were concerned about the complexity of delegating the whole resource lifecycle to an external program.

If someone in the community has the time and motivation to work on it, we'd love to help get that in. This is the sort of thing that likely requires some prototyping and design iteration to find an approach that makes the right tradeoffs, so it will likely require trying a few approaches to find the one that feels the most "right" within the constraints.

(The original proposal called for these objects to be called external_data_source and external_resource, but during implementation of the former we shortened the name to just external and I would suggest that we do the same for the resource too, so its declaration would be like resource "external" "foo".)

@toddnni
Copy link

toddnni commented Feb 14, 2018

While ago, I created a simple shell provider https://github.com/toddnni/terraform-provider-shell that can be used to wrap external programs to terraform. I would be happy to have same functionality covered in external resource provider either by taking the functionality from mine or having better in external provider.

@nazarewk
Copy link

Some time ago I've implemented the most generic external commands provider I could think of nazarewk-iac/terraform-provider-custom. It is based on string attributes <-> files mappings (see the design in docs) without providing any advanced logic - it is supposed to be wrapped in a purpose-built modules and leverage new Terraform 0.12+ features to provide nicer to use interfaces.

Recently I thought about how to move forward with the provider (improve docs/tests, create example modules etc.) and whether I could use it in my current workplace (not unless it's built and hosted in-house or Verified/Official in registry). It just hit me the easiest way to move forward would be trying to integrate it into official provider. Looks like resource implementation is still an open question so here we go.

It is a result of 2 years of pondering on the issues encountered previously in daftcode/terraform-provider-scripted (which was built-opn toddnni/terraform-provider-shell ) and roughly 1 workday of implementation.

Since the behavior is simple enough to explain in a few paragraphs and the implementation is relatively short and simple (~500 LoC) I think it would be a perfect candidate for merging and maintaining as part of external provider.

@apparentlymart I would be more than happy to prepare a PR for my proposal as long as there is any real chance of merging it.
Does it make sense? What would you need from me to move forward with it?

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

No branches or pull requests

4 participants