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:
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:
On Windows (Command Prompt):
On Windows (PowerShell):
You can also configure the RESOURCELY_AUTH_TOKEN
directly in the Terraform provider block (ensuring the token is securely stored in a secret management system).
If your organization uses separate tenants in Resourcely, you can configure the allowed_tenants
in the Terraform provider block to prevent accidentally mixing API keys between tenants.
Replace <your_auth_token>
with the actual authentication token provided by Resourcely. You can generate the token under settings
→ Generate API token
→ New 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_HOST
environment variable to https://api.resourcely.io
You can also pass the host
in the provider block. example:
Step 3: Verify Authentication
Before proceeding with the rest of the Terraform commands, ensure the environment variable is set correctly:
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.
Define the provider.
Define blueprints.
Define guardrails.
Define global context.
Initialize and apply configurations with
terraform init
andterraform 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:
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