-
Notifications
You must be signed in to change notification settings - Fork 56
Add ephemeral resource to provider #442
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
base: main
Are you sure you want to change the base?
Conversation
This PR implements an ephemeral resource that works like the existing data source. This allows running external programs without storing the result in Terraform's state, addressing concerns with sensitive data handling (closes hashicorp#437). Our use-case is running an external program that outputs credentials for use by a provider. Storing a Terraform user's credentials in a remote state backend would be a problem. Here's the code this PR allows us to write: ```hcl provider "google" { credentials = local.credentials } locals { credentials = jsonencode(ephemeral.external.credentials.result) } ephemeral "external" "credentials" { program = [ # Program that fetches credentials on the user's workstation ] } ``` The ephemeral resource's implementation is heavily copied from the data source's to ensure that the behavior is the same. Any difference would be confusing for users and a pain to document and maintain. The ephemeral resource's tests check the same scenarios as the data source's, but take a different approach to inspecting the program's output. The data source's tests run code with `output` blocks, but that doesn't work with ephemeral resources. I created a separate test program for the new tests. This program writes its output to a file specified by the test. After running Terraform, the tests can read this file to check that the content is as expected. I've run this provider on our Terraform codebase and it behaves as desired. If you have any changes you want me to make, I am happy to make them.
|
Hey @austinvalle, sorry for the ping. Any chance you can take a look at this PR? 🙏 |
|
Hey @austinvalle and @stephybun 👋 I'm still waiting on a response for this PR. Do you see any work needed to get this merged? I'm more than happy to make any changes you bring up :) |
|
Hey @austinvalle, @stephybun, and @SBGoods 👋 Sorry for the wide ping. I'm not clear on how to get this PR on the correct person's radar. Any chance you can help with that? 🙏 |
|
It seems that maintainers' focus has shifted to the It may make more sense to implement a |
Hey there @busser 👋🏻 , thanks for your PR! I'd intended to respond to this one once we had merged hashicorp/terraform-provider-local#452, but since you asked, I think an ephemeral resource would be a good addition! We'd prefer the design/implementation match the proposed Some of the differences at a high level with
|
Related Issue
Fixes #437
Description
This PR implements an ephemeral resource that works like the existing data source. This allows running external programs without storing the result in Terraform's state, addressing concerns with sensitive data handling (closes #437).
Our use-case is running an external program that outputs credentials for use by a provider. Storing a Terraform user's credentials in a remote state backend would be a problem. Here's the code this PR allows us to write:
The ephemeral resource's implementation is heavily copied from the data source's to ensure that the behavior is the same. Any difference would be confusing for users and a pain to document and maintain.
The ephemeral resource's tests check the same scenarios as the data source's. I've actually added a test case to the data source, that checks that the
working_dirattribute works as expected.I've run this provider on our Terraform codebase and it behaves as desired.
If you have any changes you want me to make, I am happy to make them.
Rollback Plan
Changes to Security Controls
No.