Setup Resourcely Provider

Provider is a logical abstraction of an upstream API

Resourcely's Terraform provider is a powerful tool that lets you manage your blueprint and global context definitions as code. Here's how to do that step by step.

Step 1: Set Up the Provider

In your Terraform configuration file ex. terraform.tf, start by defining the required provider:

terraform {
  required_providers {
    resourcely = {
      source = "registry.terraform.io/Resourcely-Inc/resourcely"
    }
  }
}

This section ensures you're using the Resourcely Terraform provider from the official Terraform Registry.

Step 2: Authentication

Before you can run any Terraform commands to manage resources with Resourcely, you must authenticate with the service. The Resourcely provider expects an authentication token to be provided through the RESOURCELY_AUTH_TOKEN environment variable.

On Unix-like systems (Linux, MacOS), set the environment variable using:

export RESOURCELY_AUTH_TOKEN="<your_auth_token>"

On Windows (Command Prompt):

set RESOURCELY_AUTH_TOKEN=<your_auth_token>

On Windows (PowerShell):

$env:RESOURCELY_AUTH_TOKEN="<your_auth_token>"

Replace <your_auth_token> with the actual authentication token provided by Resourcely. You can generate the token under settingsGenerate API tokenNew access token

Note that you need to choose "Terraform Provider" Role.

Connection

Additionally, make sure your system is configured to reach the Resourcely servers.

Also set the RESOURCELY_HOSTenvironment variable to https://api.resourcely.io

Step 3: Verify Authentication

Before proceeding with the rest of the Terraform commands, ensure the environment variable is set correctly:

echo $RESOURCELY_AUTH_TOKEN

This should print out the token value. (For security reasons, avoid doing this in a shared environment or where the output can be logged or captured.)

Step 4: Write Terraform

Now that you're authenticated, you can proceed with writing Terraform to define Resourcely resources.

  1. Define the provider.

  2. Define blueprints.

  3. Define guardrails.

  4. Define global context.

  5. Initialize and apply configurations with terraform init and terraform apply.

See the other guides in this section for help with writing Terraform for Resourcely resources.

Step 5: Plan/Apply Changes

After you've defined your global context, blueprints, and guardrails, you can plan and apply the changes:

terraform init
terraform plan
terraform apply

This will initialize the provider and apply your configurations, creating or updating the resources in Resourcely based on your Terraform code.

Step 6: Manage and Version Control

With the above setup, you can manage your blueprints and global context in version control (e.g., Git) to track changes, collaborate with teammates, and maintain a history of modifications.

Remember, this is a basic guide to get started. Depending on your requirements, you might have to delve deeper into the Resourcely provider's documentation to leverage more advanced functionalities.

Important Notes:

  • Make sure to secure your auth token. Avoid hardcoding it in scripts or Terraform configurations.

  • In a CI/CD environment, consider using secure environment variable mechanisms or secrets management tools to set the RESOURCELY_AUTH_TOKEN.

  • Remember to review Resourcely's documentation periodically to be aware of any changes to the authentication mechanism or any other provider-specific details.

Last updated