# Creating Workspaces

{% hint style="info" %}
**Manage Workspaces** permission is required to perform this action, please check [team-management](https://docs.terrakube.io/2.18.0/user-guide/organizations/team-management "mention") for more info.
{% endhint %}

When creating a Workspace, Terrakube supports 3 workflows types and based on the selected workflow you will need to provide some parameters. Please refer to each workflow section for more reference.

* [Version Control workflow](#version-control-workflow): Store your Terraform configuration in a git repository, and trigger runs based on pull requests and merges.
* [CLI-driven workflow](#cli-driven-workflow): Trigger remote Terraform runs from your local command line.
* [API-driven workflow](#api-driven-workflow): A more advanced option. Integrate Terraform into a larger pipeline using the [Terrakube API](https://docs.terrakube.io/2.18.0/api/getting-started).

### Version Control workflow

Click **Workspaces** in the main menu and then click the **New workspace** button

<figure><img src="https://2194998553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR6VsmuTZWhfdwP7uD6e0%2Fuploads%2Fgit-blob-35fd51f0856ae21e21f808b786ef0950a8547e47%2Fimage%20(220).png?alt=media" alt=""><figcaption></figcaption></figure>

Choose the **Version control workflow**

<figure><img src="https://2194998553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR6VsmuTZWhfdwP7uD6e0%2Fuploads%2Fgit-blob-42d7e27733e287c579e5734caec8d553969a898f%2Fimage%20(242).png?alt=media" alt=""><figcaption></figcaption></figure>

Select an existing version control provider or click **Connect to a different VCS** to configure a new one. See [vcs-providers](https://docs.terrakube.io/2.18.0/user-guide/vcs-providers "mention") for more details.

<figure><img src="https://2194998553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR6VsmuTZWhfdwP7uD6e0%2Fuploads%2Fgit-blob-a0dbcc3ba75bc341f464d984360ce3e795b6a6d2%2Fimage%20(217).png?alt=media" alt=""><figcaption></figcaption></figure>

Provide the git repository URL and click the **Continue** button.

{% hint style="info" %}
If you want to connect to a private git repo using SSH Keys you will need to provide the url in ssh format. Example <git@github.com>:jcanizalez/terraform-sample-repository.git. For more information see [ssh](https://docs.terrakube.io/2.18.0/user-guide/vcs-providers/ssh "mention")
{% endhint %}

<figure><img src="https://2194998553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR6VsmuTZWhfdwP7uD6e0%2Fuploads%2Fgit-blob-178ccdde11741667b5d8dcbc67f333bed2c38748%2Fimage%20(240).png?alt=media" alt=""><figcaption></figcaption></figure>

Configure the workspace settings.

| Field                       | Description                                                                                                                                                                                                                                                 |
| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Workspace Name              | The name of your workspace is unique and used in tools, routing, and UI. Dashes, underscores, and alphanumeric characters are permitted.                                                                                                                    |
| VCS branch                  | The branch from which to import new versions.                                                                                                                                                                                                               |
| Terraform Working Directory | Default workspace directory. Use / for the root folder                                                                                                                                                                                                      |
| Terraform Version           | The version of Terraform to use for this workspace. Check [custom-terraform-cli-builds](https://docs.terrakube.io/2.18.0/getting-started/deployment/custom-terraform-cli-builds "mention") if you want to restrict the versions in your Terrakube instance. |

Once you fill the settings click the **Create Workspace** button.

<figure><img src="https://2194998553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR6VsmuTZWhfdwP7uD6e0%2Fuploads%2Fgit-blob-3dfbe2c0189178222156d60bd02dbbafd8d075bc%2Fimage%20(135).png?alt=media" alt=""><figcaption></figcaption></figure>

You will be redirected to the Workspace page

<figure><img src="https://2194998553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR6VsmuTZWhfdwP7uD6e0%2Fuploads%2Fgit-blob-a6cb95bc61dafa716e894452491c62859b357437%2Fimage%20(107).png?alt=media" alt=""><figcaption></figcaption></figure>

And if you navigate to the **Workspace** menu, you will see the workspace in the Workspaces list

<figure><img src="https://2194998553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR6VsmuTZWhfdwP7uD6e0%2Fuploads%2Fgit-blob-f7a93798430163a3fdd73d0bb9c784baf297adaf%2Fimage%20(222).png?alt=media" alt=""><figcaption></figcaption></figure>

Once you create your workspace, Terrakube sets up a webhook with your VCS. This webhook runs a job based on the “Plan and apply” template every time you push new changes to the workspace branch. However, this feature does not work yet with Azure DevOps VCS provider.

### CLI-driven Workflow

Click **Workspaces** in the main menu and then click the **New workspace** button

<figure><img src="https://2194998553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR6VsmuTZWhfdwP7uD6e0%2Fuploads%2Fgit-blob-843d1b72f699dad2b6e95f1ec44421f10efc5652%2Fimage%20(226).png?alt=media" alt=""><figcaption></figcaption></figure>

Choose the **CLI-driven workflow**

<figure><img src="https://2194998553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR6VsmuTZWhfdwP7uD6e0%2Fuploads%2Fgit-blob-5ee4f74b33505b987021cc90a0185f658c33d222%2Fimage%20(239).png?alt=media" alt=""><figcaption></figcaption></figure>

Configure the workspace settings.

| Field             | Description                                                                                                                                                                                                                                                 |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Workspace Name    | The name of your workspace is unique and used in tools, routing, and UI. Dashes, underscores, and alphanumeric characters are permitted.                                                                                                                    |
| Terraform Version | The version of Terraform to use for this workspace. Check [custom-terraform-cli-builds](https://docs.terrakube.io/2.18.0/getting-started/deployment/custom-terraform-cli-builds "mention") if you want to restrict the versions in your Terrakube instance. |

Once you fill the settings click the **Create Workspace** button.

<figure><img src="https://2194998553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR6VsmuTZWhfdwP7uD6e0%2Fuploads%2Fgit-blob-7eb518acfd3658332842b8d0b78dabc7f7f6cfaf%2Fimage%20(97).png?alt=media" alt=""><figcaption></figcaption></figure>

You will be redirected to the Workspace page.

{% hint style="info" %}
The overview page for CLI-driven workspaces show the step to connect to the workspace using the Terraform CLI. For more details see [cli-driven-workflow](https://docs.terrakube.io/2.18.0/user-guide/workspaces/cli-driven-workflow "mention")
{% endhint %}

<figure><img src="https://2194998553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR6VsmuTZWhfdwP7uD6e0%2Fuploads%2Fgit-blob-4e735787a66e05df7ece7e46198c78cb9018474f%2Fimage%20(181).png?alt=media" alt=""><figcaption></figcaption></figure>

And if you navigate to the **Workspace** menu you will see the workspace in the Workspaces list

<figure><img src="https://2194998553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR6VsmuTZWhfdwP7uD6e0%2Fuploads%2Fgit-blob-9d011a741ed01ab103e63f47b9bb85c4c67c2373%2Fimage%20(216).png?alt=media" alt=""><figcaption></figcaption></figure>

### API-driven Workflow

Click **Workspaces** in the main menu and then click the **New workspace** button

<figure><img src="https://2194998553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR6VsmuTZWhfdwP7uD6e0%2Fuploads%2Fgit-blob-35fd51f0856ae21e21f808b786ef0950a8547e47%2Fimage%20(220).png?alt=media" alt=""><figcaption></figcaption></figure>

Choose the **API-driven workflow**

<figure><img src="https://2194998553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR6VsmuTZWhfdwP7uD6e0%2Fuploads%2Fgit-blob-e86bd23d6eae3729c7ce383a0a159e8fe143ab93%2Fimage%20(131).png?alt=media" alt=""><figcaption></figcaption></figure>

Configure the workspace settings.

| Field             | Description                                                                                                                                                                                                                                                 |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Workspace Name    | The name of your workspace is unique and used in tools, routing, and UI. Dashes, underscores, and alphanumeric characters are permitted.                                                                                                                    |
| Terraform Version | The version of Terraform to use for this workspace. Check [custom-terraform-cli-builds](https://docs.terrakube.io/2.18.0/getting-started/deployment/custom-terraform-cli-builds "mention") if you want to restrict the versions in your Terrakube instance. |

Once you fill the settings click the **Create Workspace** button.

<figure><img src="https://2194998553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR6VsmuTZWhfdwP7uD6e0%2Fuploads%2Fgit-blob-487253660ac11fa8ba7ab352eb601fd9ca6510a4%2Fimage%20(141).png?alt=media" alt=""><figcaption></figcaption></figure>

ou will be redirected to the Workspace page.

{% hint style="info" %}
For more details how to use the Terrakube API. See [api-driven-workflow](https://docs.terrakube.io/2.18.0/user-guide/workspaces/api-driven-workflow "mention")
{% endhint %}

<figure><img src="https://2194998553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR6VsmuTZWhfdwP7uD6e0%2Fuploads%2Fgit-blob-17cb00a66c7871d03e3b46f4a9b2f08e799ee492%2Fimage%20(214).png?alt=media" alt=""><figcaption></figcaption></figure>

And if you navigate to the **Workspace** menu you will see the workspace in the Workspaces list

<figure><img src="https://2194998553-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR6VsmuTZWhfdwP7uD6e0%2Fuploads%2Fgit-blob-78030eaa5754d13aeeb60135fef7dc367d7385b1%2Fimage%20(85).png?alt=media" alt=""><figcaption></figcaption></figure>
