Skip to main content

Provider Configuration

This guide covers all configuration options for the Kubiya Control Plane Terraform Provider, including setup for both hosted (SaaS) and self-hosted deployments.

Basic Configuration

The provider is configured using environment variables for authentication and connection settings:

Environment Variables

Required Variables

KUBIYA_CONTROL_PLANE_API_KEY

Your Kubiya Control Plane API key for authentication.
Never commit API keys to version control. Use environment variables, CI/CD secrets, or secrets management systems.

Optional Variables

KUBIYA_CONTROL_PLANE_BASE_URL

The base URL for your Kubiya Control Plane API. Default: https://control-plane.kubiya.ai (hosted/SaaS)

Hosted Control Plane Configuration

For the hosted Kubiya Control Plane (SaaS), minimal configuration is required:

Step 1: Obtain API Key

  1. Visit https://compose.kubiya.ai
  2. Navigate to SettingsAPI Keys
  3. Click Generate New API Key
  4. Copy your API key (starts with kcp_)

Step 2: Set Environment Variable

Step 3: Configure Provider

That’s it! The provider will automatically connect to the hosted control plane.

Self-Hosted Control Plane Configuration

For self-hosted deployments, you need to specify both the API key and your custom base URL:

Step 1: Obtain API Key

  1. Access your self-hosted control plane dashboard
  2. Navigate to SettingsAPI Keys
  3. Generate and copy your API key

Step 2: Configure Environment Variables

Step 3: Configure Provider

Common Self-Hosted Scenarios

Internal Network Deployment

On-Premise with Custom Port

Local Development

For local development, you may need to disable TLS verification depending on your setup. Consult your control plane documentation for security considerations.

Authentication Methods

API Key Authentication

The provider uses API key authentication via the Authorization header. Format: Authorization: Bearer <api-key> API keys should:
  • Start with kcp_ prefix
  • Be kept secure and never committed to version control
  • Have appropriate permissions for the resources you’re managing
  • Be rotated regularly per your security policies

API Key Permissions

Ensure your API key has the necessary permissions: Contact your Kubiya administrator to configure API key permissions.

Secrets Management

For production environments, use secrets management solutions instead of plain environment variables:

HashiCorp Vault

AWS Secrets Manager

Azure Key Vault

Google Cloud Secret Manager

CI/CD Integration

GitHub Actions

GitLab CI

Jenkins

CircleCI

Terraform Cloud / Enterprise

Configure environment variables in your workspace:

Workspace Variables

  1. Navigate to your workspace in Terraform Cloud
  2. Go to Variables
  3. Add environment variables:
    • Key: KUBIYA_CONTROL_PLANE_API_KEY
    • Value: Your API key
    • Sensitive: ✓ (mark as sensitive)
    • Category: Environment variable
  4. For self-hosted, also add:
    • Key: KUBIYA_CONTROL_PLANE_BASE_URL
    • Value: Your control plane URL
    • Category: Environment variable

Variable Sets

For managing multiple workspaces, create a variable set:

Multiple Environments

Manage different environments with different configurations:

Using Workspaces

Using Separate Directories

Using Environment-Specific Files

Troubleshooting

Connection Issues

Problem: Cannot connect to control plane
Solution:
  1. Verify KUBIYA_CONTROL_PLANE_BASE_URL is correct
  2. Check network connectivity
  3. Verify firewall rules allow access
  4. For self-hosted, ensure the control plane is running

Authentication Issues

Problem: Authentication failed
Solution:
  1. Verify API key is correct
  2. Check API key hasn’t expired
  3. Ensure API key has required permissions

TLS/SSL Issues

Problem: SSL certificate verification failed
Solution (for self-hosted with self-signed certificates):
  1. Use properly signed certificates in production
  2. For development, consult your control plane docs for TLS configuration options

Best Practices

Security

  1. Never commit secrets: Use .gitignore to exclude files with secrets
  2. Rotate API keys: Regularly rotate your API keys
  3. Use least privilege: Grant API keys only necessary permissions
  4. Audit access: Monitor API key usage through control plane logs
  5. Use secrets managers: Store credentials in dedicated secrets management systems

Configuration Management

  1. Environment-specific configs: Separate configurations per environment
  2. Version control: Track all Terraform configurations in Git
  3. Remote state: Use remote state backends with encryption
  4. State locking: Enable state locking to prevent concurrent modifications
  5. Consistent naming: Use clear, consistent naming conventions

Provider Versions

Pin provider versions for reproducibility:

Next Steps