-
Notifications
You must be signed in to change notification settings - Fork 22
Stable way to get Workspace owner's email in terraform #326
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
Comments
From talking to a co-worker, I'm thinking this could fairly be considered a bug... it makes sense to use dummy values during |
I added this to my template as a workaround: # write email to a file since data.coder_workspace_owner
# gets populated with dummy values upon teraform destroy
resource "local_file" "email" {
filename = "email"
content = data.coder_workspace_owner.me.email
lifecycle {
ignore_changes = [
content
]
}
} Then I just replaced |
Not sure whether you consider this a bug. If not, it would be useful to mention at the docs that the values are only populated during |
Hi @aarosil , can you provide the versions of Coder and the Terraform provider for which you are seeing this behaviour? |
Sure, it was coder Helm chart I can try again with any later versions in case you can't reproduce it |
I'm reading
data.coder_workspace_owner.me.email
in a template for use in Kubernetes, to derive the user's namespace from their email address. During destroy, the datasource returns[email protected]
, so my template breaks. Is there a stable way to access the user's email from within the template?This is the code I'm using now which doesn't work:
I added a check for the default value after noticing
template push
failed validationThe text was updated successfully, but these errors were encountered: