Skip to content

bushelpowered/terraform-provider-slack

 
 

Repository files navigation

terraform-provider-slack

CircleCI

This is a Terraform provider for Slack

Maintainers

@jmatsu, @billcchung

Installation

ref: https://registry.terraform.io/providers/jmatsu/slack/latest

Or build a binary by yourself.

$ go clone ... && cd /path/to/project
$ go mod download
$ go build .
$ mv terraform-provider-slack ~/.terraform.d/plugins/[architecture name]/

See https://www.terraform.io/docs/configuration/providers.html#third-party-plugins for more details.

Requirements

  • Terraform >= v0.12.0 (v0.11.x may work but not supported actively)
  • Scope: users:read,users:read.email,usergroups:read,usergroups:write,channels:read,channels:write,groups:read,groups:write ref bot.d/src/bot.ts
    • users:read.email is required since v0.6.0

Limitations

I do not have any Plus or Enterprise Grid workspace which I'm free to use unfortunately.

That's why several resources, e.g. a slack user, have not been supported yet.

Resources

provider "slack" {
  # A token must be of an user. A bot user's token cannot be used for usergroup api call.
  # To get a token, Botkit is one of recommended methods.
  token = "SLACK_TOKEN"
}

data "slack_user" "..." {
  query_type = "name" or "id" or "email"
  query_value = "<name or real name>" or "<user id>" or "<email>"
}

data "slack_conversation" "..." {
  channel_id = <channel id>
}

data "slack_usergroup" "..." {
  usergroup_id = <usergroup id>
}

resource "slack_conversation" "..." {
  name = "<name>"
  topic = "..."
  purpose = "..."
  is_archive = <true|false>
  is_private = <true|false>
}

resource "slack_usergroup" "..." {
  handle      = "<mention name>"
  name        = "<name>"
  description = "..."
  auto_type   = "" or "admins" or "owners"
}

resource "slack_usergroup_members" "..." {
  usergroup_id = "<usergroup id>"
  members = ["<user id>", ...]
}

resource "slack_usergroup_channels" "..." {
  usergroup_id = "<usergroup id>"
  channels = ["<channel id>", ...]
}

Import

$ terraform import slack_conversation.<name> <channel id>
$ terraform import slack_usergroup.<name> <usergroup id>
$ terraform import slack_usergroup_members.<name> <usergroup id>
$ terraform import slack_usergroup_channels.<name> <usergroup id>

Release

CI will build and archive the release artifacts to GitHub Releases and terraform provider registry.

version="/\d\.\d\.\d/"

# please make sure your working branch is same to the default branch.
git tag "v$version"
git push "v$version"

LICENSE

Under MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 92.8%
  • Shell 3.4%
  • TypeScript 2.7%
  • JavaScript 1.1%