slack

The slack connection can be used to access Slack resources.

connection "slack" "my_slack" {
token = "xoxp-234567890"
}

Arguments

NameTypeRequired?Description
tokenStringOptionalAn API token for slack.

All arguments are optional, and a slack connection with no arguments will behave the same as the Slack default connection.

Attributes (Read-Only)

AttributeTypeDescription
envMapA map of the resolved connection-related environment variables (SLACK_TOKEN)

Default Connection

The Slack connection type includes an implicit, default connection (connection.slack.default) that will be configured to set the token to the SLACK_TOKEN environment variable.

connection "slack" "default" {
token = env("SLACK_TOKEN")
}

Examples

Static Connections

connection "slack" "my_slack" {
token = "xoxp-234567890"
}

Using Slack Connections in HTTP Step

pipeline "gcp_test" {
param "connection" {
type = string
default = "default"
}
step "http" "list_channels" {
url = "https://slack.com/api/conversations.list"
method = "get"
request_headers = {
Content-Type = "application/json; charset=utf-8"
Authorization = "Bearer ${connections.slack[param.connection].token}"
}
request_body = jsonencode({
types = "public_channel"
})
}
}