> 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/it/knowledge-base/knowledge-base-articles/terraform-provider.md).

# Provider Terraform

Il provider Terraform le consente di gestire la sua istanza di Devolutions Server. Per maggiori informazioni sul provider Terraform, consulti il nostro [GitHub.](https://github.com/Devolutions/terraform-provider-dvls?tab=readme-ov-file)

{% hint style="info" %}
Questo provider è in fase di sviluppo, sono da prevedere modifiche non retrocompatibili tra una versione e l'altra.
{% endhint %}

### Requisiti

* [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

### Compilazione del provider

1. Cloni il repository
2. Acceda alla directory del repository
3. Compili il provider utilizzando il comando Go `install`:

```go
go install
```

### Aggiunta di dipendenze

Questo provider utilizza i [moduli Go](https://github.com/golang/go/wiki/Modules). Consulti la documentazione di Go per le informazioni più aggiornate sull'utilizzo dei moduli Go.

Per aggiungere una nuova dipendenza `github.com/author/dependency` al suo provider Terraform:

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

Quindi esegua il commit delle modifiche a `go.mod` e `go.sum`.

### Utilizzo del provider

Visiti il Terraform Registry all'indirizzo <https://registry.terraform.io/providers/Devolutions/dvls/latest> per le informazioni sull'utilizzo.

### Sviluppo del provider

Se desidera lavorare sul provider, dovrà innanzitutto installare [Go](http://www.golang.org/) sulla sua macchina (veda i [Requisiti](https://github.com/Devolutions/terraform-provider-dvls?tab=readme-ov-file#requirements) sopra).

* Per compilare il provider, esegua `go install`. Questo comando compilerà il provider e collocherà il file binario del provider nella directory `$GOPATH/bin`.
* Per generare o aggiornare la documentazione, esegua `go generate`.
* Per eseguire la suite completa dei test di accettazione, esegua `make testacc`.

*Nota:* i test di accettazione creano risorse reali e spesso comportano costi di esecuzione.

`make testacc`

### Test del provider durante lo sviluppo

Per eseguire un test del provider, crei/aggiorni il file `~/.terraformrc` (`%APPDATA%\terraform.rc` su Windows) con il contenuto seguente:

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

Sostituisca `/Users/USERNAME/go/bin` con il percorso del file binario del provider compilato in base al suo sistema operativo e al suo ambiente.

Quindi esegua il comando seguente, presupponendo che si trovi su macOS o Linux:

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

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

Note: il numero di versione deve corrispondere alla versione del provider su cui sta lavorando.

Può quindi creare un file `test.tf` o `example.tf` con il contenuto richiesto; ecco un esempio:

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

Quindi esegua il comando seguente:

`terraform plan`

Questo sarà l'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"
```

Tenga presente che il file `.gitignore` ignora già i file `dev.tfrc`, `.terraform.lock.hcl`, `test.tf`, `example.tf` e `terraform.tfstate` e la cartella `.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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
