Fix Readme
parent
c09b7fb5c4
commit
1966ed1078
@ -1,54 +1,33 @@
|
|||||||
terraform {
|
---
|
||||||
required_version = ">= 1.0"
|
display_name: Dotfiles
|
||||||
|
description: Allow developers to optionally bring their own dotfiles repository to customize their shell and IDE settings!
|
||||||
|
icon: ../.icons/dotfiles.svg
|
||||||
|
maintainer_github: coder
|
||||||
|
verified: true
|
||||||
|
tags: [helper]
|
||||||
|
---
|
||||||
|
|
||||||
required_providers {
|
# Dotfiles
|
||||||
coder = {
|
|
||||||
source = "coder/coder"
|
|
||||||
version = ">= 0.12"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "agent_id" {
|
Allow developers to optionally bring their own [dotfiles repository](https://dotfiles.github.io)! Under the hood, this module uses the [coder dotfiles](https://coder.com/docs/v2/latest/dotfiles) command.
|
||||||
type = string
|
|
||||||
description = "The ID of a Coder agent."
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "default_dotfiles_uri" {
|
```tf
|
||||||
type = string
|
module "dotfiles" {
|
||||||
description = "The default dotfiles URI if the workspace user does not provide one."
|
source = "registry.coder.com/modules/dotfiles/coder"
|
||||||
default = ""
|
version = "1.0.2"
|
||||||
|
agent_id = coder_agent.example.id
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
|
||||||
data "coder_parameter" "dotfiles_uri" {
|
## Setting a default dotfiles repository
|
||||||
type = "string"
|
|
||||||
name = "dotfiles_uri"
|
|
||||||
display_name = "Dotfiles URL (optional)"
|
|
||||||
default = var.default_dotfiles_uri
|
|
||||||
description = "Enter a URL for a [dotfiles repository](https://dotfiles.github.io) to personalize your workspace"
|
|
||||||
mutable = true
|
|
||||||
icon = "/icon/dotfiles.svg"
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "coder_script" "personalize" {
|
You can set a default dotfiles repository for all users by setting the `default_dotfiles_repo` variable:
|
||||||
agent_id = var.agent_id
|
|
||||||
script = <<-EOT
|
|
||||||
DOTFILES_URI="${data.coder_parameter.dotfiles_uri.value}"
|
|
||||||
if [ -n "$${DOTFILES_URI// }" ]; then
|
|
||||||
coder dotfiles "$DOTFILES_URI" -y 2>&1 | tee -a ~/.dotfiles.log
|
|
||||||
fi
|
|
||||||
EOT
|
|
||||||
display_name = "Dotfiles"
|
|
||||||
icon = "/icon/dotfiles.svg"
|
|
||||||
run_on_start = true
|
|
||||||
}
|
|
||||||
|
|
||||||
output "dotfiles_uri" {
|
```tf
|
||||||
description = "Dotfiles URI"
|
module "dotfiles" {
|
||||||
value = data.coder_parameter.dotfiles_uri.value
|
source = "registry.coder.com/modules/dotfiles/coder"
|
||||||
|
version = "1.0.12"
|
||||||
|
agent_id = coder_agent.example.id
|
||||||
|
default_dotfiles_repo = "https://github.com/coder/dotfiles"
|
||||||
}
|
}
|
||||||
|
```
|
||||||
output "dotfiles_default_uri" {
|
|
||||||
description = "Dotfiles Default URI"
|
|
||||||
value = var.default_dotfiles_uri
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue