@ -23,10 +23,28 @@ variable "artifactory_access_token" {
description = " The admin-level access token to use for JFrog. "
description = " The admin-level access token to use for JFrog. "
}
}
variable " check_license " {
type = bool
description = " Toggle for pre-flight checking of Artifactory license. Default to `true`. "
default = true
}
variable " refreshable " {
type = bool
description = " Is this token refreshable? Default is `false`. "
default = false
}
variable " expires_in " {
type = number
description = " The amount of time, in seconds, it would take for the token to expire. "
default = null
}
variable " username_field " {
variable " username_field " {
type = string
type = string
description = " The field to use for the artifactory username. i.e. Coder username or email. "
description = " The field to use for the artifactory username. Default `username` ."
default = " email "
default = " username "
validation {
validation {
condition = can ( regex ( " ^(email|username) $ " , var . username_field ) )
condition = can ( regex ( " ^(email|username) $ " , var . username_field ) )
error_message = " username_field must be either 'email' or 'username' "
error_message = " username_field must be either 'email' or 'username' "
@ -60,6 +78,7 @@ locals {
provider " artifactory " {
provider " artifactory " {
url = join ( " / " , [ var . jfrog_url , " artifactory " ] )
url = join ( " / " , [ var . jfrog_url , " artifactory " ] )
access_token = var . artifactory_access_token
access_token = var . artifactory_access_token
check_license = var . check_license
}
}
resource " artifactory_scoped_token " " me " {
resource " artifactory_scoped_token " " me " {
@ -67,7 +86,8 @@ resource "artifactory_scoped_token" "me" {
# which fails validation .
# which fails validation .
username = length ( local . username ) > 0 ? local . username : " dummy "
username = length ( local . username ) > 0 ? local . username : " dummy "
scopes = [ " applied-permissions/user " ]
scopes = [ " applied-permissions/user " ]
refreshable = true
refreshable = var . refreshable
expires_in = var . expires_in
}
}
data " coder_workspace " " me " { }
data " coder_workspace " " me " { }