terraform-provider-external
terraform-provider-external copied to clipboard
Implement resource
this PR is retrofitted from https://github.com/nazarewk-iac/terraform-provider-custom / https://registry.terraform.io/providers/nazarewk-iac/custom/latest
The documentation is available at https://registry.terraform.io/providers/nazarewk/external/latest/docs/resources/resource?pollNotifications=true
Contrary to the data source the resource does not have stdin/stdout interface with Terraform. Instead it uses TF_DATA_DIR subdirectory and set of text files named after resource attributes for following reasons:
- sometimes it's hard to tame script's or tool's stdout,
- makes it easier to categorize data
- makes it possible to mark data as sensitive (implemented) or not store it in the state at all (not implemented, might yield issues on delete)
the biggest drawbacks of the approach are:
- slower to execute,
- creates files,
I can identify some room for code improvement:
- broaden the scope of temporary directory (create it less often)? not sure it's possible without some ugly hacks
- prefer
/tmp//run//var/runinstead ofTF_DATA_DIR? Some linux/unix distributions mount (a lot faster) in-memory disks in there. - Add debugging trace? So far I am relying only on diagnostics.
Related to:
- External resource provider - https://github.com/hashicorp/terraform-provider-external/issues/5
- Proposal: "external" provider - https://github.com/hashicorp/terraform/issues/8144