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

Implement ephemeral resources #374

Closed
2 tasks
mitchnielsen opened this issue Feb 10, 2025 · 5 comments
Closed
2 tasks

Implement ephemeral resources #374

mitchnielsen opened this issue Feb 10, 2025 · 5 comments

Comments

@mitchnielsen
Copy link
Contributor

Summary

Terraform 1.10 adds support for ephemeral resources, which were added to help keep sensitive information out of plan and state files.

Let's look to see if there are any opportunities to make use of this in our provider.

Acceptance criteria

  • Opportunities to implement ephemeral resources are identified (if any)
  • Issue(s) created for implementation
@mitchnielsen
Copy link
Contributor Author

mitchnielsen commented Feb 10, 2025

Research

@mitchnielsen
Copy link
Contributor Author

From what I'm seeing so far, these are primarily helpful for configuring providers and defining locals and outputs. That's because at the moment, you can't reference ephemeral resources in regular resources and datasources (because that would persist their data to state).

  • Here is an example from the google provider where an ephemeral resource is used to retrieve a secret value used to configure the provider. Looking at the source schema for that attribute, I don't see that anything was required to support this.

@mitchnielsen
Copy link
Contributor Author

mitchnielsen commented Feb 10, 2025

I'm also seeing discussions that a slightly alternative approach might be available in Terraform 1.11 (now looking like 1.14 based on the linked milestone), where instead of creating a separate ephemeral resource, you'll be able to mark attributes as write-only. From the PR description:

Write-only attributes are managed resource attributes whose values are not saved to the Terraform plan or state artifacts and can accept ephemeral values.

I could see us using this for attributes marked as Sensitive, such as service account api_key and block data.

@mitchnielsen
Copy link
Contributor Author

After chatting with @jamiezieziula, we're going to try this out for working with the api_key attribute for service accounts. This resource/datasource currently stores that attribute in state (as expected), so we could potentially remove that attribute and shift it to an ephemeral resource. We already have logic to get the API key and rotate it if the expiration date has passed (or been changed manually in the configuration), so we should be able to use that for the implementation.

Will give that a try.

Copy link
Contributor Author

See #375 (comment). Because API key values are not stored in Prefect, we don't have a consistent way to access them, which "breaks" the implementation for us here.

@mitchnielsen mitchnielsen closed this as not planned Won't fix, can't repro, duplicate, stale Feb 11, 2025
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

2 participants