rename coder_workspace data

pull/47/head
Muhammad Atif Ali 2 years ago
parent 147be91352
commit 60c9ef3e3c

@ -26,13 +26,13 @@ variable "allow_email_change" {
default = false default = false
} }
data "coder_workspace" "me" {} data "coder_workspace" "git_config" {}
data "coder_parameter" "user_email" { data "coder_parameter" "user_email" {
count = var.allow_email_change ? 1 : 0 count = var.allow_email_change ? 1 : 0
name = "user_email" name = "user_email"
type = "string" type = "string"
default = data.coder_workspace.me.owner_email default = data.coder_workspace.git_config.owner_email
description = "Git user.email to be used for commits" description = "Git user.email to be used for commits"
display_name = "Git config user.email" display_name = "Git config user.email"
mutable = true mutable = true
@ -42,7 +42,7 @@ data "coder_parameter" "username" {
count = var.allow_username_change ? 1 : 0 count = var.allow_username_change ? 1 : 0
name = "username" name = "username"
type = "string" type = "string"
default = data.coder_workspace.me.owner default = data.coder_workspace.git_config.owner
description = "Git user.name to be used for commits" description = "Git user.name to be used for commits"
display_name = "Git config user.name" display_name = "Git config user.name"
mutable = true mutable = true
@ -51,8 +51,8 @@ data "coder_parameter" "username" {
resource "coder_script" "git_config" { resource "coder_script" "git_config" {
agent_id = var.agent_id agent_id = var.agent_id
script = templatefile("${path.module}/run.sh", { script = templatefile("${path.module}/run.sh", {
CODER_USERNAME = try(data.coder_parameter.username[0].value, data.coder_workspace.me.owner) CODER_USERNAME = try(data.coder_parameter.username[0].value, data.coder_workspace.git_config.owner)
CODER_EMAIL = try(data.coder_parameter.user_email[0].value, data.coder_workspace.me.owner_email) CODER_EMAIL = try(data.coder_parameter.user_email[0].value, data.coder_workspace.git_config.owner_email)
}) })
display_name = "Git Config" display_name = "Git Config"
icon = "/icon/git.svg" icon = "/icon/git.svg"

Loading…
Cancel
Save