Step 1: Initial Setup

This step establishes the foundational Terraform configuration required to work with the Tailor Platform. You'll define the Tailor provider and create a workspace variable that will be used throughout your infrastructure configuration.

What This Step Does

In this step, you configure Terraform to communicate with the Tailor Platform by:

  1. Declaring the Tailor provider as a required provider
  2. Initializing the Tailor provider block for authentication
  3. Creating a workspace variable to specify which workspace your resources will be deployed to

The provider configuration enables Terraform to authenticate with Tailor's API, while the workspace variable allows you to parameterize your deployment target, making your configuration reusable across different workspaces.

Configuration Files

To follow along, review the configuration files for this step here.

provider.tf

This file declares the Tailor provider and its version requirements:

<span><span style="color: var(--shiki-token-function)">terraform</span><span style="color: var(--shiki-color-text)"> {</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-function)">required_providers</span><span style="color: var(--shiki-color-text)"> {</span></span>
<span><span style="color: var(--shiki-color-text)">    tailor </span><span style="color: var(--shiki-token-keyword)">=</span><span style="color: var(--shiki-color-text)"> {</span></span>
<span><span style="color: var(--shiki-color-text)">      source </span><span style="color: var(--shiki-token-keyword)">=</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;tailor-platform/tailor&quot;</span></span>
<span><span style="color: var(--shiki-color-text)">    }</span></span>
<span><span style="color: var(--shiki-color-text)">  }</span></span>
<span><span style="color: var(--shiki-color-text)">}</span></span>
<span></span>
<span><span style="color: var(--shiki-token-function)">provider</span><span style="color: var(--shiki-color-text)"> &quot;tailor&quot; {</span></span>
<span><span style="color: var(--shiki-color-text)">}</span></span>
<span></span>

The required_providers block specifies that Terraform should use the Tailor provider from the Terraform Registry.

The provider "tailor" block initializes the provider. Authentication credentials are typically provided through environment variables or the Tailor CLI configuration, so no explicit credentials are needed in this block.

variables.tf

This file defines the workspace variable that will be used across all resources:

<span><span style="color: var(--shiki-token-function)">variable</span><span style="color: var(--shiki-color-text)"> &quot;workspace_id&quot; {</span></span>
<span><span style="color: var(--shiki-color-text)">  type        </span><span style="color: var(--shiki-token-keyword)">=</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-keyword)">string</span></span>
<span><span style="color: var(--shiki-color-text)">  description </span><span style="color: var(--shiki-token-keyword)">=</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;The workspace ID to use for all resources&quot;</span></span>
<span><span style="color: var(--shiki-color-text)">}</span></span>
<span></span>

The workspace_id variable allows you to specify which Tailor workspace to deploy resources to. This makes your configuration flexible and reusable across different environments (development, staging, production).

Expected Outcome

After completing this step and running terraform init, you should see:

  1. Terraform successfully downloads and installs the Tailor provider
  2. The provider is ready to authenticate with the Tailor Platform API
  3. Your workspace variable is defined and ready to be used in subsequent resource definitions

You can verify the setup by running:

<span><span style="color: var(--shiki-token-function)">terraform</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">init</span></span>
<span></span>

This command should complete without errors and display a message indicating that Terraform has been successfully initialized and the Tailor provider has been installed.

Next step

Continue to Step 2: Create Database and Types.