Terraform


Terraform lets you manage your Files.com resources using Infrastructure-as-Code (IaC) processes.

Terraform users define and configure data center infrastructure using a declarative configuration language known as Terraform Configuration Language, or optionally JSON.

The Files.com Provider for Terraform allows you to automate the management of your Files.com site, including resources such as users, groups, folders, share links, inboxes, automations, security, encryption, access protocols, permissions, remote servers, remote syncs, data governance, and more.

Getting Started with Terraform

  1. Install Terraform
  2. Define a Terraform Configuration for your Files.com resources
  3. Run Terraform

Terraform will provision and de-provision your Files.com resources based upon the configuration you defined.

Files.com Provider Configuration

The Files.com Provider needs to be configured with authentication credentials for your Files.com site. The Provider uses a Files.com API Key to authenticate.

The authorizations and permissions will match those of the associated with the API Key. For example, an API Key of a site administrator will be able to manage all resources while an API Key of a non-administrator can only manage that user's resources.

Connection Information

Ask your Files.com administrator to provide you with an API Key for the required user account or generate your own API Key within your Files.com user account. The Provider uses a single Files.com API Key.

Use the following Terraform configuration definitions to specify your connection and authentication to Files.com:

# Specify that we want to use the Files.com Provider

terraform {
  required_providers {
    files = {
      source = "Files-com/files"
    }
  }
}

# Configure the Files.com Provider with your API Key and site URL

provider "files" {
  api_key = "YOUR_API_KEY"
  endpoint_override = "https://MYSITE.files.com"
}

Managing Resources

Refer to the Terraform Provider online documentation and the Files.com API documentation for Terraform for details about the resources that can be managed.

Resource Examples

As an onboarding example, to create a partner account on your Files.com site, place them into a group, create a folder for them, and assign them permission to the folder, use the following sample configuration:

// Create Folder

resource "files_folder" "acme_partner_folder" {
  path = "partners/acme"
}

// Create Group

resource "files_group" "partners_group" {
  notes              = "This group is for all partners."
  ftp_permission     = true
  sftp_permission    = true
  dav_permission     = false
  restapi_permission = true
  name               = "Partners"
}

// Create Partner Account

resource "files_user" "acme_user" {
  email                 = "jane@acme.com"
  authentication_method = "password"
  name                  = "Jane Doe"
  company               = "ACME Corp"
  group_ids             = "${files_group.partners_group.id}"
  notes                 = "Internal notes about this partner."
  password              = "ARea11y5tr0ngP@ssw0rd"
  self_managed          = "true"
  time_zone             = "Pacific Time (US & Canada)"
  user_root             = "partners/acme"
  username              = "jane_acme"
}

// Set Folder Permission for Acme Partner

resource "files_permission" "acme_partner_permission" {
  path       = files_folder.acme_partner_folder.path
  username   = files_user.acme_user.username
  permission = "full"
}

Additional Content in This Section:

Get Instant Access to Files.com

The button below will take you to our Free Trial signup page. Click on the white "Start My Free Trial" button, then fill out the short form on the next page. Your account will be activated instantly. You can dive in and start yourself or let us help. The choice is yours.

Start My Free Trial

©2024 Files.com. All right reserved

FILES.COM

  • Start My Free Trial
  • Pricing
  • Docs
  • API and SDKs
  • Contact

CONTACT & SUPPORT

support@files.com

(800) 286-8372

Monday–Friday

9am–8pm Eastern