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

Template terms of usage #261

Open
stirby opened this issue Jun 25, 2024 · 0 comments
Open

Template terms of usage #261

stirby opened this issue Jun 25, 2024 · 0 comments
Assignees
Labels
module-idea A new module idea or suggestion

Comments

@stirby
Copy link
Contributor

stirby commented Jun 25, 2024

We can add a little module that adds a required terms of service for template usage:

data "coder_parameter" "terms_of_use" {
  name         = "terms-of-use"
  display_name = "Terms of use"
  description  = "Please type \"yes\" to accept the [data privacy agreement](https://coder.com/) before using this template. Otherwise, **the workspace build will fail**."
  type         = "string"
}

Then users can use a precondition in their resource lifecycle:

  lifecycle {
    # The user must accept a 
    precondition {
      condition     = regex("(?i)^\\s*yes\\s*$", data.coder_parameter.terms_of_use.value)
      error_message = "Build prevented. You must accept the terms of use before creating a workspace from this template." 
    }
  }

Once coder/coder#12686 is shipped, we can make it fully contained within the module and prevent workspace creation if it's not accepted.

@stirby stirby self-assigned this Jun 25, 2024
@stirby stirby added the module-idea A new module idea or suggestion label Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module-idea A new module idea or suggestion
Projects
None yet
Development

No branches or pull requests

1 participant