Resourcely Documentation
LoginSign Up
  • Get Started
    • 🎱What is Resourcely?
    • 👋Why Resourcely
    • 🏃Quickstart
      • Terraform policies integrated into CI
      • Remediate policy violations in existing infrastructure
      • Templates for generating Terraform
      • Glossary
  • Concepts
    • Foundry
      • Create Blueprints with Foundry
      • Creating Guardrails with Foundry
      • lmport Terraform Modules
    • Guardrails
      • Writing your own Guardrails
      • Editing Guardrails
      • Releasing Guardrails
      • Enabling Inactive Guardrails
      • Guardrails in Action
        • 🐱GitHub Actions
        • 🦊GitLab Pipelines
    • Campaigns
      • Get started with Campaigns
      • Creating Campaigns
      • Remediate Resources
      • Campaign Agent
        • State File Support
          • Amazon Simple Storage Service (S3)
          • Google Cloud Storage (GCS)
          • HCP Terraform
          • Spacelift
        • Running Campaigns with GitHub Actions and a Repo-Hosted State File
        • Running Campaigns Locally
    • Blueprints
      • Authoring Your Own Blueprints
      • Using Built-in Resourcely Blueprints
      • Configuring Global Contexts
      • Deep Linking
    • Resources
      • Provisioning Infrastructure
      • Editing Infrastructure
      • Shopping Cart
      • Config Roots and Environments
    • Other Features and Settings
      • Global Values
      • Global Context
      • Metrics
      • Resourcely-cli
      • Resourcely.yaml
      • VCS Proxy
      • Settings
        • User management
        • Company Information
        • Notification Settings
        • Change Management
          • 🐱Connect to GitHub
          • 🦊Connect to Gitlab
        • Generate API Token
    • ✨Production Setup
      • Single Sign-On (SSO)
        • Auth0
        • AWS Single Sign-On
        • Azure AD
        • Google Workspace
        • JumpCloud
        • Okta
        • Omnissa Workspace ONE (formerly VMware)
        • OneLogin
        • Ping Identity
        • Other SAML / OIDC Providers
      • Source Code Management
        • Page
        • 🐱GitHub
        • 🦊GitLab
        • Atlassian Bitbucket
        • Azure Repos
  • Tutorials and guides
    • Remediation Use Cases
      • Apply tags to resources for automating backups
      • Implement centralized logging
    • Blueprints Use Cases
      • Automate Data Pipeline Creation
      • Encryption for GCP
      • AWS Account Factory
      • Streamline and govern AI
      • IAM Factory
      • Cost optimization for FinOps
      • Guardrails for Terraform Modules
    • Using the Resourcely Terraform Provider
      • Setup Resourcely Provider
      • Blueprints
      • Guardrails
      • Global Context
  • Integrate
    • CI/CD & Terraform Runners
      • Atlantis
      • 🐟AWS CodeBuild
      • Azure Pipelines
      • Buildkite
      • CircleCI
      • CloudBees CI
      • Codefresh
      • Digger
      • Env0
      • 🎏GitHub Actions
        • 🐱Local Plan
          • 🐹AWS with OpenID Connect
        • 🐶Terraform Cloud Integration
      • 🦊GitLab Pipelines
      • Harness
      • 🗻HashiCorp Cloud Platform (formerly Terraform Cloud)
      • Jenkins
      • Octopus Deploy
      • Scalr
      • 🌌Spacelift
      • Terramate
      • 🌎Terrateam
    • Cloud Providers
      • 🌨️Amazon Web Services (AWS)
      • 🤓Google Cloud Platform (GCP)
        • Guardrail Gaunlet at Google Cloud Next 2025
      • 💾Microsoft Azure
      • Alibaba Cloud
      • Huawei Cloud
      • IBM Cloud
      • Oracle Cloud Infrastructure (OCI)
      • Tencent Cloud
      • VMware vSphere
    • Developer Portals
      • Atlassian Compass
      • Backstage
      • Cortex
      • Harness IDP
      • Home grown internal developer portals
      • OpsLevel
      • Port
      • Roadie
    • ITSM
      • Atlassian Jira
      • FreshWorks
      • ServiceNow ITSM
      • ZenDesk
    • CSPM
      • Wiz
    • More Terraform Provider Integrations
      • 🚂ConductorOne Provider
      • Databricks Provider
      • Kubernetes Provider
      • 🐕Datadog Provider
      • ❄️Snowflake Provider
Powered by GitBook
On this page
  1. Tutorials and guides
  2. Using the Resourcely Terraform Provider

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

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).

provider "resourcely" {
  auth_token = <RESOURCELY_AUTH_TOKEN>
}

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.

provider "resourcely" {
  allowed_tenants = ["tenant_name"]
}

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_HOSTenvironment variable to https://api.resourcely.io

You can also pass the host in the provider block. example:

provider "resourcely" {
  host = var.host
}

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.

PreviousUsing the Resourcely Terraform ProviderNextBlueprints

Last updated 6 months ago