variable "username" {
description = "API username"
type = string
}
variable "password" {
description = "API password"
type = string
}
computed "basic_auth" {
description = "Base64-encoded Basic Auth credentials"
expression = base64encode("${var.username}:${var.password}")
}
task "publish-artifact" {
description = "Upload a build artifact to the package registry"
commands = [
"curl -X PUT https://registry.example.com/api/artifact -H 'Authorization: Basic ${computed.basic_auth}' --data-binary @dist/app.tar.gz",
]
}