coder / coder/terraform-provider-coder

Stable way to get Workspace owner's email in terraform

Open
#326 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
60
Forks
27
Avg merge
1d 21h
Merged PRs (30d)
2

Description

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 `default@example.com`, 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:

```terraform
namespace = data.coder_workspace_owner.me.email != "default@example.com" ? replace(split("@", data.coder_workspace_owner.me.email)[0], ".", "-") : "coder"
```

I added a check for the default value after noticing `template push` failed validation

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.