-
Notifications
You must be signed in to change notification settings - Fork 24
feat: add coder_task data source #460
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
Conversation
| name string | ||
| cronExpr string | ||
| expectWarnings bool | ||
| expectErrors bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drive-by go fmt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small suggestions but otherwise 👍🏻
| "id": { | ||
| Type: schema.TypeString, | ||
| Computed: true, | ||
| Description: "The UUID of the task, if executing in a Coder Task context. Empty in a Coder Workspace context.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we set optional true, is that possible for computed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should according to the documentation for Computed:
If Required and Optional are both false, the attribute will be considered "read only" for the practitioner, with only the provider able to set its value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah TIL, I had assumed computed already meant read-only.
Terraform will tolerate a certain amount of self-reference, but this changes when using
count.For example, the below is accepted
Whereas this outputs a cycle error:
After some cursory searching, I didn't find much more information on this apart from this post.
Adding a data source is not too big a deal as the required environment variables are already present.
With this additional data source, the above example becomes:
NB: I explicitly named this
coder_taskto sidestep this check in Coder. I'm open to alternative names, but it can't becoder_ai_task.See coder/coder#20416 for what this looks like in practice.