> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/pam/knowledge-base/knowledge-base-articles/terraform-provider.md).

# Terraform provider

Terraform provider enables you to manage your Devolutions Server instance. To learn more about Terraform provider, consult our [GitHub.](https://github.com/Devolutions/terraform-provider-dvls?tab=readme-ov-file)

{% hint style="info" %}
This provider is a work in progress, expect breaking changes between releases.
{% endhint %}

### Requirements

* [Terraform](https://www.terraform.io/downloads.html) 1.0
* [Go](https://golang.org/doc/install) 1.18
* [Devolutions Server](https://devolutions.net/server) 2025.2.4.0

### Building the provider

1. Clone the repository
2. Enter the repository directory
3. Build the provider using the Go `install` command:

```go
go install
```

### Adding dependencies

This provider uses [Go modules](https://github.com/golang/go/wiki/Modules). Please see the Go documentation for the most up to date information about using Go modules.

To add a new dependency `github.com/author/dependency` to your Terraform provider:

```go
go get github.com/author/dependency
go mod tidy
```

Then commit the changes to `go.mod` and `go.sum`.

### Using the provider

Visit the Terraform Registry at <https://registry.terraform.io/providers/Devolutions/dvls/latest> for usage information.

### Developing the provider

If you wish to work on the provider, you will first need [Go](http://www.golang.org/) installed on your machine (see [Requirements](https://github.com/Devolutions/terraform-provider-dvls?tab=readme-ov-file#requirements) above).

* To compile the provider, run `go install`. This will build the provider and put the provider binary in the `$GOPATH/bin` directory.
* To generate or update documentation, run `go generate`.
* In order to run the full suite of Acceptance tests, run `make testacc`.

*Note:* Acceptance tests create real resources, and often cost money to run.

`make testacc`

### Testing the provider while developing

In order to perform a test of the provider, create/update the `~/.terraformrc` (`%APPDATA%\terraform.rc` on Windows) file with the following content:

```hcl
provider_installation {
  dev_overrides {
    "devolutions/dvls" = "/Users/USERNAME/go/bin"
  }
  direct {
  }
}
```

Replace `/Users/USERNAME/go/bin` with the path to the compiled provider binary according to your operating system and environment.

Then run the following command, assuming you are on macOS or Linux:

`go build -o ~/go/bin/terraform-provider-dvls_v0.5.0`

`chmod +x ~/go/bin/terraform-provider-dvls_v0.5.0`

Notes: the version number should match the version of the provider you are working on.

You can then create a `test.tf` or `example.tf` file with the required content; here is a sample:

```hcl
provider "dvls" {
  base_uri   = "https://your-dvls-instance.com/"
  app_id     = "your-app-id"
  app_secret = "your-app-secret"
}

data "dvls_entry_website" "example" {
  id = "id-of-website-entry"
}

output "website_name" {
  value = data.dvls_entry_website.example.name
}

terraform {
  required_providers {
    dvls = {
      source = "devolutions/dvls"
    }
  }
}
```

Then run the following command:

`terraform plan`

This will be the output:

```
│ Warning: Provider development overrides are in effect
│
│ The following provider development overrides are set in the CLI configuration:
│  - devolutions/dvls in /Users/USERNAME/go/bin
│
│ The behavior may therefore not match any released version of the provider and applying changes may cause the state to become incompatible
│ with published releases.
╵
data.dvls_entry_website.example: Reading...
data.dvls_entry_website.example: Read complete after 1s [id=123e4567-e89b-12d3-a456-426614174000]

Changes to Outputs:
  + website_name = "TestWebsite"
```

Please note that the `.gitignore` already ignores the `dev.tfrc`, `.terraform.lock.hcl`, `test.tf`, `example.tf`, and `terraform.tfstate` files and the folder `.terraform/`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.devolutions.net/pam/knowledge-base/knowledge-base-articles/terraform-provider.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
