> ## Documentation Index
> Fetch the complete documentation index at: https://kawax.biz/llms.txt
> Use this file to discover all available pages before exploring further.

# Terraform Provider for Laravel Cloud — manage infrastructure as code

> An introduction to laravel/terraform-provider-laravel. Learn how to declaratively manage Laravel Cloud applications, environments, databases, caches, buckets, and more with Terraform.

> [!NOTE]
>
> This article is based on the README.md, docs, examples, and CHANGELOG of [laravel/terraform-provider-laravel](https://github.com/laravel/terraform-provider-laravel). It reflects v1.5.1 (released November 25, 2026). The provider is currently in beta and may change between releases.

## What is the Terraform provider?

[laravel/terraform-provider-laravel](https://github.com/laravel/terraform-provider-laravel) is a [Terraform](https://www.terraform.io/) provider for managing [Laravel Cloud](https://cloud.laravel.com) infrastructure. You can describe configurations that you previously set up by hand in the dashboard or with the [Laravel Cloud CLI](https://kawax.biz/en/blog/laravel-cloud-cli.md) as code, then review the changes with `terraform plan` and apply them with `terraform apply`.

With this provider, you can keep application and environment definitions together with databases, caches, storage buckets, WebSocket servers, domains, and scheduled commands in a single configuration.

## Requirements

* Terraform 1.0 or later
* Go 1.25 or later (only needed to build the provider from source)

## Installation

Add the provider to `required_providers` and run `terraform init`.

```hcl theme={null}
terraform {
  required_providers {
    laravel = {
      source  = "laravel/laravel"
      version = "~> 1.0"
    }
  }
}

provider "laravel" {
  # We recommend passing the token with the LARAVEL_CLOUD_API_TOKEN environment variable.
}
```

```bash theme={null}
export LARAVEL_CLOUD_API_TOKEN="your-laravel-cloud-api-token"
terraform init
terraform plan
```

## Authentication

The API token is resolved in this order:

1. The `token` argument in the provider block
2. The `LARAVEL_CLOUD_API_TOKEN` environment variable
3. The token saved by `cloud auth` (`~/.config/cloud/config.json`)

If none of these are set, a local `terraform plan` works without exporting anything as long as you are logged in with the [Laravel Cloud CLI](https://kawax.biz/en/blog/laravel-cloud-cli.md). If you are logged in to more than one organization, the provider asks you to set the token because it cannot tell which organization you want to manage.

> [!WARNING]
>
> If you write the token directly in the `provider` block, it leaks when you commit the configuration file. Pass it through an environment variable or a secrets manager instead.

## Main resources

Resources fall into these groups.

| Group | Example resources |
| - | - |
| Applications | `laravel_cloud_application`, `laravel_cloud_environment`, `laravel_cloud_instance` |
| Processes | `laravel_cloud_background_process`, `laravel_cloud_scheduled_command`, `laravel_cloud_deployment`, `laravel_cloud_command` |
| Databases | `laravel_cloud_database_cluster`, `laravel_cloud_database`, `laravel_cloud_database_user`, `laravel_cloud_database_snapshot`, `laravel_cloud_database_restore` |
| Cache and storage | `laravel_cloud_cache`, `laravel_cloud_storage_bucket`, `laravel_cloud_storage_bucket_key` |
| Networking | `laravel_cloud_domain`, `laravel_cloud_edge_network_rule`, `laravel_cloud_environment_internal_networking` |
| Configuration and secrets | `laravel_cloud_environment_variables`, `laravel_cloud_secret`, `laravel_cloud_environment_secret` |
| WebSocket | `laravel_cloud_websocket_server`, `laravel_cloud_websocket_application` |
| Email | `laravel_cloud_environment_resend` |

Data sources are available for reading existing values. For example, `laravel_cloud_regions`, `laravel_cloud_instance_sizes`, and `laravel_cloud_database_presets` let you look up valid values before you write resources.

## Minimal example

This minimal configuration defines an application and a production environment. Change `php_version` and `node_version` to match your environment.

```hcl theme={null}
resource "laravel_cloud_application" "example" {
  name       = "my-first-app"
  repository = "laravel/laravel"
  region     = "us-east-2"

  source_control_provider_type = "github"
}

resource "laravel_cloud_environment" "production" {
  application_id = laravel_cloud_application.example.id
  name           = "production"
  branch         = "main"

  php_version  = "8.4:1"
  node_version = "22"

  uses_push_to_deploy = true
}

output "application_id" {
  value = laravel_cloud_application.example.id
}
```

`php_version` is sent as `8.4:1`, and the API reports the major version as `php_major_version`. You can check it in an output value.

## Handling API limits

The Laravel Cloud API applies rate limits per organization. The provider adjusts request spacing with these two values, so a large apply is less likely to fail.

* `max_requests_per_minute`: the upper limit on API requests the provider sends. The default is `100`. Laravel Cloud allows 120 requests per minute per organization, shared across tokens and runs.
* `max_create_requests_per_minute`: the upper limit on create requests for applications, environments, instances, databases, buckets, caches, and similar resources. The default is `25`.

If several Terraform runs use the same organization at the same time, lower these values so their combined requests stay under the limit. Setting a value to `0` turns off the provider-side limit.

## Development and testing

The repository provides these tasks.

```bash theme={null}
make build     # Build the provider
make install   # Install into ~/.terraform.d/plugins for local development
make test      # Unit tests
make testacc   # Acceptance tests (requires LARAVEL_CLOUD_API_TOKEN)
make lint      # golangci-lint
```

Acceptance tests run against the live Laravel Cloud API, so you need a test organization and a token.

## Notes

* v1.0.0 was released on September 18, 2026, and the current version is v1.5.1. Releases are frequent, and resources and data sources have been added within the v1.x series.
* You can check the official change history in [CHANGELOG.md](https://github.com/laravel/terraform-provider-laravel/blob/main/CHANGELOG.md). Because the provider is in beta, always review the `terraform plan` output before applying to production.
* When you move existing Laravel Cloud resources from manual setup to Terraform, you can bring them in with `terraform import`. This makes it easier to check the differences.


## Related topics

- [laravel/agent-skills — Laravel's official AI agent skills](https://kawax.biz/en/blog/agent-skills-introduction.md)
- [Laravel Cloud — a full look at the Laravel-native PaaS](https://kawax.biz/en/blog/laravel-cloud.md)
- [Laravel Cloud CLI — operate Laravel Cloud from your terminal](https://kawax.biz/en/blog/laravel-cloud-cli.md)
- [laravel/symfony-on-cloud — run Symfony apps on Laravel Cloud](https://kawax.biz/en/blog/symfony-on-cloud-introduction.md)
- [Deployment](https://kawax.biz/en/deployment.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.