Skip to content

Commit

Permalink
Add example usage and import instructions to HAProxy docs
Browse files Browse the repository at this point in the history
This commit enhances the documentation for HAProxy User list and Global sections by including example usage and detailed import instructions. These additions should help users better understand how to configure and import sections in Terraform.
  • Loading branch information
Aidaho12 committed Oct 15, 2024
1 parent e6068ca commit 27d60b7
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 4 deletions.
36 changes: 36 additions & 0 deletions docs/resources/haproxy_section_global.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,25 @@ description: |-
Manage HAProxy Global sections. Since this section exists by default and cannot be deleted, it can only be imported and edited. Please note that changes may cause HAProxy to restart.


## Example Usage

```terraform
provider "roxywi" {
base_url = "https://..."
login = "test"
password = "testpass"
}
resource "roxywi_haproxy_section_global" "example" {
server_id = 1
chroot = "/var/lib/haproxy"
daemon = true
socket = ["*:1999 level admin", "/var/run/haproxy.sock mode 600 level admin", "/var/lib/haproxy/stats"]
log = ["127.0.0.1 local1", "127.0.0.1 local1 notice"]
maxconn = 5000
action = "restart"
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down Expand Up @@ -46,3 +65,20 @@ Optional:

- `delete` (String)
- `update` (String)

## Import

In Terraform v1.7.0 and later, use an import block to import Group. For example:

```terraform
import {
to = roxywi_haproxy_section_global.example
id = "1-global"
}
```

Using terraform import, import Group can be imported using the `id`, e.g. For example:

```shell
% terraform import roxywi_haproxy_section_global.example 1-global
```
42 changes: 42 additions & 0 deletions docs/resources/haproxy_section_user_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,31 @@ description: |-
Manage HAProxy User list sections. Please note that changes may cause HAProxy to restart.


## Example Usage

```terraform
provider "roxywi" {
base_url = "https://..."
login = "test"
password = "testpass"
}
resource "roxywi_haproxy_section_user_list" "example" {
userlist_groups = ["group1", "group2"]
userlist_users {
user = "user1"
password = "password1"
group = "group2"
}
userlist_users {
user = "user2"
password = "password2"
}
name = "user_list"
server_id = 1
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down Expand Up @@ -52,3 +77,20 @@ Optional:
- `create` (String)
- `delete` (String)
- `update` (String)

## Import

In Terraform v1.7.0 and later, use an import block to import Group. For example:

```terraform
import {
to = roxywi_haproxy_section_user_list.example
id = "1-user_list"
}
```

Using terraform import, import Group can be imported using the `id`, e.g. For example:

```shell
% terraform import roxywi_haproxy_section_user_list.example 1-user_list
```
6 changes: 2 additions & 4 deletions templates/resources/haproxy_section_global.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@ Manage HAProxy Global sections. Since this section exists by default and cannot
### Optional

- `action` (String) What action should be taken after changing the config. Available: save, reload, restart.
- `chroot` (String) HAProxy is designed to isolate itself into a chroot jail during startup, where
it cannot perform any file-system access at all.
- `chroot` (String) HAProxy is designed to isolate itself into a chroot jail during startup, where it cannot perform any file-system access at all.
- `daemon` (Boolean) Start as a daemon. The process detaches from the current terminal after forking, and errors are not reported anymore in the terminal.
- `group` (String) A group with what HAProxy will be started.
- `log` (List of String) A list loging settings.
- `maxconn` (Number) Limits the per-process connection limit.
- `option` (String) Here you can put addinional options separeted by '
'.
- `option` (String) Here you can put addinional options separeted by '\\n'.
- `pidfile` (String) Path to the pid file.
- `socket` (List of String) A list socket settings.
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
Expand Down

0 comments on commit 27d60b7

Please # to comment.