terraform-provider-external icon indicating copy to clipboard operation
terraform-provider-external copied to clipboard

Implement resource

Open nazarewk opened this issue 5 years ago • 1 comments

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:

  1. broaden the scope of temporary directory (create it less often)? not sure it's possible without some ugly hacks
  2. prefer /tmp//run//var/run instead of TF_DATA_DIR? Some linux/unix distributions mount (a lot faster) in-memory disks in there.
  3. 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

nazarewk avatar Oct 18 '20 11:10 nazarewk

CLA assistant check
All committers have signed the CLA.

hashicorp-cla avatar Nov 22 '20 08:11 hashicorp-cla