Skip to content

Files-com/terraform-provider-files

Repository files navigation

Files.com Terraform Provider

The Files.com Terraform Provider provides convenient access to the Files.com API for managing your Files.com account.

Introduction

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.

Requirements

Installation

Require the provider in your Terraform configuration:

## 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"
}

Explore the terraform-provider-files code on GitHub.

Authentication

Authenticate with an API Key

Authenticating with an API key is the recommended authentication method for most scenarios, and is the method used in the examples on this site.

To use the Terraform provider with an API Key, first generate an API key from the web interface or via the API or an SDK.

Note that when using a user-specific API key, if the user is an administrator, you will have full access to the entire API. If the user is not an administrator, you will only be able to access files that user can access, and no access will be granted to site administration functions in the API.

provider "files" {
  api_key = "YOUR_API_KEY"
}
## Alternatively, you can set the API key as an environment variable.
export FILES_API_KEY="YOUR_API_KEY"

Don't forget to replace the placeholder, YOUR_API_KEY, with your actual API key.

Configuration

Configuration Options

Endpoint Override

Setting the endpoint override for the API is required if your site is configured to disable global acceleration. This can also be set to use a mock server in development or CI.

provider "files" {
  endpoint_override = "https://SUBDOMAIN.files.com"
}

Mock Server

Files.com publishes a Files.com API server, which is useful for testing your use of the Files.com SDKs and other direct integrations against the Files.com API in an integration test environment.

It is a Ruby app that operates as a minimal server for the purpose of testing basic network operations and JSON encoding for your SDK or API client. It does not maintain state and it does not deeply inspect your submissions for correctness.

Eventually we will add more features intended for integration testing, such as the ability to intentionally provoke errors.

Download the server as a Docker image via Docker Hub.

The Source Code is also available on GitHub.

A README is available on the GitHub link.

Usage

See the docs directory for Resource and Data Source examples and documentation.

Debugging

This provider uses the standard Terraform debugging methods. For more information, please refer to the Terraform Debugging documentation.

Getting Support

The Files.com team is happy to help with any SDK Integration challenges you may face.

Just email support@files.com and we'll get the process started.