symflow init
Overview
The symflow init
command will create a new directory to contain your Terraform configuration files for a given Sym Environment. It will prompt you for the name of the directory, your Slack workspace ID (the workspace in which you installed the Sym Slack App), and the name of the environment (e.g. prod
).
This following section describes theenvironment.tf
and versions.tf
files generated by the command. This is the basic setup shared between all Flows.
environment.tf
environment.tf
First off, we need to declare the sym
provider and org
ID. The environment_name
is stored in the locals
block in environment.tf
so that it may be referenced as local.environment_name
in other Terraform files in this directory.
locals {
environment_name = "prod"
}
provider "sym" {
org = "your-org-id"
}
sym_environment
sym_environment
The sym_environment
resource is a collection of shared configuration for your Flows. It will tell your Flow, for example, where to send errors and which integrations to use:
resource "sym_environment" "this" {
name = local.environment_name
error_logger_id = sym_error_logger.slack.id
integrations = {
slack_id = sym_integration.slack.id
# Add your integration IDs here!
}
}
sym_integration
sym_integration
sym_integration
resources allow you to provide Sym with the credentials and context to connect to an external service. In this case, the Slack integration only needs your Workspace ID.
resource "sym_integration" "slack" {
type = "slack"
name = "${local.environment_name}-slack"
external_id = "T12345"
}
sym_error_logger
sym_error_logger
The sym_error_logger
resource configures the Slack channel destination for any warnings and errors that occur during the execution of a Flow.
resource "sym_error_logger" "slack" {
integration_id = sym_integration.slack.id
# Make sure that this channel has been created in your workspace
destination = "#sym-errors"
}
versions.tf
versions.tf
This file declares the version of the Sym Terraform Provider to use. Check out the Terraform Registry for more detailed documentation on the Sym Terraform Provider.
terraform {
required_providers {
sym = {
source = "symopsio/sym"
version = "~> 2.0"
}
}
}
Next steps
Next, run symflow generate
in the directory created by symflow init
to add a Flow and see Sym in action!
Updated 2 months ago